From f55153fdf4048634a76620ca386d5369dea02c0c Mon Sep 17 00:00:00 2001
From: Kaputmeoy <145923568+Kaputmeoy@users.noreply.github.com>
Date: Tue, 9 Jan 2024 18:31:06 +0300
Subject: [PATCH] calculation func fix

---
 golang/internal/sample.go | 33 +++++++++++++++++++++++++++++++++
 golang/main.go            | 11 +++++++++--
 2 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/golang/internal/sample.go b/golang/internal/sample.go
index c4b72b52..9dc217b6 100644
--- a/golang/internal/sample.go
+++ b/golang/internal/sample.go
@@ -1,5 +1,38 @@
 package internal
 
+import (
+	"math"
+)
+
 func Summ(a, b int) int {
 	return a + b
 }
+
+const a = 0.8
+const b = 0.4
+
+func Calc(start, finish, delta float64) []float64 {
+	var slice = make([]float64, 0, int64((finish-start)/delta+1))
+	for x := start; x <= finish; x += delta {
+		slice = append(slice, problem1(a, b, x))
+	}
+	return slice
+}
+
+func Calcmassiw(long []float64) []float64 {
+	var answer = make([]float64, 0, len(long))
+	for _, val := range long {
+		answer = append(answer, problem1(a, b, val))
+	}
+	return answer
+}
+
+func problem1(a, b, x float64) float64 {
+	result := (math.Pow(math.Pow((x-a), 2), drob(3.0)) + math.Pow(math.Abs(x+b), drob(5.0))) / (math.Pow((math.Pow(x, 2) - math.Pow((a+b), 2)), drob(9.0)))
+	return result
+}
+
+func drob(y float64) float64 {
+	result_1 := 1 / y
+	return result_1
+}
diff --git a/golang/main.go b/golang/main.go
index 8ec574e8..fe2eff00 100644
--- a/golang/main.go
+++ b/golang/main.go
@@ -1,7 +1,14 @@
 package main
 
-import "fmt"
+import (
+	"fmt"
+
+	"isuct.ru/informatics2022/internal"
+)
 
 func main() {
-	fmt.Println("Terenteva Anastasija")
+	fmt.Println("Терентьева Анастасия Романовна")
+
+	fmt.Println(internal.Calc(1.23, 7.23, 1.2))
+	fmt.Println(internal.Calcmassiw([]float64{1.88, 2.26, 3.84, 4.55, -6.21}))
 }