O
O
Oleg Ostapchuk2019-06-24 11:09:28
Algorithms
Oleg Ostapchuk, 2019-06-24 11:09:28

Why can't my degrees be converted to radians?

Once already done, this time it does not work, here is the code:

using System;
//...МаТеМкА...

class Program 
{

    const double MP3 = Math.PI /3;
    const double MP2 = Math.PI /2;
    const double plotnost = ( MP2 - MP3 ) / 30 ;

  static double cos ( double dgs ) =>   Math.Cos( plotnost * dgs ) ;

  static void Main() {
    
  Console.Clear();


    Console.WriteLine("Посчитаем x / cos(x)");
    Console.WriteLine("//\\\\//\\\\//\\\\" + "\n");



    Console.WriteLine("Введите границы аргумента, включительно: ");

    Console.Write("Сначала введите a - и Enter: ");
      double a = double.Parse(Console.ReadLine() );

      Console.Write("Теперь b: ");
    double b = double.Parse(Console.ReadLine() );

Console.WriteLine();
    Console.Write("Введите шаг" + "\n" + 
            "если превысит - мы дадим Вам ближайшее" + "\n" +
            "ко второму пределу" + "\n" + ":" );
    double h = double.Parse(Console.ReadLine() );


/*\\//\\//\\//\\//\\//\\
вычислим большую грань и меньшую - почему бы нет...
\\//\\//\\//\\//\\//*/

double tmp;

  if ( a > b ) {
    tmp = a;
    a = b;
    b = tmp;
  }

// \\ // \\ // \\ // \\ 

Console.WriteLine();
Console.WriteLine("//\\\\//\\\\//\\\\" + "\n");

Console.WriteLine(cos(Math.PI / 3) );

Console.WriteLine();

  while ( a <= b )
  {
    Console.WriteLine($"x = {a}\tf(x) = " + string.Format( " {0:0.##} ", a / cos(a) )  );
    a += h;
  }


    Console.ReadKey();

}}

Imprint :
5d10852e76c99379936115.png
Thank you :)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dasha Tsiklauri, 2019-06-24
@number_118

1 degree = Pi/180 radians
, respectively, the function for obtaining radians from degrees will be
toRad = (val) => val * PI/180;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question