3階数値微分

 投稿者:しばっち  投稿日:2019年 8月30日(金)20時00分54秒
  PUBLIC NUMERIC H
!'LET H=1/10^10 !1000桁モード
LET H=1/2^10
INPUT PROMPT "X=":X
PRINT F(X)
PRINT DIFF5(X)
PRINT DIFF7(X)
PRINT DIFF9(X)
PRINT DIFF11(X)
PRINT DIFF13(X)
PRINT DIFF15(X)
PRINT DIFF17(X)
PRINT DIFF19(X)
END

EXTERNAL  FUNCTION F(X)
LET F=1/X
END FUNCTION

EXTERNAL  FUNCTION DIFF5(X)
LET DIFF5=(-F(X-2*H)+2*F(X-H)-2*F(X+H)+F(X+2*H))/(2*H^3)
END FUNCTION

EXTERNAL  FUNCTION DIFF7(X)
LET DIFF7=(F(X-3*H)-8*F(X-2*H)+13*F(X-H)+0*F(X)-13*F(X+H)+8*F(X+2*H)-1*F(X+3*H))/(8*H^3)
END FUNCTION

EXTERNAL  FUNCTION DIFF9(X)
LET DIFF9=(-7*F(X-4*H)+72*F(X-3*H)-338*F(X-2*H)+488*F(X-H)-488*F(X+H)+338*F(X+2*H)-72*F(X+3*H)+7*F(X+4*H))/(240*H^3)
END FUNCTION

EXTERNAL  FUNCTION DIFF11(X)
LET DIFF11=(205*F(X-5*H)-2522*F(X-4*H)+14607*F(X-3*H)-52428*F(X-2*H)+70098*F(X-H)-70098*F(X+H)+52428*F(X+2*H)-14607*F(X+3*H)+2522*F(X+4*H)-205*F(X+5*H))/(30240*H^3)
END FUNCTION

EXTERNAL  FUNCTION DIFF13(X)
LET DIFF13=(-479*F(X-6*H)+6840*F(X-5*H)-46296*F(X-4*H)+198760*F(X-3*H)-603315*F(X-2*H)+764208*F(X-H)-764208*F(X+H)+603315*F(X+2*H)-198760*F(X+3*H)+46296*F(X+4*H)-6840*F(X+5*H)+479*F(X+6*H))/(302400*H^3)
END FUNCTION

EXTERNAL  FUNCTION DIFF15(X)
LET DIFF15=(1239*F(X-7*H)-20137*F(X-6*H)+155775*F(X-5*H)-766968*F(X-4*H)+2717891*F(X-3*H)-7345173*F(X-2*H)+8937819*F(X-H)-8937819*F(X+H)+7345173*F(X+2*H)-2717891*F(X+3*H)+766968*F(X+4*H)-155775*F(X+5*H)+20137*F(X+6*H)-1239*F(X+7*H))/(3326400*H^3)
END FUNCTION

EXTERNAL  FUNCTION DIFF17(X)
LET DIFF17=(-266681*F(X-8*H)+4861024*F(X-7*H)-42325960*F(X-6*H)+235093600*F(X-5*H)-940620590*F(X-4*H)+2910104288*F(X-3*H)-7218002792*F(X-2*H)+8514769120*F(X-H)-8514769120*F(X+H)+7218002792*F(X+2*H)-2910104288*F(X+3*H)+940620590*F(X+4*H)-235093600*F(X+5*H)+42325960*F(X+6*H)-4861024*F(X+7*H)+266681*F(X+8*H))/(3027024000*H^3)
END FUNCTION

EXTERNAL  FUNCTION DIFF19(X)
LET DIFF19=(63397*F(X-9*H)-1281033*F(X-8*H)+12405267*F(X-7*H)-76813928*F(X-6*H)+342868500*F(X-5*H)-1182036366*F(X-4*H)+3302404924*F(X-3*H)-7666346376*F(X-2*H)+8823005334*F(X-H)-8823005334*F(X+H)+7666346376*F(X+2*H)-3302404924*F(X+3*H)+1182036366*F(X+4*H)-342868500*F(X+5*H)+76813928*F(X+6*H)-12405267*F(X+7*H)+1281033*F(X+8*H)-63397*F(X+9*H))/(3027024000*H^3)
END FUNCTION
 

戻る