summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHolden Rohrer <hr@hrhr.dev>2020-04-17 20:38:26 -0400
committerHolden Rohrer <hr@hrhr.dev>2020-04-17 20:38:26 -0400
commitf1de1283dcc7a7a1c5ca80136cc77e5221e23160 (patch)
tree5e59395f4c84eaad014787573c3ab1c4d56fca8c
parent92a0471a64beb8ce87f12504d49b5e150d25b771 (diff)
added graph.py basic math
-rw-r--r--graph.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/graph.py b/graph.py
new file mode 100644
index 0000000..0b4cc38
--- /dev/null
+++ b/graph.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+
+w = 100 # May vary
+c1 = 2.5*10**(-6)
+c2 = 1*10**(-6)
+r1 = 200
+rload = 1000
+
+a = 1
+b = c1*r1*rload + r1*c2*rload + (rload**2)*c2
+c = rload
+
+print(b**2-4*a*c)
+det = (b**2-4*a*c)**(1/2)
+r1 = (-b-det)/(2*a)
+r2 = (-b+det)/(2*a)
+
+A = c1*c2*rload**2*w*(rload-w**2)/(b**2*w**2 + rload**2 - 2*rload*w**2 + w**4)
+B = b*c1*c2*rload**2*w**3/(b**2*w**2 + rload**2 - 2*rload*w**2 + w**4)
+C = - c1*c2*rload**2*w*(rload-w**2)/(b**2*w**2 + rload**2 - 2*rload*w**2 + w**4)
+D = - b*c1*c2*rload**3*w/(b**2*w**2 + rload**2 - 2*rload*w**2 + w**4) # from https://www.wolframalpha.com/input/?i=solve+for+x1%2Cx2%2Cx3%2Cx4+in+%7B%7B1%2C0%2C1%2C0%7D%2C+%7Bb%2C1%2C0%2C1%7D%2C+%7BR%2C+b%2C+w%5E2%2C+0%7D%2C+%7B0%2C+R%2C+0%2C+w%5E2%7D%7D*%7Bx1%2Cx2%2Cx3%2Cx4%7D+%3D+%7B0%2C0%2Cw*c_1*c_2*R%5E2%2C0%7D and an insane partial fraction decomposition
+E = (D-C*r1)/(r2-r1)
+F = C - E
+G = B/w
+
+print(G,B,E,F)