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
  • 5
    $\begingroup$ Call me skeptical... can you show the code you used where NIntegrate fails? $\endgroup$
    – bill s
    Commented Aug 26, 2016 at 23:01
  • $\begingroup$ see mathematica.stackexchange.com/a/57646/2079 $\endgroup$
    – george2079
    Commented Aug 26, 2016 at 23:17
  • $\begingroup$ Related/duplicate: mathematica.stackexchange.com/questions/118324/… $\endgroup$
    – Michael E2
    Commented Aug 26, 2016 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
    Commented Aug 27, 2016 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
    Commented Aug 31, 2016 at 20:46

0

Browse other questions tagged or ask your own question.