How to simplify exponentsHow can I make FriCAS to do 2^a2^(2a) -> 2^(3*a) ? fricas (1) -> 2^a*2^(2*a)
Type: Expression(Integer)
fricas simplify %
Type: Expression(Integer)
But I cannot convince FriCAS to do 2^(5a)/2^(4a) -> 2^a fricas 2^(5*a)/2^(4*a)
Type: Expression(Integer)
fricas simplify %
Type: Expression(Integer)
Unfortunately this seemingly simple transformation does not seem to be easy to perform in FriCAS but I have found two possible ways to do this. The first involves the normalize() operation. Unfortunately normalize takes the process one step too far. This can be undone with a simple rule. fricas exprule:=rule exp(x*log(n)) == n^x
fricas normalize %% 3
Type: Expression(Integer)
fricas exprule %
Type: Expression(Integer)
The second approach uses a single rule to do the whole job. fricas fracrule:=rule n^m/n^p == n^(m-p)
fricas fracrule %% 3
Type: Expression(Integer)
How about 2^a*4^a ? fricas 2^a*4^a
Type: Expression(Integer)
fricas simplify %
Type: Expression(Integer)
Here is one approach. First lets define a function that factors a power and a rule that applies this function. fricas powerFac(n, Type: Void
fricas powerRule := rule n^a == powerFac(n, fricas Compiling function powerFac with type (Variable(n),
Now we can use the rule and simplify the result fricas simplify powerRule (2^a*4^a)
Type: Expression(Integer)
Apparently, simplifyExp yields the desired result fricas simplifyExp(2^a*2^(2*a))
Type: Expression(Integer)
But ... --Bill Page, Mon, 11 Oct 2004 12:48:08 -0500 reply The desired result was
fricas simplifyExp(2^a*4^a)
Type: Expression(Integer)
doesn't do it. But normalize plus cleanup works: fricas normalize(2^a*4^a)
Type: Expression(Integer)
fricas exprule %
Type: Expression(Integer)
fricas powerRule %
Type: Expression(Integer)
simplifyExp does have some effect:
fricas 2^(3*a)*2^(4*a)
Type: Expression(Integer)
fricas simplifyExp(2^(3*a)*2^(4*a))
Type: Expression(Integer)
|