display all results of sqrt()




On Wed, 19 Aug 2009, Grasemann, Karsten wrote:

< Hello to all maximaniacs,
< 
< I am using wxMaxima 0.8.2 and I am a newbie to maxima. Here's my prob:
< 
< I want to display all results of the function sqrt():
< 
< %i1 2+sqrt(4);
< %o1 4
< 
< I want to display also the result 0, because sqrt(4) can be 2 or -2. I
< have searched the help and the web but I found nothing about it.
< Probably you have the answer.
 
I think you want something like the following:

(%i2) sqt(x) := block([], if listp(x) then map(sqt,x) else
[-sqrt(x),sqrt(x)]);

(%o2) sqt(x):=block([],if listp(x) then map(sqt,x) else
[-sqrt(x),sqrt(x)])
(%i3) 2+sqt(4);

(%o3) [0,4]

Leo

-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.