1
$\begingroup$

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[].

$\endgroup$
  • 5
    $\begingroup$ Call me skeptical... can you show the code you used where NIntegrate fails? $\endgroup$ – bill s Aug 26 '16 at 23:01
  • $\begingroup$ see mathematica.stackexchange.com/a/57646/2079 $\endgroup$ – george2079 Aug 26 '16 at 23:17
  • $\begingroup$ Related/duplicate: mathematica.stackexchange.com/questions/118324/… $\endgroup$ – Michael E2 Aug 26 '16 at 23:34
  • $\begingroup$ 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.. $\endgroup$ – Wizard Aug 27 '16 at 12:43
  • 1
    $\begingroup$ Implementations of the trapezoidal rule have been posted several times, not to mention the midpoint and Simpson's rules. $\endgroup$ – Michael E2 Aug 31 '16 at 20:46