-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathderivation.py
More file actions
36 lines (23 loc) · 844 Bytes
/
derivation.py
File metadata and controls
36 lines (23 loc) · 844 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import sympy
x,X,Y,c,cw,sphi,cphi,n,p,h = sympy.symbols('x X Y c cw sphi cphi n p h')
e1 = (X-x)*(cw*sympy.sqrt((h + n*p*sphi)**2 + (cphi*n*p - x)**2))
e1 = e1**2
e2 = -(cphi*n*p - x)*(c*sympy.sqrt(Y**2 + (X - x)**2))
e2 = e2**2
expr = e1 - e2
expr = sympy.expand(expr)
d = sympy.collect(expr,x,evaluate=False)
print('P[0]='+str(sympy.simplify(d[x**4])))
print('P[1]='+str(sympy.simplify(d[x**3])))
print('P[2]='+str(sympy.simplify(d[x**2])))
print('P[3]='+str(sympy.simplify(d[x**1])))
print('P[4]='+str(sympy.simplify(d[1])))
# print(sympy.simplify(d[1]))
# print(sympy.simplify(d[x**3]))
# print(sympy.simplify(d[x**2]))
# print(sympy.simplify(d[x**1]))
# print(sympy.simplify(d[1]))
# T = sympy.sqrt((h+n*p*sphi)**2 + (x-n*p*cphi)**2)/cw + sympy.sqrt((X-x)**2 + Y**2)/c
#
# dTdx = sympy.simplify(sympy.diff(T,x))
# print(dTdx)