Re: [Maxima] How to deal with r^(bfloat(2/3))/r^(2.0/3)



Thank you all very much for your answers and suggestions.
I gathered the techniques learned from your replies:
1. should better not to use a float to get accurate results, but fraction or symbol;
2. the better the later to assign a certain value to a symbol (but this may make the program slow);
3. some strategy on making rules;
4. not good to make manual unreasonable rules.

I have solved the problem in your guides. There is really a float I used 
in the assignment, which is p:2.5D0 (p will appear in the exponent). 
When I change it to p:5/2, everything is OK!

I also like to share a little tip, which cost my much much time to find it:
If you want to compare the numbers in two monomials, such as
x: 100*a*b and y: 200*a*b*c
you should do:
is(first(x)<first(y));
where "first" can extract the first part of a monomial.

Thank you in advance.

Yuanchuan Zou


----- ???????? ----
???????? Richard Fateman <fateman at cs.berkeley.edu>
???????? Barton Willis <willisb at unk.edu>
?????? maxima at math.utexas.edu; zycentre <zycentre-sub at yahoo.com.cn>
???????? 2007/12/13(????), ????7:28:06
?????? RE: [Maxima] How to deal with r^(bfloat(2/3))/r^(2.0/3)



 

Well, if you insist on doing this, you can 
try

 

small(x):=is(x<1.0e-6);

matchdeclare(s,small);

tellsimp(r^s,1);

 

RJF

 



  
  
  From: maxima-bounces at math.utexas.edu 
  [mailto:maxima-bounces at math.utexas.edu] On Behalf Of Barton 
  Willis
Sent: Thursday, December 13, 2007 8:48 AM
To: 
  fateman at EECS.Berkeley.EDU
Cc: maxima at math.utexas.edu; 'zycentre'; 
  maxima-bounces at math.utexas.edu
Subject: Re: [Maxima] How to deal 
  with r^(bfloat(2/3))/r^(2.0/3)



  

maxima-bounces at math.utexas.edu wrote on 
  12/13/2007 09:53:57 AM:

> Stavros has the right idea to look again 
  at what you were doing. 
> 
> A rule like changing numbers less 
  than 1.0b-16 to zero is questionable.  But
> then any use of 
   r^(float) in Maxima is unusual, so maybe nothing else will
> 
  break.
>  

I agree that such a 
  rule is questionable. But if you still want to do it,
a standard Maxima 
  programming idiom will do the trick:

 f(e) := if mapatom(e) then 
  <do something> else apply(op(e), map(f, args(e)))

I mention this 
  because the idiom is useful, not because I think that
expunging floating 
  point "fuzz" is a good thing to do.


Barton