loop problem?
- To: mathgroup at smc.vnet.net
- Subject: [mg33035] loop problem?
- From: Takayuki MAKINO <tmakino at spectro.ujf-grenoble.fr>
- Date: Wed, 27 Feb 2002 00:47:49 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Hello, everybody, Thanks everyone who response my previous question. A new problem was happened. I have executed the nb file below cited. But, I received the following message from the mathematica. This is as follows: ""Mathematica has detected a possible internal error. If possible, report the error to support at wolfram.com, quoting "Assertion 'nboxesToSend == 1' failed at matheditio.c:1508", and describe in as much detail as possible what you were doing when the error occurred."" Here I would like to cite my nb file, but it is not exactly the same one that I encountered that message. This is because the original nb file is too lengthy. I apologize that this might be a long letter. I am very happy if someone test the nb file again and let me know about the results.... I think that it must be better to be done before sending a bug report to wolfram. Maybe. Thanks in advance, au revoir. takayuki ---------------------------------------------------------- Notebook[{ Cell[BoxData[{ RowBox[{\(Clear[theMax, theMin]\), ";", StyleBox[\(Clear[K, c, \ h, je, \ me, \ et1, \ elt1, ei, \ mex1, mim1, hbar, omt1, \ omlt1, damp1]\), FontSize->9], StyleBox[";", FontSize->9], StyleBox[\(Clear[et2, \ elt2, \ mex2, mim2, omt2, \ omlt2, damp2]\), FontSize->9], StyleBox[";", FontSize->9], StyleBox[\(Clear[chisqlist, \ resid, \ chisq]\), FontSize->9], StyleBox[";", FontSize->9], StyleBox[\(Clear[Vminloc]\), FontSize->9], StyleBox[";", FontSize->9]}], "\[IndentingNewLine]", StyleBox[ RowBox[{ RowBox[{\(Clear[\[Alpha]Blist, \ \[Alpha]Alist, \ \[Omega]Blist, \ \ \[Omega]Alist, \ \[Gamma]Blist, \ \[Gamma]Alist, Wcoef, expMax, expMin]\), ";", RowBox[{"(*", " ", RowBox[{ RowBox[{"Clear", "[", RowBox[{"theMax", ",", "theMin", ",", FormBox["NewVar1", "InputForm"], ",", FormBox[ RowBox[{"NewVar2", ",", FormBox[ RowBox[{"NewVar3", ",", FormBox["NewVar4", "InputForm"]}], "InputForm"]}], "InputForm"]}], "]"}], ";"}], "*)"}], \(chisqlist = {}\), ";", \(\[Alpha]Blist = {}\), ";", " ", \(\[Alpha]Alist = {}\), ";", " ", \(\[Omega]Blist = {}\), ";", " ", \(\[Omega]Alist = {}\), ";", " ", \(\[Gamma]Blist = {}\), ";", " ", \(\[Gamma]Alist = {}\), ";"}], "\[IndentingNewLine]"}], FontSize->9], "\[IndentingNewLine]", StyleBox[\(c\ = \ 2.998*10^8; \ h = \ 1.055*10^\(-34\);\), FontSize->9], "\n", StyleBox[\(je\ = \ 1.602*10^\(-19\); \ me = 9.109*10^\(-31\); ei = 8.1; mex1 = 1.230*me; mim1 = mex1\ c^2\ /\ je; hbar\ = \ h/\ je; mex2 = 1.230*me; mim2 = mex2\ c^2\ /\ je;\), FontSize->9], "\[IndentingNewLine]", RowBox[{ StyleBox[\(A\[Chi]\[Mu]i\[Nu] = 3.3784\), FontSize->9], StyleBox[";", FontSize->9], StyleBox[\(A\[Chi]\[Mu]a\[Chi] = 3.3728\), FontSize->9], StyleBox[";", FontSize->9], StyleBox[\(B\[Chi]\[Mu]i\[Nu] = 3.3937\), FontSize->9], StyleBox[";", FontSize->9], StyleBox[" ", FontSize->9], \(expMin = 2511.5\), ";", " ", \(expMax = 10334\), ";", \(\[Alpha]ASet = {1.6*10\^\(-3\), 4.6*10\^\(-3\), 3*10\^\(-3\)}\), ";", \(\[Alpha]BSet = {9.6*10\^\(-3\), 12.6*10\^\(-3\), 3*10\^\(-3\)}\), ";", \(\[Gamma]ASet = {1.5*10\^\(-3\), 2.7*10\^\(-3\), 1.2*10\^\(-3\)}\), ";"}], "\[IndentingNewLine]", \(\[Gamma]BSet = {2.2*10\^\(-3\), 2.8*10\^\(-3\), 0.6*10\^\(-3\)};\), "\[IndentingNewLine]", StyleBox[\(Wcoef = {4578.7, 4500.6, 3.368, 0.020086, \(-2126.5\), 3.3721, \(-0.0026009\), 3408, 3.3724, 0.0029873, \(-5752.3\), 3.3787, 0.0031906, 4721.3, 3.3795, 0.0041165, \(-2384.7\), 3.3923, 0.0054822, \(-972.52\), 3.3986, 0.0087828};\), FontSize->9], "\n", StyleBox[\(ExpFn[ enr_] := \((Wcoef[\([1]\)] + Wcoef[\([2]\)]* Exp[\(-\((\(enr - \ Wcoef[\([3]\)]\)\/Wcoef[\([4]\)]\()\^2\)\)\)] + Wcoef[\([5]\)]* Exp[\(-\((\(enr - \ Wcoef[\([6]\)]\)\/Wcoef[\([7]\)]\()\^2\)\)\)] + Wcoef[\([8]\)]* Exp[\(-\((\(enr - Wcoef[\([9]\)]\)\/Wcoef[\([10]\)]\()\^2\)\)\ \)] + Wcoef[\([11]\)]* Exp[\(-\((\(enr - \ Wcoef[\([12]\)]\)\/Wcoef[\([13]\)]\()\^2\)\)\)] + Wcoef[\([14]\)]* Exp[\(-\((\(enr - \ Wcoef[\([15]\)]\)\/Wcoef[\([16]\)]\()\^2\)\)\)] + Wcoef[\([17]\)]* Exp[\(-\((\(enr - \ Wcoef[\([18]\)]\)\/Wcoef[\([19]\)]\()\^2\)\)\)] + Wcoef[\([20]\)]* Exp[\(-\((\(enr - \ Wcoef[\([21]\)]\)\/Wcoef[\([22]\)]\()\^2\)\)\)])\);\), FontSize->9], "\[IndentingNewLine]", RowBox[{\(formulae[omlt_, omt_, damp_]\ := \ N[\((c*hbar/enr)\)^2*K\ - \ ei\ *\ \((1 + omlt/\((omt + \((h*\(K/2\)/mex1)\) - \((enr/hbar)\) - I\ damp*0.5/hbar)\))\)];\), "\n"}], "\[IndentingNewLine]", RowBox[{ " ", \(Do[\ \ \ \ \ \ \[IndentingNewLine]elt1 = \[Alpha]Ai; damp1 = \ \[Gamma]Ai; et1 = \ A\[Chi]\[Mu]i\[Nu] - elt1 - damp1/4; \ elt2 = \[Alpha]Bi; \ damp2 = \ \[Gamma]Bi; et2 = \ B\[Chi]\[Mu]i\[Nu] - elt2 - damp2/4; omt1 = \ et1/hbar\ ; \ omlt1 = \ elt1/hbar; omt2 = \ et2/hbar\ ; \ omlt2 = \ elt2/hbar; \[IndentingNewLine]\[IndentingNewLine]solution1\ = \ Solve[formulae[omlt1, omt1, damp1] == 0, \ K]; solution1\ = \ K\ /. solution1; solution1[\([1]\)]\ = N[solution1[\([1]\)]]; solution1[\([2]\)]\ = N[solution1[\([2]\)]]; siki7\ = solution1[\([1]\)]; siki8\ = solution1[\([2]\)]; \[Delta]cA1 = ei\ *\ \((1 + omlt1/\((omt1 + \((h*\(siki7/2\)/mex1)\) - \((enr/hbar)\) - I\ damp1*0.5/ hbar)\))\); \ \[IndentingNewLine]\[IndentingNewLine]\[Delta]cA1 = Evaluate[N[\[Delta]cA1]]; \[IndentingNewLine]\[Delta]fnA1[ enr_]\ := \ Evaluate[ N[\[Delta]cA1]]; \ \[IndentingNewLine]\[IndentingNewLine]\[Delta]cA2 = Expand[ei\ *\ \((1 + omlt1/\((omt1 + \((h*\(siki8/2\)/mex1)\) - \((enr/ hbar)\) - I\ damp1*0.5/hbar)\))\)]; \[Delta]cA2 = Evaluate[N[\[Delta]cA2]]; \[Delta]fnA2[enr_]\ := \ Evaluate[N[\[Delta]cA2]]; \[IndentingNewLine]neff1 = \ Evaluate[\((Sqrt[\[Delta]fnA1[enr]]*Sqrt[\[Delta]fnA2[enr]] + ei)\)*\((\((Sqrt[\[Delta]fnA1[enr]]\ + \ Sqrt[\[Delta]fnA2[enr]])\)^\(-1\))\)]; \ nefffn1[enr_]\ := \ Evaluate[N[Expand[neff1]]]; \n\[IndentingNewLine]solution2\ = \ Solve[formulae[omlt2, omt2, damp2] == 0, \ K]; solution2\ = \ K\ /. solution2; solution2[\([1]\)]\ = N[solution2[\([1]\)]]; solution2[\([2]\)]\ = N[solution2[\([2]\)]]; siki7\ = solution2[\([1]\)]; siki8\ = solution2[\([2]\)]; \[Delta]cB1 = Expand[ ei\ *\ \((1 + omlt2/\((omt2 + \((h*\(siki7/2\)/mex2)\) - \((enr/ hbar)\) - I\ damp2*0.5/ hbar)\))\)]; \[IndentingNewLine]\[Delta]cB2 = N[\[Delta]cB2]; \[Delta]fnB1[enr_]\ := \ Expand[\[Delta]cB1]; \[IndentingNewLine]\[Delta]cB2 = Expand[ei\ *\ \((1 + omlt2/\((omt2 + \((h*\(siki8/2\)/mex2)\) - \((enr/ hbar)\) - I\ damp2*0.5/hbar)\))\)]; \[Delta]cB2 = Expand[N[\[Delta]cB2]]; \[Delta]fnB2[enr_]\ := \ Expand[\[Delta]cB2]; neff2 = Evaluate[\((Sqrt[\[Delta]fnB1[enr]]* Sqrt[\[Delta]fnB2[enr]] + ei)\)*\((Sqrt[\[Delta]fnB1[enr]] + Sqrt[\[Delta]fnB2[enr]])\)^\(-1\)]; nefffn2[enr_] := N[Expand[ neff2]]; \ \[IndentingNewLine]\[IndentingNewLine]reflectivityfunc[enr_]\ := \ Evaluate[\((Abs[\((\((1 - N[nefffn1[enr]])\)*\((1 + N[nefffn1[ enr]])\)^\(-1\))\)])\)^2\ - \ \((Abs[\((\ \((1 - ei^0.5)\)*\((1 + ei^0.5)\)^\(-1\))\)])\)^2 + \ \((Abs[\((\((1 - nefffn2[enr])\)*\((1 + nefffn2[ enr])\)^\(-1\))\)])\)^2]; \ \[IndentingNewLine]\[IndentingNewLine]\ Plot[N[reflectivityfunc[enr2]], {enr2, 3.36, 3.41}]; \[IndentingNewLine]enr = A\[Chi]\[Mu]a\[Chi]; theMax = N[reflectivityfunc[enr]]; Clear[enr]; enr = B\[Chi]\[Mu]i\[Nu]; \[IndentingNewLine]theMin = N[reflectivityfunc[enr]]; Clear[enr]; NewVar1 = theMax - theMin; NewVar2 = expMax - expMin; NewVar3 = NewVar2/NewVar1; NewVar4 = expMin - theMin; \[IndentingNewLine]resid = NSum[\((NewVar3*N[reflectivityfunc[enr2]] + NewVar4 - ExpFn[enr2])\)^2, {enr2, 3.36, 3.41, 1*10\^\(-2\)}]; \[IndentingNewLine]\[IndentingNewLine]chisq = Apply[Plus, resid]; \[IndentingNewLine]\[Alpha]Blist\ = \ Append[\[Alpha]Blist, N[elt2]]; \ \[Alpha]Alist = \ Append[\[Alpha]Alist, N[elt1]]; \ \[Omega]Blist\ = Append[\[Omega]Blist, N[et2]]; \ \[Omega]Alist = Append[\[Omega]Alist, N[et1]]; \ \[Gamma]Blist = Append[\[Gamma]Blist, N[damp2]]; \[Gamma]Alist = Append[\[Gamma]Alist, N[damp1]]; \[IndentingNewLine]\(\(chisqlist = Append[chisqlist, chisq];\), {\[Alpha]Ai, \[Alpha]ASet[\([1]\)], \ \[Alpha]ASet[\([2]\)], \[Alpha]ASet[\([3]\)]}, {\[Alpha]Bi, \ \[Alpha]BSet[\([1]\)], \[Alpha]BSet[\([2]\)], \[Alpha]BSet[\([3]\)]}, {\ \[Gamma]Ai, \[Gamma]ASet[\([1]\)], \[Gamma]ASet[\([2]\)], \ \[Gamma]ASet[\([3]\)]}, {\[Gamma]Bi, \[Gamma]BSet[\([1]\)], \ \[Gamma]BSet[\([2]\)], \[Gamma]BSet[\([3]\)]}\)];\), " ", "\[IndentingNewLine]"}], "\[IndentingNewLine]", RowBox[{ " ", \(Plot[ NewVar3*N[reflectivityfunc[enr2]] + NewVar4, {enr2, 3.36, 3.41}]; Plot[N[ExpFn[enr2]], {enr2, 3.36, 3.41}];\)}]}], "Input", FontSize->14] }, FrontEndVersion->"4.0 for Microsoft Windows", ScreenRectangle->{{0, 1024}, {0, 689}}, WindowSize->{1016, 659}, WindowMargins->{{0, Automatic}, {Automatic, 0}}, PrintingCopies->1, PrintingPageRange->{Automatic, Automatic}, Magnification->1.25 ]