Skip to content

Commit

Permalink
lab3-4
Browse files Browse the repository at this point in the history
  • Loading branch information
AlinaKaladina committed Jan 19, 2024
1 parent 68655ed commit eb17e08
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 3 deletions.
29 changes: 28 additions & 1 deletion golang/internal/sample.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
package internal

func Summ(a, b int) int {
import (
"math"
)

func Soch(a, b int) int {
return a + b
}

func Equation(x float64) float64 {
a := 0.4
b := 0.8
return (math.Pow(a, x) - math.Pow(b, x)) / (math.Log10(a/b) * math.Pow(a*b, 1/3.0))
}

func CalcA(x_begin, x_end, x_delta float64) []float64 {
var num_of_elements int = int((x_end) - (x_begin)/x_delta + 1)
var ResultA = make([]float64, 0, num_of_elements)
for i := x_begin; i <= x_end; i = i + x_delta {
ResultA = append(ResultA, Equation(i))
}
return ResultA
}

func CalcB(slice []float64) []float64 {
var ResultB = make([]float64, 0, len(slice))
for _, i := range slice {
ResultB = append(ResultB, Equation(i))
}
return ResultB
}
11 changes: 9 additions & 2 deletions golang/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
package main

import "fmt"
import (
"fmt"

"isuct.ru/informatics2022/internal"
)

func main() {
fmt.Println("Hello world")
fmt.Println("Колядина Алина Олеговна")
fmt.Println("Вариант 7")
fmt.Println(internal.CalcA(3.2, 6.2, 0.6))
fmt.Println(internal.CalcB([]float64{4.48, 3.56, 2.78, 5.28, 3.21}))
}

0 comments on commit eb17e08

Please sign in to comment.