soegaard / racket-cas

Simple computer algebra system

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

(diff '(sqrt x) 'x)

soegaard opened this issue · comments

Not a bug. The operator diff expects a normalized expression and '(sqrt x) isn't.

Should I infer that you were caught yourself by this, or do you keep this closed issue for reference?

Yep. I used diff in a project and forgot to normalize before calling it.

I was caught by this a couple of time in racket-cas too, and to a lesser degree in rascas, but in rascas at least you should always construct expressions with the normal operators, and never start from a quoted expression.

The downside is that the rascas operators replace the racket ones everywhere, which is often not what is wanted.

I think what I would really like is something more local like:

(with-rascas 
  (+ 'x 3)) ; works
(+ 'x 3) ; fails

Probably I should write a rascas/local module that doesn't dump/replace operators in the main namespace.