Chapter 3, error function E(x,a)

Problem 3.1.9 a calculation by hand is possible, but just so we have a mathematica sample.  The next  command defines function g. Following that is a “multi-part” mathematica command.  Actually three commands in the same input, separated by semicolons, so they are evaluated all at once.  These identify the point “a” at which we want to evaluate E(x,a) , a value for “delta” (to answer the “how close” question, a formula to define E(x,a) as a function (we had to use “Err” because mathematica reserves “E” for our favorite number 2.718281...), and finally a plot of |E(x,a)| for x from a-delta to a+delta.   One can then adjust by changing “delt” and  evaluating again until we see the values on the graph drop as low as we would want.

g[x_]:=x^3;delt:=0.01;a:=10;Err[x_,a_]:=g'[a]-(g[x]-g[a])/(x-a);Plot[Abs[Err[x,a]],{x,a-delt,a+delt}]

So... if instead one wanted to look at section 3.2 # 3, just define function g to be as in 3.2.2 (remember that you actually need to “evaluate” this command - enter - in order to change g).   You can evaluate the following lines that just say “g[x]” and “g’[x]” to make sure it is what you want. Then, go back to the multi-part command above, change a to 1/Sqrt[2*Pi] and evaluate.

g[t_]:=Piecewise[{{t^2*Sin[1/t^2],t<0},{t^2*Sin[1/t^2],t>0}},{0,t==0}]

g[x]

g'[x]