Maxima 5.9.1 vs MuPAD 2.5.3



Hello,

Thanks for your interest in Maxima. Let me see if I can help.

> most of my computations are in Q(sqrt(5)) ; I really need to get
> a normalized result : (a + b sqrt(5))/c. For instance, is there
> a built-in method for simplifying  (2+sqrt(5))/(4+3*sqrt(5))
> to  (7+2 sqrt(5))/29 ?

I can't find a built-in function for this. An attempt to
make up some rules (via tellsimpafter) runs into a couple
of Maxima quirks: ratsimp and radcan (obvious choices to
simplify rational expressions) sometimes move a radical
into the denominator (this defeats the attempt to clear
a denominator (a + b*sqrt(5)) by multiplying by
(a - b*sqrt(5))), and sqrt and / may be turned into 
something else by the internal simplifier (exponent = 1/2
for sqrt, exponent = -1 for 1/something, and a rational
number in the case of integer/integer). These quirks make
it rather time-consuming to write the appropriate rules.
Oh well.

A partial solution, which can handle ratios of the form
(a + b*sqrt(5))/(c + d*sqrt(5)) so long as a, b, c, and d
are all literal integers, is this:

  matchdeclare (aa, notunit, [uu, vv], notsqrt);
  notunit(e) := is (e # 1);
  notsqrt(e) := e = 0 or atom(e) or op(e) # sqrt;

  tellsimpafter (1/(uu + vv*sqrt(5)), ratsimp ((uu - vv*sqrt(5))/(uu^2
- vv^2*5)));
  tellsimpafter (1/sqrt(5), ratsimp (sqrt(5)/5));
  tellsimpafter (aa/(uu + vv*sqrt(5)), ratsimp (aa*(uu -
vv*sqrt(5))/(uu^2 - vv^2*5)));
  tellsimpafter (aa/sqrt(5), ratsimp (aa*sqrt(5)/5));

After that,

(%i8) (7 + 11*sqrt(5))/(13 + 9*sqrt(5));
                         20 sqrt(5) - 101
(%o8)                  - ----------------
                                59

> In a big expression, how can I replace the variable phi^2
> with phi+1 ? The subs function of method can do that : 
> subs(expr,phi^2=phi+1) But it seems that the sublis
> function of Maxima can't do the same thing.

To judge by its behavior, it looks like sublis only wants
to substitute for atoms, not expressions. (describe(sublis)
is silent on this point. Oh well.)

ev makes multiple substitutions in parallel. 

(%i1) ev (phi^2 + phi + a, a = phi^2, phi^2 = phi + 1);
                           2
(%o1)                   phi  + 2 phi + 1

ev is a many-splendored thing; see describe(ev).

Incidentally (1 + sqrt(5))/2 is named %phi in Maxima;
Maxima might know a little bit about it.

> I got a problem with a dummy variable in the definition of
> a function having the same name as a function :
>      myfunction(f) :=  ... apply(f,...) ...
> when I tried to use myfunction(g) for calling "myfunction"
> with argument being a function g, but with the function f
> being also defined, I always got the apply function use
> the real "f" function instead of g ??? And if f isn't defined,
> the function acts as it should do, replacing the dummy
> variable f by g.

Hmm, I'm not seeing this problem. 

(%i1) f(x) := x^2$
(%i2) myfcn(f, x) := apply (f, [x])$
(%i3) myfcn(g, 1);
(%o3)                         g(1)
(%i4) g(x) := sin(x);
(%o4)                    g(x) := sin(x)
(%i5) myfcn(g, 1);
(%o5)                        sin(1)

I guess more details are needed to solve this problem.

Hope this helps,
Robert Dodier


		
__________________________________ 
Do you Yahoo!? 
Yahoo! Personals - Better first dates. More second dates. 
http://personals.yahoo.com