Skip to content

Commit

Permalink
added lab1, lab2, lab3, lab4
Browse files Browse the repository at this point in the history
  • Loading branch information
mariyayakim committed Dec 2, 2023
1 parent 68655ed commit 7ea081d
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 22 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Вот сюда нужно будет в первой работе с гитом добавит свое ФИО

## ФИО
## Якиманская Мария Алексеевна

## Работа с репозиторием

Expand Down
2 changes: 0 additions & 2 deletions golang/go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
module isuct.ru/informatics2022

go 1.16

require github.com/stretchr/testify v1.8.1
17 changes: 0 additions & 17 deletions golang/go.sum
Original file line number Diff line number Diff line change
@@ -1,17 +0,0 @@
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
28 changes: 28 additions & 0 deletions golang/internal/lab4/lab4.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package lab4

import (
"math"
)

func Calc(a, b, x float64) float64 {
return math.Pow((a+b*x)/math.Pow(math.Log10(x), 3), 1/5)
}

func Task1(a, b, xn, xk, deltax float64) []float64 {
answersA := make([]float64, int((xk-xn)/deltax+1))
for x := xn; x <= xk; x += deltax {
y := Calc(a, b, x)
answersA = append(answersA, y)
}
return answersA
}

func Task2(a float64, b float64, znX []float64) []float64 {
answersB := make([]float64, len(znX))
for _, value := range znX {
x := value
y := Calc(a, b, x)
answersB = append(answersB, y)
}
return answersB
}
14 changes: 12 additions & 2 deletions golang/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
package main

import "fmt"
import (
"fmt"

"isuct.ru/informatics2022/internal/lab4"
)

func main() {
fmt.Println("Hello world")
fmt.Println("Якиманская Мария Алексеевна")

a1 := lab4.Task1(7.2, 1.3, 1.56, 4.71, 0.63)
fmt.Println(a1)

a2 := lab4.Task2(7.2, 1.3, []float64{2.4, 2.8, 3.9, 4.7, 3.16})
fmt.Println(a2)
}

0 comments on commit 7ea081d

Please sign in to comment.