I am working on some Numerical Analysis with Maple as a part of my course and I am not sure where my error is with the code I am using.. If anyone can point out my flaw It would be very much appreciated as I seem to be getting the answer wrong.
f(x)=sqrt((cosh(x))^2 + 1) - sinh(x). Find a good approximation to f(4.86) using a 6-digit arithmetic. Then, Use 20 digit arithmetic to calculate the relative error. Finally, round it to 6 (significant) digits
f := sqrt(cosh(x)^2+1)-sinh(x);
f1 := evalf[6](f(4.86));
f1 := 0.0155
f2 := evalf(f(4.86));
f2 := 0.01550004
Digits := 20;
Digits := 20
Q4 := abs((f2-f1)/f2);
Q4 := 0.0000025806385015780604437
Digits := 6;
Digits := 6
evalf[6](Q4);
0.00000258064
Thanks everyone
You've made one syntax transcription mistake, and one Maple programming mistake.
Your first line is
but you subsequently call it like an operator (procedure), eg.
f(4.86)and obtain a numeric value. Therefore you must have originally used something like this procedure, instead.So that was likely just a transcription error when posting here.
You have made a programming mistake, in computing
before setting the working-precision environment variable
Digitsto20. Thus you have computedf2at only the defaultDigits=10working precision. But from the wording of the question it seems that you are being asked to computef2also at 20 digits of working precision.Your code might be revised as follows:
You have used two different mechanisms for specifying the working precision. You could have also done it (slightly more consistently in methodology) as follows:
There's always the possibility that I have misunderstood the question. What is the desired answer?