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

Ksenija lizko #51

Open
wants to merge 15 commits into
base: Ksenija_Lizko
Choose a base branch
from
Open

Conversation

RinOttawa
Copy link

:)

@jskonst
Copy link
Collaborator

jskonst commented Nov 11, 2019

Build Failed :( Надо проверить почему сборка не проходит - проблема версия .net - надо тогда или до 2.1 снизить или в Actions - файле сборки поправить

- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 2.1.802
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вот тут можно на 3-. попробовать поменять

[Fact]
public void Test1()
{

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тестов бы добавить

{
public class Program
{
public static void Сalculation(double x_h, double x_k, double dx)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

переименуйте x_n -> xN (остальные переменные тоже проверьте) - в c# не принят snake_case (как в питоне), а принят camelCase

@jskonst
Copy link
Collaborator

jskonst commented Nov 25, 2019

@RinOttawa

  1. Не работают тесты
  2. Не поправлены review points
  3. Build упал

@jskonst
Copy link
Collaborator

jskonst commented Nov 25, 2019

🔧

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);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Само вычисление следует вынести в отдельный метод

public static void Сalculation2()
{
double y2;
double[] b = { 0.1, 0.35, 0.4, 0.55, 0.6 };
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Эти параметры должны передаваться снаружи

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 + " ");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Используйте форматированные строки

public static void Сalculation2()
{
double y2;
double[] b = { 0.1, 0.35, 0.4, 0.55, 0.6 };
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Используйте списки вместо массивов

@RinOttawa
Copy link
Author

@jskonst добавила юнит тест к задаче на вычисления

CourseApp/Program.cs Show resolved Hide resolved
{
int i = 0;
List<double> output = new List<double>();
for (double x = xH; x <= xK; x = x + dx)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

x += dx

for (double x = xH; x <= xK; x = x + dx)
{
output.Add(Mathhh(x));
Console.WriteLine(Mathhh(x));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this function should not write into console

{
output.Add(Mathhh(x));
Console.WriteLine(Mathhh(x));
i++;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why?

foreach (double i in b)
{
output.Add(Mathhh(i));
Console.WriteLine(Mathhh(i));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here for output

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);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

equale for double should have accuracy (3 digits after .)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants