Find or combine formulas in order to get a variable, based on a supplied list of formulas and input values in JS

28 Views Asked by At

As the title says, I need to find or combine formulas in order to get a variable e.g. "A" based on a supplied list of formulas and input values like this:

const formulas = [
    "FW=0.5*cw*roh*(v**(2))*A",
    "FG=m*g",
    "F=FG-FW",
    "a=F/m",
    "dv=a*dt",
    "ds=v*dt",
    "s=s+ds"
];

const inputs = [
    "cw=0.05",
    "m=...",
    [...]
];

Finding the initial formula to substitute in is fairly easily solved, but I'm having trouble with automatically substituting the other formulas, both in how to do it in theory and in practice. Could anyone show me how to properly implement this?

0

There are 0 best solutions below