Re: Weird NMinimize behaviour
- To: mathgroup at smc.vnet.net
- Subject: [mg97556] Re: [mg97518] Weird NMinimize behaviour
- From: Filippo Miatto <miatto at gmail.com>
- Date: Sun, 15 Mar 2009 05:27:53 -0500 (EST)
- References: <200903142313.SAA25117@smc.vnet.net> <op.uqs5f8y1tgfoz2@bobbys-imac.local>
woops sorry i didn't see that! F2[n1_,k1_,n2_,k2_]:=(-1)^(n1+k1+n2+k2)/(360 \[Pi]^4) (8 \[Pi]^4-60 \ [Pi]^2 Mod[-Subscript[z, k1]+Subscript[z, n1]-Subscript[z, k2]+Subscript[z, n2],2 \[Pi]]^2+60 \[Pi] Mod[-Subscript[z, k1]+Subscript[z, n1]-Subscript[z, k2]+Subscript[z, n2],2 \[Pi]]^3-15 Mod[-Subscript[z, k1]+Subscript[z, n1]-Subscript[z, k2]+Subscript[z, n2],2 \[Pi]]^4) R2[s_]:=(1-1/\[Pi] Sum[(-1)^(n1+1) Subscript[z, n1],{n1,1,2s-1}])^4 j[s_]:=Sum[F2[n1,k1,n2,k2],{n1,0,2s-1},{k1,0,2s-1},{n2,0,2s-1}, {k2,0,2s-1}]+R2[s] there is also the condition Subscript[z, 0]=0 For example if I try: NMaximize[{1/j[4],0<Subscript[z, 1]<Subscript[z, 2]<Subscript[z, 3]<Subscript[z, 4]<Subscript[z, 5]<Subscript[z, 6]<Subscript[z, 7]<2\ [Pi]},{Subscript[z, 1],Subscript[z, 2],Subscript[z, 3],Subscript[z, 4],Subscript[z, 5],Subscript[z, 6],Subscript[z, 7]}] I get a result of 23.517 on the mac and a result <23 on windows, although everything is the same. Now i don't know if the result of my mac is correct (since the one of windows isn't, and actually the values should be linear with respect to s, and 23.517 is a little too low) and i'm sure i can't rely on the win machine to go up and maximize 1/j[s] for high values of s. if i could understand the reason of this discrepancy i could possibly fix things, either in the form of the equations or in the parameters of NMaximize (or NMinimize). Thank you Filippo On Mar 15, 2009, at 1:39 AM, DrMajorBob wrote: > =CF=80 > > ??? > > Post readable code. Use Edit>Copy As>Plain Text and paste into e-mail. > > Bobby > > On Sat, 14 Mar 2009 18:13:15 -0500, Filippo Miatto > <miatto at gmail.com> wrote: > >> Dear all, >> i'm working in the quantum optics group of the university of Leiden, >> and i use mathematica 7 a lot. >> we have both windows machines and macs. On a mac i was trying to >> minimize the function >> >> j[s_] := Sum[F2[n1, k1, n2, k2], {n1, 0, 2 s - 1}, {k1, 0, 2 s - 1}, >> {n2, 0,2s - 1}, {k2, 0, 2s - 1}] + R2[s] >> >> Where >> R2[s_] := (1 - 1/=CF=80 Sum[(-1)^(n1 + 1) Subscript[z, n1], {n1, 1, >> 2 s - >> 1}])^4 >> >> and >> F2[n1_, k1_, n2_, k2_] := (-1)^(n1 + k1 + n2 + k2)/(360 =CF=80^4) >> (8 =CF=80^4 - >> 60 =CF=80^2 Mod[-Subscript[z, k1] + Subscript[z, n1] - Subscript[z, >> k2] + >> Subscript[z, n2], 2 =CF=80]^2 + 60 =CF=80 Mod[-Subscript[z, k1] + >> Subscript[z, >> n1] - Subscript[z, k2] + Subscript[z, n2], 2 =CF=80]^3 -15 Mod[- >> Subscript[z, k1] + Subscript[z, n1] - Subscript[z, k2] + >> Subscript[z, >> n2], 2 =CF=80]^4) >> >> (sorry for the mess, on the screen the subscripts simply appear as >> subscripts...) >> >> and i get certain results for s=1,2,3,4,5,etc.. >> on the windows machine though, i get worse results! the version of >> mathematica is the same, machineprecision value is the same, even >> the .nb file is the same! (the processor is different: a dualcore2duo >> on the mac and a quad core xeon on the windows machine) >> The mac can work well until s=6, the windows machine can go on to >> greater values, but still giving less good results. >> Do you have any idea how i can solve this issue? >> Thank you in advance! >> Filippo= >> > > > > -- > DrMajorBob at bigfoot.com
- References:
- Weird NMinimize behaviour
- From: Filippo Miatto <miatto@gmail.com>
- Weird NMinimize behaviour