Home > other >  Richard extrapolation method is used to calculate the function f (x)=sinx the derivative of the poin
Richard extrapolation method is used to calculate the function f (x)=sinx the derivative of the poin

Time:11-02

What a great god will use the python language. Write a program? Distress programming, small white first contact to all of the scores to the

CodePudding user response:

 
The from sympy import *


Def phi (x, h) :
Return (sin (x + h) - sin - h (x))/2/h


Def D (n, m) :
If m==1:
Return a float (phi (PI/3, 1/2 * * n))
Return a float (4 * * m/m - 1) (4 * * * D (n, m - 1)/(4 m - 1) * * * D (m - n - 1, 1))


While 1:
P=int (input (' please select: 1 (phi), 2 (D) : \ n '))
If p==1:
Try:
A=int (input (' please enter the number of lines: '))
For I in range (a) :
For j in range (0, I + 1) :
Print (D (I + 1, j + 1), end='\ t')
Print ()
Except the Exception:
Print (' lines for positive integer)
The continue
Elif p==2:
N=int (input (' please enter the appropriate n: '))
H=int (input (' please enter the appropriate h:))
D=phi (PI/3, h/2 * n)
Print (float (d))
The else:
Print (' input is wrong, please input again \ n ')
The continue

  • Related