public static Equation Lookup(SpeciesFlow var, Lst <Equation> eqs, Style style) { if (eqs is Cons <Equation> cons) { if (cons.head.var.species.SameSymbol(var.species)) { return(cons.head); } else { return(Lookup(var, cons.tail, style)); } } else { throw new Error("Equation Lookup not found: " + var.Format(style)); } }
public static Polynomial Lookup(SpeciesFlow var, Lst <PolyODE> odes, Style style) { if (odes is Cons <PolyODE> cons) { if (cons.head.var.species.SameSymbol(var.species)) { return(cons.head.poly); } else { return(Lookup(var, cons.tail, style)); } } else { throw new Error("ODE Lookup not found: " + var.Format(style)); } }
public string Format(Style style) { string s = ""; if (op == "id") { s += Monomial.Format(args[0], style); } else if (op == "time") { s += op; } else if (op == "poly 1/[]") { s += "1/[" + Monomial.Format(args[0], style) + "]"; } else if (op == "poly []^(1/[])") { s += "[" + Monomial.Format(args[0], style) + "]^1/[" + Monomial.Format(args[1], style) + "]"; } else { string sargs = ""; for (int i = 0; i < args.Length; i++) { sargs += Monomial.Format(args[i], style) + ((i == args.Length - 1) ? "" : ","); } s += op + "(" + sargs + ")"; } if (splitOp == Split.Pos) { s = "pos(" + s + ")"; } if (splitOp == Split.Neg) { s = "pos(-" + s + ")"; } return(var.Format(style) + " = " + s); }
public string Format(Style style) { return("∂" + var.Format(style) + " = " + flow.Normalize(style).TopFormat(style)); }
public string Format(Style style) { return("∂" + var.Format(style) + " = " + poly.Format(style)); }
public string Format(Style style) { return(var.Format(style) + " -> " + plus.Format(style) + " - " + minus.Format(style)); }