JME expression simplify for algebraic formulas

16 views
Skip to first unread message

Wim Obbels

unread,
Mar 30, 2022, 6:57:30 AM3/30/22
to Numbas Users
Hi,

JME expressions do simplify '(2x + 3x)/x' to 5, but not '(2x+3x^2)/x'  to 2+3x. 
Is it possible to also do these more advanced simplifications  (and e.g. also rewrite (simple) fractions of fractions, as in 1/(1/x) -> x )?

Case at hand: I generate expressions as
    exec(op('/'),[ expression('cos(x)'), expression('1/x') ])
and get cos(x)/(1/x), but would like to get x*cos(x)
( where cos and 1/x would be variables, and thus could be other functions ...)
jme_simplify.png
Wim.




Christian Lawson-Perfect

unread,
Apr 26, 2022, 9:55:43 AM4/26/22
to numbas...@googlegroups.com
Factorising general polynomials would be lovely but would take a lot of hard work to do properly. It would be a nice project for a computational maths student to take on.

I have a feeling that I looked at reducing 1/(1/x) a while ago, but I can't find it in the list of built-in rules! I've added a rule a/(b/c) → (a*c)/b to the simplifyFractions rule.

--
You received this message because you are subscribed to the Google Groups "Numbas Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to numbas-users...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/numbas-users/3f36529c-1bee-494b-9b04-666b0bb43284n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages