Skip to content
This repository has been archived by the owner on May 23, 2019. It is now read-only.

Solver can't solve to fractions with variables. #90

Open
sjorsvanheuveln opened this issue Mar 29, 2018 · 1 comment
Open

Solver can't solve to fractions with variables. #90

sjorsvanheuveln opened this issue Mar 29, 2018 · 1 comment

Comments

@sjorsvanheuveln
Copy link

sjorsvanheuveln commented Mar 29, 2018

The solver can't solve to fractions with variables. For example the speed formula:
s = a/t. So the solver can solve for 'a' -> a = st, but not for 't' -> undefined. Probably because Fraction can't handle variables in the numerator or denominator. This is a serious issue.

    let expr = new Expression('s');
    expr = expr.multiply('t');

    const eq = new Equation(expr, new Expression('a'));
    const aAnswer = eq.solveFor('a');
    const tAnswer = eq.solveFor('t');

    console.log(`a = ${aAnswer}`); // this works: a = st
    console.log(`t = ${tAnswer}`); // this fails: t = undefined
@LukeBorowy
Copy link

I agree, this is a large problem. It prevents many simple things from being done. For example, simply doing new algebra.Expression("a").divide("b") causes an Uncaught TypeError: Invalid Argument (b): Divisor must be of type Fraction or Integer.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants