Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lab3-4 #296

Open
wants to merge 5 commits into
base: Kaljadina_Alina_Olegovna
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}
10 changes: 9 additions & 1 deletion golang/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
package main

import "fmt"
import (
"fmt"

"isuct.ru/informatics2022/internal"
)

func main() {
//Лабораторная 2
fmt.Println("Калядина Алина Олеговна")
//Лабораторная 3-4 (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}))
}
Loading