clojure-numerics/expresso

Using inverse trigo functions doesn't solve equations fully

Closed this issue · 3 comments

Example:

(solve 'x (ex (= 1 (atan x)))) => #{(tan 1)}
(solve 'x (ex (= 1 (asin x)))) => #{(sin 1)}

whereas

(solve 'x (ex (= 1 (sin x)))) => #{1.5707963267948966}
(solve 'x (ex (= 1 (tan x)))) => #{0.7853981633974483}

Actually the problem happens with normal trigonometry functions as well:

(solve 'x (ex (= x (* (tan 1) 1))))  => #{(tan 1)}
(solve 'x (ex (= x (* (atan 1) 1)))) => #{0.7853981633974483}

Seems like the numeric.expresso.properties/props multi method is missing definitions for sin/cos/tan. Adding the definitions fixes the problem.
I'll send a PR with the missing definitions.

Thanks. The trigonometric functions should be standard and provided by the library.
Note that if you have other (nonstandard) functions that you want expresso to execute after simplification you can extend the props multimethod in your application code.