Re: why it takes forever to evaluate this integration
- To: mathgroup at smc.vnet.net
- Subject: [mg78984] Re: why it takes forever to evaluate this integration
- From: Peter Pein <petsie at dordos.net>
- Date: Sat, 14 Jul 2007 02:46:37 -0400 (EDT)
- References: <f77kal$d7q$1@smc.vnet.net>
Michael Chen schrieb: > Dear there, > > [version 6.0] > > I did the integration by hand and the result is piecewise function in > (x1,x2). It is doable, though tedious. I expect Mathematica can do it much > fast, however it takes 5 hours without result yet. Maybe there are better > ways to do it in Mathematica? > > Simplify[ > Integrate[h1-x1 Boole[h1-x1>0 && h2-x2>0 && h1-x1>h2-x2], {h1,B1,U1}, > {h2,B2,U2}, Assumptions->B1<U1 && B2<U2] > ] > > Thanks a lot. > Hi Michael, I do not know if the package "Piecewise" at http://library.wolfram.com/infocenter/MathSource/5117/ works with version 6, but it should be worth a try. Look at the remark at the section "Implementation" to read, how to install it. In[1]:= << "Piecewise`" In[2]:= i0 = PiecewiseExpand[h1 - x1*Boole[h1 - x1 > 0 && h2 - x2 > 0 && h1 - x1 > h2 - x2]] Out[2]= Piecewise[ {{h1, h1 - x1 <= 0 || h2 - x2 <= 0 || h1 - h2 - x1 + x2 <= 0}}, h1 - x1 ] In[3]:= PiecewiseIntegrate[i0,{h1,B1,U1},{h2,B2,U2}, Assumptions->B1<U1&&B2<U2]//Timing Out[3]= {1571.89 Second, (* output omitted (see In/Out[4]) *) In[4]:= LeafCount[%] Out[4]= 52030 To estimate haow long this would need to execute on your computer, here are some stats: In[5]:= $Version Run["cat /proc/cpuinfo > tmp.txt"]; !!"tmp.txt" DeleteFile["tmp.txt"]; Out[5]= "5.2 for Linux x86 (64 bit) (June 20, 2005)" >From In[5]:= processor : 0 vendor_id : AuthenticAMD cpu family : 15 model : 12 model name : AMD Athlon(tm) 64 Processor 3000+ stepping : 0 cpu MHz : 2151.960 cache size : 512 KB fpu : yes fpu_exception : yes cpuid level : 1 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx mmxext lm 3dnowext 3dnow up bogomips : 4313.45 TLB size : 1024 4K pages clflush size : 64 cache_alignment : 64 address sizes : 40 bits physical, 48 bits virtual power management: ts fid vid ttp Regards, Peter P.S.: you can find the notebook with the huge expression at http://freenet-homepage.de/Peter_Berlin/Mathe/pwIntegrate.nb