aboutsummaryrefslogtreecommitdiffstats
path: root/notes/solve_for.txt
diff options
context:
space:
mode:
Diffstat (limited to 'notes/solve_for.txt')
-rw-r--r--notes/solve_for.txt58
1 files changed, 58 insertions, 0 deletions
diff --git a/notes/solve_for.txt b/notes/solve_for.txt
new file mode 100644
index 0000000..b1cf81d
--- /dev/null
+++ b/notes/solve_for.txt
@@ -0,0 +1,58 @@
+
+ x = a*y + c
+ y = 4 * c
+
+ solve for [c] in terms of [a, x]
+ first solve for other unknowns: [y]
+
+ x = a*(4*c) + c
+
+ x = c * (1 + 4*a)
+ c = (1 + 4*a) / x
+
+N equations in M unknowns, P constants
+
+ 0 = x + y
+ 0 = y*2 + 1 - x
+
+-----------------------------------
+
+solve_for(self, P: Vec<String>, M: Vec<String>, Q: HashMap<String, Expr>)
+
+
+returns a ModelicaModel with fixed components; equations are LHS identifier, in
+ correct order, no extends, no connections, name suffixed " (rewritten)",
+ components as Parameter (w/ val), Input, or Output
+
+
+V variables
+Q constants (become kwargs)
+P bound vars (independent, inputs/passed, become like constants)
+M unknowns (dependent, outputs)
+N' total equations
+N equations with unknowns
+
+ V = Q + P + M
+ check: each Q is Integer or Float UnderSpecifiedConstant
+ filter N' to get N OverConstrained if extra equations
+ check: N >= M UnderConstrained
+
+while len(eqns) > 0:
+ 1. find first eqn with single unknown, and pop it
+ 2. rebalance to get unknown on LHS
+ 3. remove unknown from unknown list
+
+return: sort equations to match order
+
+solve_for(var) impl for SimpleEquation => Result<SimpleEquation, String>
+ check: var only on one side VariableNotFound or NaiveImplementation
+ put var on LHS
+ recursively apply rules to symmetrically unwrap LHS onto RHS
+ if try to unwrap Abs: NaiveImplementation
+
+-----------------------------------
+systems of differential equations:
+ will be N equations of N variables, in terms of implied time
+
+should be no unknowns; odex thing is just varying initial equations
+have JS boxes to show ranges of initial conditions