3
$\begingroup$

I am pretty new to Mathematica. I have version 6 and wish to try a code listed in http://numericaltank.sjtu.edu.cn/2ndBook/APO/APO.txt about Homotopy Analysis Method for American Put Option. However, as I run the code, I have this note:

enter image description here

And I do not get the plot I should have. The only plot command in the code is

If[NumberQ[gamma] && NumberQ[sigma] && NumberQ[X],
  Plot[{Bp,B[m1],Bpade[m1]},{t,0,1.25*T},
      PlotRange -> {0.8*Bp,X}, PlotStyle ->
      {RGBColor[1,0,0],RGBColor[0,1,0],RGBColor[0,0,1]}];
  Print[" Order of homotopy-approximation : ",m1];
  Print[" Green line : optimal exercise boundary B
                       in polynomial "];
  Print[" Blue line : optimal exercise boundary B
                       by Pade method "];
  Print[" Red line : perpetual optimal exercise price "];
  ];

Any idea what should I do to get the plot? Thanks!

$\endgroup$
2

1 Answer 1

4
$\begingroup$

None of the functions in Graphics`Graphics` seems to have been actually used in the old code, so the problem lies in the use of the Padé approximant. PadeApproximant[] is now a builtin function with slightly different syntax from the old package function, so you'd do well to compare the usage in the old code with the current syntax, make the necessary changes, and try again. As a particular example, change Pade[temp[0], {s, 0, OrderTaylor, OrderTaylor}] to PadeApproximant[temp[0], {s, 0, OrderTaylor}].

$\endgroup$
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.