[no subject]
- From: Steven M. Christensen <stevec at yoda.physics.unc.edu>
- Date: Wed, 7 Apr 93 10:24:50 +0200
- Apparently-to: mathgroup-send at yoda.physics.unc.edu
Hi mathgroup, dear Wolfram Researcher A trivial Integral like Int(z^-(3/2) dz) takes almost a minute if the function is within a product of some constant parameters, which could be pulled out very easily automatically (for some reasons I want such trivial integrals to be integrated automatically). Look at the example below where I ask Mma to perform just the above Integral, which takes 51 Seconds, then I introduce a function FastInt that pulls out the constants first and then starts integrating - this takes only 0.07 Seconds!! Crazy - isn't it? I think Mma should do such simple transformation on its own, or at least supply a function like FastInt (perhaps a bit smarter than this) performing these transformations. I also found that the same behaviour slows down Solve substantially, when there are too many Symbols (constants) involved. Mathematica 2.1 for SPARC Copyright 1988-92 Wolfram Research, Inc. -- OPEN LOOK graphics initialized -- -- Laserprinter -Psp(arc) installed. Use PSPrint[ -Graphics- ] -- In[1]:= ff:=(-(1.2154068053283*10^-14)*2^(7/8)*c^(7/4)*cm^(3/4)*Mdot^(7/4)*qm^(7/8)* q0^(7/8)*Second*xi^(7/4)*Csc[phi]^(3/2))/ (D^2*g^(3/4)*Lambda*nu^(1/2)*(1 + xi)^(7/8)*z^(1/2)*Csc[alpha]^(3/2)) In[2]:= Timing[Integrate[ff,z]] -14 7/8 7/4 3/4 7/4 7/8 7/8 Out[2]= {51.7167 Second, (-2.43081 10 2 c cm Mdot qm q0 7/4 3/2 > Second xi Sqrt[z] Csc[phi] ) / 2 3/4 7/8 3/2 > (D g Lambda Sqrt[nu] (1 + xi) Csc[alpha] )} In[3]:= FastInt[f_,z_Symbol]:=((Int[f,z] //. Int[$a_ $f_,$z_]:>$a Int[$f,$z] /; D[$a,$z]==0) /. Int->Integrate) In[4]:= Timing[FastInt[ff,z]] -14 7/8 7/4 3/4 7/4 7/8 Out[4]= {0.0666667 Second, (-2.43081 10 2 c cm Mdot qm 7/8 7/4 3/2 > q0 Second xi Sqrt[z] Csc[phi] ) / 2 3/4 7/8 3/2 > (D g Lambda Sqrt[nu] (1 + xi) Csc[alpha] )} Heino ``` (o o) --------------oOO--(_)--OOo------------------------------------------------ ___ ___ _____ ___ _____ |Heino Falcke /__/\ /__/| /____/\ /__/| /____/\ |Max-Planck-Institut f. Radioastronomie | \ \ /| || | o \/ | || | o \/ |Auf dem Huegel 69 | |\ \//| || | __/ | ||f| __/ |D-W5300 Bonn, Germany | ||\_/ | || | || | || | |\ \ |E-mail: HFALCKE at mpifr-bonn.mpg.de |__|/ |__|/ |__|/ |__|/ |__|/\_||Fax: 49/(0)228/525-229 |Tel.: 49/(0)228/525-285 ----------------------------------------------------------------------------