mathjs icon indicating copy to clipboard operation
mathjs copied to clipboard

Absolute Value Equations support

Open Kourser opened this issue 4 years ago • 1 comments

syntax example

| −y + 12 | = 1

result

SyntaxError: Value expected (char 1)

expected result

y=11,
y=13

Kourser avatar Sep 24 '21 17:09 Kourser

Currently, math.js doesn't have an equation solver – neither for absolute value equations, nor for anything else. But I'm sure we'll get there some day.

Btw, the syntax for absolute value is abs(x), not |x|.

cshaa avatar Oct 01 '21 20:10 cshaa

The kernel of this that I can see is a proposal that the parse allow |y+12| as an alternate notation for abs(y+12). That would certainly mesh well with standard mathematical notation. No idea off the top of my head whether it is actually feasible in the parser or not -- could easily imagine things like |x|y|| (intended to be abs(x*abs(y))) being hopelessly confusing to parse because sadly absolute value bars don't have matching open and close versions. Anyhow, retitling the issue to reflect this and moving it to Discussions.

gwhitney avatar Oct 03 '23 02:10 gwhitney