jiggzson / nerdamer

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

System of equations fail with Maximum call stack size exceeded #546

Closed cur3n4 closed 3 years ago

cur3n4 commented 4 years ago

The equations are:

solveEquations([
   `y=x * 2`,
   `z=y + max (y * 0.1, 23)`,
   `j=y + max (y * 0.1, 23)`,
   `6694.895373 = j + z + (max(j * 0.280587, z * 0.280587, 176))`
])

Wolfram Alpha returns: x = 1334.36 and y = 2668.73 and z = 2935.6 and j = 2935.6

jiggzson commented 4 years ago

Interesting. I'll look into it.

jiggzson commented 3 years ago

@cur3n4, this one is fixed. I know if sat a while but I finally managed to get to it. Oddly enough, I thought this was going to be a lot harder than it really was. I don't get Wolfram Alpha's numbers instead I get

{ 
  j: 2935.601831019821,
  x: 1334.3644686453729,
  y: 2668.7289372907458,
  z: 2935.601831019821 
}

These numbers seem to also satisfy the system.

Edited: I should have double checked the solutions. Turns out their the same.