;;;;; ;;;;; Inverse ;;;;; (inverse (f x) x) (f~-1 x) (inverse (** x 2) x) ;(sqrt x) ; (inverse t (* a x^2) x) ; t = (* a x^2) ; x = (sqrt (/ t a)) (define $inverse (lambda [$t $f $x] (match f math-expr {[?simple-term? (match f symbol-expr {[,x t] [(,exp ,x) (log t)] [(,log ,x) (exp t)] [(,sqrt ,x) (** t 2)] [(,cos ,x) (acos t)] [(,sin ,x) (asin t)] [(,acos ,x) (cos t)] [(,asin ,x) (sin t)] [_ (inverse' t f x)] })] [?term? (match f term-expr {[>> (rt n t)] [> (let {[$a (/ f (** x n))]} (inverse (/ t a) (/ f a) x))] [_ (`inverse t f x)]})] [?polynomial? (match (coefficients x f) (list math-expr) {[ >)> (inverse (/ (- t c) a) (** x (+ n 1)) x)] [_ (`inverse t f x)]})] [_ (match f math-expr {[
(inverse (* p2 t) p1 x)]})] [_ (`inverse t f x)]})))