Variables in Maxima



On Wed, 21 May 2003, Marc Longo wrote:

>   How can I modify the variables to get : 
> > 
> >           log(a/b) = log(a) - log (b)
> >           
> >           log(a^x) =xlog(a)

you probably want to set logexpand:all;. Try describe(log) for more info.

A sample session with comments:

(C1) display2d:false$

(C2) log(a^x);

(D2) LOG(a)*x

* this is done by default.

(C3) log(a/b);

(D3) LOG(a/b)

* here we need to set logexpand to all

(C4) logexpand:all$

(C5) log(a/b);

(D5) LOG(a)-LOG(b)

* now it does what you want

(C7) logcontract(log(a)-log(b));

(D7) LOG(a/b)

* to go the other way, you have to tell maxima a little more about your x:

(C17) LOGCONCOEFFP:'LOGCONFUN$

(C18) LOGCONFUN(M):=FEATUREP(M,INTEGER) OR RATNUMP(M)$

* logconcoeffp contains the predicate that tells maxima whether or not to 
let log "swallow" multipliers:

(C19) LOGCONTRACT(1/2*LOG(X));

(D19) LOG(SQRT(X))

(C23) DECLARE(a,integer)$

(C24) LOGCONTRACT(a*LOG(X));

(D24) LOG(X^a)

> >           sin(x/2)=sqrt((1-cosx)/2) 

(C32) HALFANGLES:true$

(C33) trigexpand(sin(x/2));

(D33) SQRT(1-COS(x))/SQRT(2)

* unfurtunately, I don't know how to go the other way.

>             2^(x+y)=2^x*2^y ?

* same thing...

Hope this helps, 

Martin