Ksenija lizko#51
Conversation
RinOttawa
commented
Nov 2, 2019
|
Build Failed :( Надо проверить почему сборка не проходит - проблема версия .net - надо тогда или до 2.1 снизить или в Actions - файле сборки поправить |
| - name: Setup .NET Core | ||
| uses: actions/setup-dotnet@v1 | ||
| with: | ||
| dotnet-version: 2.1.802 |
There was a problem hiding this comment.
Вот тут можно на 3-. попробовать поменять
| [Fact] | ||
| public void Test1() | ||
| { | ||
|
|
| { | ||
| public class Program | ||
| { | ||
| public static void Сalculation(double x_h, double x_k, double dx) |
There was a problem hiding this comment.
переименуйте x_n -> xN (остальные переменные тоже проверьте) - в c# не принят snake_case (как в питоне), а принят camelCase
|
|
🔧 |
| double[] b = { 0.1, 0.35, 0.4, 0.55, 0.6 }; | ||
| for (int i = 0; i < 5; i++) | ||
| { | ||
| y2 = Math.Pow(Math.Pow(Math.Asin(b[i]), 2) + Math.Pow(Math.Cos(b[i]), 4), 3); |
There was a problem hiding this comment.
Само вычисление следует вынести в отдельный метод
| public static void Сalculation2() | ||
| { | ||
| double y2; | ||
| double[] b = { 0.1, 0.35, 0.4, 0.55, 0.6 }; |
There was a problem hiding this comment.
Эти параметры должны передаваться снаружи
| for (double x = xH; x <= xK; x = x + dx) | ||
| { | ||
| y = Math.Pow(Math.Pow(Math.Asin(x), 2) + Math.Pow(Math.Cos(x), 4), 3); | ||
| Console.WriteLine(y + " "); |
There was a problem hiding this comment.
Используйте форматированные строки
| public static void Сalculation2() | ||
| { | ||
| double y2; | ||
| double[] b = { 0.1, 0.35, 0.4, 0.55, 0.6 }; |
There was a problem hiding this comment.
Используйте списки вместо массивов
34a600c to
d603784
Compare
b327fd7 to
d603784
Compare
|
@jskonst добавила юнит тест к задаче на вычисления |
| { | ||
| int i = 0; | ||
| List<double> output = new List<double>(); | ||
| for (double x = xH; x <= xK; x = x + dx) |
| for (double x = xH; x <= xK; x = x + dx) | ||
| { | ||
| output.Add(Mathhh(x)); | ||
| Console.WriteLine(Mathhh(x)); |
There was a problem hiding this comment.
this function should not write into console
| { | ||
| output.Add(Mathhh(x)); | ||
| Console.WriteLine(Mathhh(x)); | ||
| i++; |
| foreach (double i in b) | ||
| { | ||
| output.Add(Mathhh(i)); | ||
| Console.WriteLine(Mathhh(i)); |
| List<double> input = new List<double>() { 0.1, 0.35, 0.4, 0.55, 0.6 }; | ||
| var res = Program.Сalculation2(input); | ||
| List<double> result = new List<double>() { 0.970885488727385, 0.744968715506544, 0.702712806929317, 0.65257962383342, 0.677063603240845 }; | ||
| Assert.Equal(res, result); |
There was a problem hiding this comment.
equale for double should have accuracy (3 digits after .)
