# How do I write an integral solver [closed]

How would you write a code that solves $\int Sin(y)dy$ (integral is from 0 to x)? The method it uses for solving doesn't really matter, although my go-to would be the Riemann sum. I need the code to be hand written though and not use an already existing solver like NIntegrate[].

• Call me skeptical... can you show the code you used where NIntegrate fails? – bill s Aug 26 '16 at 23:01
• – george2079 Aug 26 '16 at 23:17
• Related/duplicate: mathematica.stackexchange.com/questions/118324/… – Michael E2 Aug 26 '16 at 23:34
• With "integral solver" you mean computing the value of a definite integral, right? If so, you are probably doing something wrong with your code. This might also be using the wrong numerical integration method or choice of other numerical parameters for the applied algorithm like steplength, etc.. – Wizard Aug 27 '16 at 12:43
• Implementations of the trapezoidal rule have been posted several times, not to mention the midpoint and Simpson's rules. – Michael E2 Aug 31 '16 at 20:46