MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

Bug: Mathematica multipies statements together

  • To: mathgroup at smc.vnet.net
  • Subject: [mg25430] Bug: Mathematica multipies statements together
  • From: "Carl K. Woll" <carlw at u.washington.edu>
  • Date: Fri, 29 Sep 2000 01:07:47 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Dear mathgroup,

I've been having trouble with the following bug. Occasionally, and for no
reason that I can discern, mathematica multiplies statements together. At the
end of this message, I have included a short Mathematica notebook which
demonstrates this behavior. This error occurs with Mathematica running on both
the WindowsNT and Linux oeprating systems.

Can anyone else duplicate this problem, and suggest a workaround. I have sent
in a bug report to Wolfram also, and I will forward what they suggest.

The problem can be eliminated by inserting and deleting various carriage returns.

Thanks,

Carl Woll

(***********************************************************************

                    Mathematica-Compatible Notebook

This notebook can be used on any computer system with Mathematica 4.0,
MathReader 4.0, or any compatible application. The data for the notebook
starts with the line containing stars above.

To get the notebook into a Mathematica-compatible application, do one of
the following:

* Save the data starting with the line of stars above into a file
  with a name ending in .nb, then open the file inside the application;

* Copy the data starting with the line of stars above to the
  clipboard, then use the Paste menu command inside the application.

Data for notebooks contains only printable 7-bit ASCII and can be
sent directly in email or through ftp in text mode.  Newlines can be
CR, LF or CRLF (Unix, Macintosh or MS-DOS style).

NOTE: If you modify the data for this notebook not in a Mathematica-
compatible application, you must delete the line below containing the
word CacheID, otherwise Mathematica-compatible applications may try to
use invalid cache data.

For more information on notebooks and Mathematica-compatible
applications, contact Wolfram Research:
  web: http://www.wolfram.com
  email: info at wolfram.com
  phone: +1-217-398-0700 (U.S.)

Notebook reader applications are available free of charge from
Wolfram Research.
***********************************************************************)

(*CacheID: 232*)


(*NotebookFileLineBreakTest
NotebookFileLineBreakTest*)
(*NotebookOptionsPosition[      8143,        179]*)
(*NotebookOutlinePosition[      8848,        204]*)
(*  CellTagsIndexPosition[      8804,        200]*)
(*WindowFrame->Normal*)



Notebook[{
Cell[BoxData[{
    RowBox[{\(ClearAll[linesearch];\),
      "\[IndentingNewLine]"}], "\[IndentingNewLine]",
    RowBox[{\(linesearch[x0 : {__?NumericQ}, \[Delta]x : {__?NumericQ},
        g0_?NumericQ, f_]\), ":==", "\[IndentingNewLine]",
      RowBox[{"Module", "[",
        RowBox[{\({\[Alpha] == 10\^\(-4\), \[Lambda]1 == 1, \[Lambda]2, g1, g2,
            dg0, a, b, err}\), ",", "\[IndentingNewLine]",
          RowBox[{\(dg0 == \(-2\) g0\), ";", "\[IndentingNewLine]",
            RowBox[{"While", "[", "\[IndentingNewLine]",
             
              RowBox[{\(\(err ==
                    f @@ \((x0 + \[Lambda]1\ \[Delta]x)\);\)\
\[IndentingNewLine]
                \(g1 == err . err\/2;\)\[IndentingNewLine]
                \(If[newtondebug,
                    Print[{g1, g0, \[Lambda]1, dg0}]];\)\[IndentingNewLine]
                g1 > g0 + \[Alpha]\ \[Lambda]1\ dg0\), ",",
                "\[IndentingNewLine]",
                RowBox[{
                  RowBox[{"If", "[",
                   
                    RowBox[{\(\[Lambda]1 \[Equal] 1\), ",",
                      "\[IndentingNewLine]", \(\(\[Lambda]2 ==
                          1;\)\[IndentingNewLine]
                      \[Lambda]1 == \(-\(dg0\/\(2 \((g1 - g0 - dg0)\)\)\)\)
\),
                      ",", "\[IndentingNewLine]",
                      RowBox[{
                        RowBox[{\({a, b}\), "==",
                          RowBox[{\(1\/\(\[Lambda]1 - \[Lambda]2\)\),
                            RowBox[{
                              RowBox[{"(", GridBox[{
                                    {\(1\/\[Lambda]1\^2\), \(-\(1\/\[Lambda
]2\
\^2\)\)},
                                    {\(-\(\[Lambda]2\/\[Lambda]1\^2\)\), \(
\
\[Lambda]1\/\[Lambda]2\^2\)}
                                    }], ")"}], ".",
                              RowBox[{"(", GridBox[{
                                    {\(g1 - dg0\ \[Lambda]1 - g0\)},
                                    {\(g2 - dg0\ \[Lambda]2 - g0\)}
                                    }], ")"}]}]}]}], ";",
                        "\[IndentingNewLine]", \(\[Lambda]2 == \[Lambda]1\)
,
                        ";", "\[IndentingNewLine]", \(If[
                          a \[Equal]
                            0, \[IndentingNewLine]\[Lambda]1 == \(-\(dg0\/\
(2 
                                    b\)\)\), \[IndentingNewLine]\[Lambda]1 
== \
\(\(-b\) + \ at \(b\^2 - 3  a\ dg0\)\)\/\(3  a\)\[IndentingNewLine]]\), ";"}]}
],
                    "\[IndentingNewLine]", "]"}], ";",
                  "\[IndentingNewLine]", \(\[Lambda]1 == \
                    Max[Min[\[Lambda]1, \[Lambda]2/2], \[Lambda]2/10]\), ";
",
                  "\[IndentingNewLine]", \(g2 == g1\), ";"}]}],
              "\[IndentingNewLine]", "]"}], ";",
            "\[IndentingNewLine]", \({x0 + \[Lambda]1\ \[Delta]x, err}\)}]}
],
        "\[IndentingNewLine]", "]"}]}]}], "Input"],

Cell[CellGroupData[{

Cell[BoxData[
    \(?? linesearch\)], "Input"],

Cell[BoxData[
    \(TraditionalForm\`"Global`linesearch"\)], "Print"],

Cell[BoxData[
    FormBox[
      InterpretationBox[GridBox[{
            {GridBox[{
                  {
                   
                    RowBox[{\(linesearch(
                        x0 : {__?NumericQ}, \[Delta]x : {__?NumericQ},
                        g0_?NumericQ, f_)\), ":==",
                      RowBox[{"Module", "[",
                       
                        RowBox[{\({\[Alpha] == 1\/10\^4, \[Lambda]1 ==
                              1, \[Lambda]2, g1, g2, dg0, a, b, err}\), ","
,
                          RowBox[{\(dg0 == \(-2\)\ g0\), ";",
                            RowBox[{"While", "[",
                             
                              RowBox[{\(\((err ==
                                      f @@ \((x0 + \[Delta]x\ \[Lambda]1)\)
; \
)\)\ \((g1 == err . err\/2; )\)\ \((If[newtondebug,
                                      Print[{g1, g0, \[Lambda]1,
                                        dg0}]]; )\)\ \((g1 >
                                      g0 + dg0\ \[Alpha]\ \[Lambda]1)\)\),

                                ",",
                                RowBox[{
                                  RowBox[{"If", "[",
                                   
                                    RowBox[{\(\[Lambda]1 ==== 1\),
                                      ",", \(\((\[Lambda]2 ==
                                        1; )\)\ \((\[Lambda]1 == \(-\(dg0\/
\(2\
\ \((\(-dg0\) - g0 + g1)\)\)\)\))\)\), ",",
                                      RowBox[{
                                        RowBox[{\({a, b}\), "==",
                                        FractionBox[
                                        RowBox[{
                                        RowBox[{"(", "\[NoBreak]", GridBox[
{
                                        {\(1\/\[Lambda]1\^2\), \(-\(1\/\
\[Lambda]2\^2\)\)},
                                        {\(-\(\[Lambda]2\/\[Lambda]1\^2\)\)
, \
\(\[Lambda]1\/\[Lambda]2\^2\)}
                                        }], "\[NoBreak]", ")"}], ".",
                                        RowBox[{"(", "\[NoBreak]", GridBox[
{
                                        {\(\(-g0\) + g1 - dg0\ \[Lambda]1\)
},
                                        {\(\(-g0\) + g2 - dg0\ \[Lambda]2\)
}
                                        }], "\[NoBreak]",
                                        ")"}]}], \(\[Lambda]1 - \
\[Lambda]2\)]}], ";", \(\[Lambda]2 == \[Lambda]1\),
                                        ";", \(If[
                                        a ====
                                        0, \[Lambda]1 == \(-\(dg0\/\(2\ \
b\)\)\), \[Lambda]1 == \(\ at \(b\^2 - 3\ a\ dg0\) - b\)\/\(3\ a\)]\), ";"}]}]
,
                                    "]"}],
                                  ";", \(\[Lambda]1 ==
                                    Max(Min(\[Lambda]1, \[Lambda]2\/2), \
\[Lambda]2\/10)\), ";", \(g2 == g1\), ";"}]}], "]"}],
                            ";", \({x0 + \[Delta]x\ \[Lambda]1, err}\)}]}],

                        "]"}]}]}
                  },
                GridBaseline->{Baseline, {1, 1}},
                ColumnWidths->0.999,
                ColumnAlignments->{Left}]}
            },
          GridBaseline->{Baseline, {1, 1}},
          ColumnAlignments->{Left}],
        Definition[ linesearch],
        Editable->False], TraditionalForm]], "Print"]
}, Open  ]]
},
FrontEndVersion->"4.0 for Microsoft Windows",
ScreenRectangle->{{0, 1024}, {0, 695}},
AutoGeneratedPackage->None,
Evaluator->"Local 2",
WindowSize->{791, 497},
WindowMargins->{{35, Automatic}, {Automatic, 29}}
]


(***********************************************************************
Cached data follows.  If you edit this Notebook file directly, not using
Mathematica, you must remove the line containing CacheID at the top of
the file.  The cache data will then be recreated when you save this file
from within Mathematica.
***********************************************************************)

(*CellTagsOutline
CellTagsIndex->{}
*)

(*CellTagsIndex
CellTagsIndex->{}
*)

(*NotebookFileOutline
Notebook[{
Cell[1717, 49, 2911, 53, 929, "Input"],

Cell[CellGroupData[{
Cell[4653, 106, 46, 1, 42, "Input"],
Cell[4702, 109, 69, 1, 35, "Print"],
Cell[4774, 112, 3353, 64, 399, "Print"]
}, Open  ]]
}
]
*)




(***********************************************************************
End of Mathematica Notebook file.
***********************************************************************)



  • Prev by Date: Re: winding number
  • Next by Date: troubles with 3D plot
  • Previous by thread: LegendreP & Gauss quad bug
  • Next by thread: troubles with 3D plot