MathGroup Archive 1997

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

Search the Archive

Q:Optimize.m and common factors

  • To: mathgroup at smc.vnet.net
  • Subject: [mg9371] Q:Optimize.m and common factors
  • From: eds at gravi.physik.uni-jena.de (E. Schmidt)
  • Date: Sat, 1 Nov 1997 03:33:56 -0500
  • Organization: Friedrich-Schiller-University Jena, Germany
  • Sender: owner-wri-mathgroup at wolfram.com

Hallo, World!

My question is related to the packages Format.m (MathScr:0205-254) and
Optimize.m(MathScr:0206-592) written by Mark Sofroniou
to format Mathematica output for Fortran,C,Maple,Tex (there are two
"Optimize.m" in MathSource,
 be sure you get the right one...)

I am trying to generate the code for C or Fortran and it works good with
these packages, but NOT in the best way...

The optimization is not perfect and this is what was mentioned in docs..

But sometimes it seems to me that factorization of optimized expressions
is just ignored
Namely:
 -it never recognizes negative numbers as common factor
 -sometimes it does not recognize variables as common factor Here are
some examples

How to manage Optimize to do the job?

Any ideas are welcome


Thanks in advance
Eduard
------------------------
In[]:=
<<Optimize.m
eq1=x-3c y x^2 -6 c x^3 y
Optimize[eq1]
Optimize[Horner[eq1,{x,y}]]
Collect[eq1,{x,y,c}]
Optimize[Horner[%]]

                 2          3
Out[2]= x - 3 c x  y - 6 c x  y

                      2          3
Out[3]= {{}, x - 3 c x  y - 6 c x  y}

Out[4]= {{}, x (1 + x (-3 c y - 6 c x y))}


                 2          3
Out[5]= x - 3 c x  y - 6 c x  y

                    2                  Out[6]= {{}, x + c x  (-3 y - 6 x
y)}   (* expected:
   {{}, x -3 c x^2 y (1 + 2 x)}
or {{}, x -6 c x^2 y (0.5 + x)}
*)


In[7]:= Optimize[(1-x y)/(1+x y)]

             1 - x y
Out[7]= {{}, -------}
             1 + x y
(* expected:
   {{o1->x y}, (1-o1)/(1+o1)}
*)



  • Prev by Date: Re: Headers/Footers dialog box for 3.0.1 on the Mac -- does it work
  • Next by Date: linking C-program with Mathematica
  • Previous by thread: Re: 3.0 only copies half WMFs to the Clipboard?
  • Next by thread: linking C-program with Mathematica