Re: Help with plotting and iterations
- To: mathgroup at smc.vnet.net
- Subject: [mg72837] Re: Help with plotting and iterations
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Sun, 21 Jan 2007 06:38:23 -0500 (EST)
- Organization: The Open University, Milton Keynes, UK
- References: <eoshbr$9er$1@smc.vnet.net>
ashesh wrote: > Hello All, > > Need help in working with Mathematica to determine (result_aa, > result_bb) values over a range of variable "p". > > p = 0.01; > > a = 0.5; b = 0.25; h = 0.25; > m = b/a; > m1 = Sqrt[1-m m]; > z = (p-i h)/b; (z is complex and (i h) represents imaginary part) ---------^ Sqrt[-1] is capital i (I) in Mathematica syntax > t = ArcSin[z]; > t1 = Re[t]; > t2 = -Im[t]; > b1 = Cot[t1]^2 + m^2*Sinh[t2]-m1; > c = m1^2*Cot[t1]^2; > Solve[x^2 - b1*x - c,x]; ----------------------^ The expression is incomplete: an equal sign, followed by a quantity. > x = x/. % > x = Last[x]; {i need the positive root from the two} > aa = ArcCot[Sqrt[x]]; > bb = Arctan[Sqrt[x/m1]]; > Faa = EllipticF[aa,m]; > Fbb = EllipticF[bb,m1]; > > result_aa(count) = Faa; > result_bb(count) = Fbb; > count = count+1 > > I would like to determine the values of Faa and Fbb over a range of p = > 0.01 to 10 with increments of 0.01 till 1.0 and then an increment of 1, > that is [0.01:0.01:1 2:1:10] > > Finally, I would like to plot with result_aa along x-axis and result_bb > along y-axis. > > Hope some one can solve the above problem. > > Ashesh > Hi Ashesh, A quick and dirty approach could be the following In[1]:= resAA[a_, b_, h_][start_, end_, inc_] := Module[{m = b/a, m1}, m1 = Sqrt[1 - m*m]; Table[EllipticF[ArcCot[ Sqrt[Last[x /. Solve[ x^2 - (Cot[Re[ArcSin[(p - I*h)/b]]]^2 + m^2* Sinh[-Im[ArcSin[(p - I*h)/b]]] - m1)*x - m1^2*Cot[Re[ArcSin[(p - I*h)/b]]]^2 == 0, x]]]], m], {p, start, end, inc}]] resBB[a_, b_, h_][start_, end_, inc_] := Module[{m = b/a, m1}, m1 = Sqrt[1 - m*m]; Table[EllipticF[ArcCot[(1/m1)* Sqrt[Last[x /. Solve[ x^2 - (Cot[Re[ArcSin[(p - I*h)/b]]]^2 + m^2*Sinh[-Im[ArcSin[(p - I*h)/b]]] - m1)* x - m1^2*Cot[Re[ArcSin[(p - I*h)/b]]]^2 == 0, x]]]], m1], {p, start, end, inc}]] resAA[0.5, 0.25, 0.25][0.01, 1, 1/100] resAA[0.5, 0.25, 0.25][2, 10, 1] resBB[0.5, 0.25, 0.25][0.01, 1, 1/100] resBB[0.5, 0.25, 0.25][2, 10, 1] ListPlot[Transpose[{Join[resAA[0.5, 0.25, 0.25][0.01, 1, 1/100], resAA[0.5, 0.25, 0.25][2, 10, 1]], Join[resBB[0.5, 0.25, 0.25][0.01, 1, 1/100], resBB[0.5, 0.25, 0.25][2, 10, 1]]}]]; Out[3]= {0.0282828,0.0565564,0.0848114,0.113038,0.141226,0.169363,0.197438,0.225436,0.\ 253343,0.281141,0.308811,0.336334,0.363688,0.390847,0.417787,0.44448,0.470897,\ 0.497007,0.52278,0.548184,0.573186,0.597756,0.621862,0.645475,0.668567,0.\ 691112,0.713088,0.734473,0.755252,0.77541,0.794938,0.813827,0.832075,0.84968,\ 0.866646,0.882977,0.898681,0.913767,0.928246,0.942131,0.955437,0.968176,0.\ 980366,0.992021,1.00316,1.01379,1.02394,1.03362,1.04285,1.05163,1.05999,1.\ 06794,1.07549,1.08266,1.08946,1.0959,1.10199,1.10774,1.11316,1.11827,1.12308,\ 1.12758,1.13179,1.13572,1.13937,1.14276,1.14588,1.14875,1.15136,1.15373,1.\ 15587,1.15777,1.15943,1.16088,1.1621,1.1631,1.1639,1.16448,1.16486,1.16504,1.\ 16501,1.1648,1.16439,1.1638,1.16302,1.16206,1.16093,1.15962,1.15815,1.15651,1.\ 15471,1.15276,1.15065,1.1484,1.146,1.14347,1.1408,1.13801,1.13509,1.13206} Out[4]= {0.783389,0.617285,0.525222,0.464934,0.421559,0.38843,0.36206,0.340423,0.\ 322255} Out[5]= {0.0244957,0.0489962,0.0735061,0.0980294,0.12257,0.14713,0.171711,0.196312,0.\ 220934,0.245572,0.270222,0.294876,0.319525,0.344156,0.368756,0.393308,0.\ 417792,0.442186,0.466466,0.490607,0.51458,0.538355,0.561903,0.585192,0.608191,\ 0.630869,0.653197,0.675145,0.696686,0.717796,0.738453,0.758635,0.778326,0.\ 797512,0.81618,0.834322,0.85193,0.869002,0.885534,0.901528,0.916984,0.931907,\ 0.946301,0.960172,0.973528,0.986375,0.998722,1.01058,1.02195,1.03285,1.04329,\ 1.05327,1.0628,1.0719,1.08058,1.08883,1.09668,1.10412,1.11117,1.11784,1.12412,\ 1.13004,1.1356,1.14079,1.14564,1.15014,1.1543,1.15814,1.16164,1.16483,1.16769,\ 1.17025,1.1725,1.17445,1.1761,1.17746,1.17853,1.17932,1.17984,1.18008,1.18005,\ 1.17975,1.1792,1.1784,1.17735,1.17605,1.17452,1.17276,1.17077,1.16856,1.16614,\ 1.16351,1.16069,1.15767,1.15447,1.15109,1.14754,1.14383,1.13996,1.13595} Out[6]= {0.726211,0.557415,0.468778,0.412248,0.372214,0.341958,0.318053,0.298551,0.\ 282246} <... graphics deleted ...> HTH, Jean-Marc