-
Notifications
You must be signed in to change notification settings - Fork 0
/
sym.py
64 lines (57 loc) · 1.16 KB
/
sym.py
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
from sympy import *
from sympy import Rational as RR
from sympy import ln as ln
vz=Symbol('U_\\text{з}')
vg=Symbol('U_\\text{г}')
R0=Symbol('R_0')
R=Symbol('R')
rho=Symbol('\\rho')
C=Symbol('C')
E=Symbol('\\mathcal{E}')
tau2=Symbol('\\tau_2')
v0=Symbol('U_0')
dE=Symbol('\\Delta \\mathcal{E}')
dVz=Symbol('\\Delta U_\\text{г}')
dVg=Symbol('\\Delta U_\\text{з}')
dR=Symbol('\\Delta R')
dC=Symbol('\\Delta C')
dR0=Symbol('\\Delta R_0')
rho=1/R+1/R0
tau2=rho*C*ln(((vz-v0)*R+(vz-E)*R0)/((vg-v0)*R+(vg-E)*R0))
F1=diff(tau2,E)*dE
F2=diff(tau2,vz)*dVz
F3=diff(tau2,vg)*dVg
F4=diff(tau2,R)*dR
F5=diff(tau2,R)*dR0
# F1=diff(tau2,E)
# x=abs(F1)+abs(F2)+abs(F3)+abs(F4)+abs(F5)
# su={
# dE:1,
# dVz:1,
# dVg:1,
# dR:10,
# dR0:10,
# dC:0.001,
# C:0.001,
# R:300000,
# E:123,
# vz:119.52,
# vg:109.78,
# R0:123600,
# v0:107
# }
# print(x.subs(su))
x=abs(factor(together(simplify(F1))))
print(latex(x))
print('+\\\+')
x=abs(factor(together(simplify(F2))))
print(latex(x))
print('+\\\+')
x=abs(factor(together(simplify(F3))))
print(latex(x))
print('+\\\+')
x=abs(factor(together(simplify(F4))))
print(latex(x))
print('+\\\+')
x=abs(factor(together(simplify(F5))))
print(latex(x))