Re: calculations in findRoot
- To: mathgroup at smc.vnet.net
- Subject: [mg100166] Re: calculations in findRoot
- From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
- Date: Wed, 27 May 2009 04:05:20 -0400 (EDT)
- References: <gv7qv0$ar1$1@smc.vnet.net>
Could you repost this without the strange characters? It's unreadable as it is. Try to copy first to Notepad or so if you can't get rid of the codes by formatting it as InputForm or so. Cheers -- Sjoerd On May 23, 5:36 am, hesami.... at gmail.com wrote: > Hello, > In my program(with mathematica 5), I want to determine rB=R(peak),rV== R > (valley); > r1[l],r2[l] if vV[l]=EF=82=A3EE=EF=82=A3vB[l]. > question: > in option FindRoot[D[vt[l,r],r]==0,{r,r0}] How I choose r0 until for > each "l" solution rB=R(peak),rV=R(valley),r1[l],r2[l] be correct? > Pleas guide me. > Thanks. > > my program: > > vt[l_, r_] := v0/\((1 + Exp[\(( > r - R0)\)/a0])\) + 1.439*\ z1\ z2\ /r\ + \ \((\((197.327)\)^2\= \ l > \ \(( > l + 1)\))\)/\((2\ m\ r\^2)\)\) > > R0=8.9436;a0=0.626;v0=-81.9;z1=8;z2=62;EE=50;l=61;m=13496= .77059;hc=197.327; > > rB[l_]:=FindRoot[D[vt[l,r],r]==0,{r,10}] > > vB[l_]:=vt[l,r]/.{r\[Rule]rB[l][[1,2]]} > > rV[l_]:=FindRoot[D[vt[l,r],r]==0,{r,8}] > > vV[l_]:=vt[l,r]/.{r\[Rule]rV[l][[1,2]]} > > r1[l_]:=If[vV[l] > =E2=89=A4EE=E2=89=A4vB[l],FindRoot[vt[l,r]-EE==0,{r,r= V[l][[1,2]],rB[l][[1,2]]}]] > > r2[l_]:=If[vV[l]=E2=89=A4EE=E2=89=A4vB[l],FindRoot[vt[l,r]-= EE==0,{r,rB[l][[1,2]],14}]] > > h=CE=A9[l_]:=Sqrt[Abs[((hc)^2/m)*D[vt[l,r],{r,2}]]]%/.r\[Rule]rB[l]= [[1,2]]; > > \!\(s[l_] := If[vV[ > l] =E2=89=A4 EE =E2=89=A4 vB[ > l], Sqrt[2*m/\((hc)\)^2]*\ > NIntegrate[\@\((\(-EE\) + vt[l, r])\), {r, \(r1[l= ]\)[\ > ([1, > 2]\)], \(r2[l]\)[\([1, 2]\)]}]] // Chop\) > > t[l_]:=Which[vB[l]=E2=89=A4EE,1/(1+Exp[(2 =CF=80 (vB[l]- > EE)/h=CE=A9[l])]),vV[l]=E2=89=A4EE=E2=89=A4vB= [l],1/(1+Exp[2 s[l]]),EE=E2=89=A4vV[l],0]//Chop > > =CF=83[l_,EE_]:==CF=80*(hc)^2*(2 l+1)*t[l]/(2*m*EE) > > =CF=83[EE_]:=10 (=CF=83[0, > EE]+=CF=83[1,EE]+=CF=83[2,EE]+=CF=83[3,EE]+=CF=83[4,E= E]+=CF=83[5,EE]+=CF=83[6,EE]+=CF=83[7,EE]+=CF=83[8,EE]+=C= F=83 > [9, > EE]+=CF=83[10,EE]+=CF=83[11,EE]+=CF=83[12,EE]= +=CF=83[13,EE]+=CF=83[14,EE]+=CF=83[15,EE]+=CF=83 > [16, > EE]+=CF=83[17,EE]+=CF=83[18,EE]+=CF=83[19,EE]= +=CF=83[20,EE]+=CF=83[21,EE]+=CF=83[22,EE]+=CF=83 > [23,EE]+=CF=83[ > 24,EE]+=CF=83[25,EE]+=CF=83[26,EE]+=CF=83[27,= EE]+=CF=83[28,EE]+=CF=83[29,EE]+=CF=83[ > 30,EE]+=CF=83[31,EE]+=CF=83[32,EE]+=CF=83[33,= EE]+=CF=83[34,EE]+=CF=83[35,EE]+=CF=83[ > 36,EE]+=CF=83[37,EE]+=CF=83[38,EE]+=CF=83[39,= EE]+=CF=83[40,EE]+=CF=83[41,EE]+=CF=83[ > 42,EE]+=CF=83[43,EE]+=CF=83[44,EE]+=CF=83[45,= EE]+=CF=83[46,EE]+=CF=83[47,EE]+=CF=83[ > 48,EE]+=CF=83[49,EE]+=CF=83[50,EE]+=CF=83[51,= EE]+=CF=83[52,EE]+=CF=83[53,EE]+=CF=83[ > 54,EE]+=CF=83[55,EE]+=CF=83[56,EE]+=CF=83[57,= EE]+=CF=83[58,EE]+=CF=83[59,EE]) > > {EE,=CF=83[EE]} > > ({50, 6.025565489081184`*10^-8}\) > > but soultion below is corect.", > > {50, 6.521257897`*10^-8}