The question is:
“Attach Mathematica (or Matlab) code solving the problems listed below. Approximate the integral from 0 to 1 for e^(-(x^2)) using the trapezoidal rule with n=20, n=200, n=2000. Write down the approximate value you get here.”
While the answer isn’t so hard to find using wolfram, I’m having trouble writing the input. Using Wolfram’s NIntegrate page, I tried the following:
NIntegrate[e^(-(x^2)), {x, 0, 1}, Method → “TrapezoidalRule”]
I ended up with the error “The integrand e^-x^2 has evaluated to non-numerical values for all sampling points in the region with boundaries {{0,0.5}}. >>”
I also haven’t figured out how to include n=20, 200, and 2000. What am I doing wrong? Thanks for the help in advance.