MatthewJA / Coffeequate

A computer algebra system for JavaScript.
http://matthewja.com/Coffeequate
MIT License
48 stars 8 forks source link

Symbolic functions #108

Closed MatthewJA closed 9 years ago

MatthewJA commented 9 years ago

CQ should be able to handle symbolic functions (of one parameter, but more would be neat). Symbolic functions would (ideally) look like f(x) (though different brackets are fine if the parser doesn't like that) and could have mostly arbitrary labels. These functions would be assumed invertible, so we could do

CQ("f(x) = y").solve("x")[0].toString() // "inv_f(y)"

or something similar.

I don't know if it's a good idea to even expose this to users, but the framework is important for the path to implementing trigonometry. Trigonometric functions and logarithms would use this framework, and you could specify (for example) that log is the inverse function of exp. My thinking is that functions would inherit from some generic function, and you can override the inverse property or something.

MatthewJA commented 9 years ago

Resolved by 468f6c6a087ccdfdc538fe34e2a0668ff91c59f2 439ea95c7e6f6c2e76491f2e985b9c731b293719 393dfd668ab7d24e07a5dcce18b458aa973ee8dc