D
D
Dmitry_Sel2021-11-09 15:13:22
Mathematics
Dmitry_Sel, 2021-11-09 15:13:22

C# Math Am I doing it right?

Write a procedure for performing function calculations:
618a64ef45e82348395559.jpeg
The output is always wrong, what am I doing wrong?

double x = 0.96;
            double y = Math.Cos(1.5 * x) - Math.Pow(Math.E, Math.Sin(x + (5.0 / 3.0))) + Math.Sqrt(x + (7.0 / 6.0));

            Console.WriteLine(" x = {0} \t y = {1} ", x, y);
            Console.ReadKey();

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
Wataru, 2021-11-09
@Dmitry_Sel

Yes, everything seems to be correct. Most likely a typo somewhere. It happens. Or somewhere it may be said that the angles should be in degrees and not radians. Then the expression under the sine / cosinos must be multiplied by 180 / pi.

A
Alexander Ananiev, 2021-11-09
@SaNNy32

Instead , use Math.ExpMath.Pow(Math.E, Math.Sin(x + (5.0 / 3.0)))
Math.Exp( Math.Sin(x + (5.0 / 3.0)))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question