Please can you help me, what is wrong with my code? | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

Please can you help me, what is wrong with my code?

https://code.sololearn.com/ckx0bZ1bN4SL/?ref=app Exercise: Try to solve the problem with SIMPSON'S RULE-INTEGRATED APPROXIMATION. f(x)=(3/2)*sin(x)*sin(x)*sin(x) between 0 and π, for integers n=40, 72, 250. https://code.sololearn.com/cqhUdziT14Rb/?ref=app

21st Jun 2023, 7:14 AM
TeaserCode
6 ответов
+ 7
Your code is using a lot of stuff from math library but you never included the headers. #include <math.h> The error message actually gives you the hint that many things are not declared. Read and understand your errors!
21st Jun 2023, 7:49 AM
Tibor Santa
Tibor Santa - avatar
+ 2
Sorry, but you did not really give any clues about your program. Is it giving a wrong result? What do you expect as output?
23rd Jun 2023, 7:08 AM
Tibor Santa
Tibor Santa - avatar
0
Ok, now I repaire it. I will appreciate if somebode tells me the right path.
21st Jun 2023, 1:59 PM
TeaserCode
0
Another approach?
23rd Jun 2023, 6:37 AM
TeaserCode
0
Program should calculte the approximation value of the integral of the function f(x)=(3/2)*sin(x)^3. The main point of the program is precision of the result. We are given various integers and for each integer is different approximation. For example: dotest(290, 1.9999999986); dotest(72, 1.9999996367); dotest(252, 1.9999999975); dotest(40, 1.9999961668); It must be taken Simpson rule for calculation of the result.
23rd Jun 2023, 7:29 AM
TeaserCode
0
Yes, I have solved it.
23rd Jun 2023, 5:23 PM
TeaserCode