Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Simplifying polynomial and rounding problems

  • To: mathgroup at smc.vnet.net
  • Subject: [mg82838] Re: Simplifying polynomial and rounding problems
  • From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
  • Date: Thu, 1 Nov 2007 05:09:58 -0500 (EST)
  • Organization: The Open University, Milton Keynes, UK
  • References: <fg9onv$mea$1@smc.vnet.net>

Isaac Martinez G. wrote:
> I am having problems with Mathematica precision/accuracy (or whatever you call it)
> I have the following expression
> A1=1.0000000000000002-0.6721560269293043s^2 - 0.32784397307069685s^4
> Now when I factorize:
> There are a couple of (-1+s)(1+s) factors or something very close to 1. Like 0.999999999999999997+s
> I want to elliminate those factors but due to the fact that it is not really 1, but 0.999999999999999997 Mathematica does not always cancel those factors neither with A1/((-1.+s)(1.+s)) nor A1/((-1+s)(1+s)).
> How can I avoid the problem of 1 versus 0.999999999999999997
> I am doing directional coupler design and I do need to elliminate some factors from an ABCD matrix where 5 to 6 decimal places is just fine in the last step.
> I have tried
> Factor[]
> Cancel[]
> FactorList[]
> but I always have this problem and it screws up my program.
> Sorry, I am  new to Mathematica

All those functions are designed to work with *symbolic* expressions or 
*exact* arithmetic, so you may want to use *Rationalize* before 
attempting any simplifications. For instance,

In[1]:= A1 =
  1.0000000000000002 - 0.6721560269293043 s^2 -
   0.32784397307069685 s^4

Out[1]= 1.- 0.672156 s^2 - 0.327844 s^4

In[2]:= Factor@A1

Out[2]= -0.327844 (-1. + s) (1.+ s) (3.05023+ s^2)

In[3]:= Rationalize[#, 10^(-6)] & /@ %

Out[3]= -(219/668) (-1 + s) (1 + s) (3947/1294 + s^2)

In[4]:= %/((-1 + s) (1 + s))

Out[4]= -(219/668) (3947/1294 + s^2)

Regards,
-- 
Jean-Marc


  • Prev by Date: Re: Which symbolic method for this Integral ?
  • Next by Date: Re: How to construct a vector whose elements are also vectors?
  • Previous by thread: Re: Simplifying polynomial and rounding problems
  • Next by thread: Re: Simplifying polynomial and rounding problems