Home > Back-end >  C problem (expected output I calculate different)
C problem (expected output I calculate different)

Time:10-14

Task description
Level requirements: write a c + + program to realize the calculation of trigonometric functions,

Knowledge
Taylor series
Formula:

Sin (x)=x - (x ^ 3/3!) + (x ^ 5/5! - (x ^ 7/7! +...

Cos (x)=1 - (x ^ 2/2!) + (x ^ 4/4!) - (x ^ 6/6! +...

Programming requirements
. Write a program, according to the user command output and input by the acute Angle values are calculated and trigonometric function value,

Simplified use: use an integer said user command, 1 said sin, cos 2 said,

Requirement: the 2 kinds of trigonometric function, can't use & lt; Math. H> Trigonometric functions of Taylor series expansion is used to implement,

Note: x x ^ 3 said power three, three! Said 3 factorial, other analogy,

Termination conditions: until (till) the final breakdown of the absolute value is less than 0.0000001 (i.e., 1 e - 7),

Note: the input Angle must go into radian and the value of PI agreed at 3.1416,

Test description:

Test inputs: 1 30

The expected output: 0.453451

Test inputs: 2 45

The expected output: 0.707105

CodePudding user response:

C + + is cubic with 3 x multiplication, not ^

CodePudding user response:

So the question comes, what is your output

This topic average error is a more or less of a problem

CodePudding user response:

The code posted to analysis
  • Related