jiggzson / nerdamer

a symbolic math expression evaluator for javascript
http://www.nerdamer.com
MIT License
518 stars 82 forks source link

Bug in solveEquations #639

Open Jeff-Aporta opened 3 years ago

Jeff-Aporta commented 3 years ago

In a physics exercise with g=10

  let x = nerdamer("x:420")//distance final x traveled
  let vx = nerdamer("vx:60")//Initial velocity in x 
  //Find t and H
  console.log(
    JSON.stringify(
      nerdamer.solveEquations(["-5*t^2+H=0","vx=x/t"], ["H","t"])
    )
  );

output: [["H",35],["t",7]]

The answer for time (t) is correct, but for height (H) it is not

the real answer would be H = 245 and t = 7

I think it is not taking degree 2 of the equation, the code is taking it as linear