MathGroup Archive 2000

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

Search the Archive

Re: Bug: Mathematica multipies statements together

  • To: mathgroup at smc.vnet.net
  • Subject: [mg25484] Re: Bug: Mathematica multipies statements together
  • From: "Carl K. Woll" <carlw at u.washington.edu>
  • Date: Mon, 2 Oct 2000 22:27:02 -0400 (EDT)
  • References: <8r1b66$ier@smc.vnet.net> <200010010644.CAA29687@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Jens,

Thank you for responding to my question. I have included a much smaller and
simpler notebook (two lines of input) which demonstrates the problem in my
post, which you will find below, in the hopes that the new notebook doesn't
get mangled in going through the news server. Please try out this new
notebook to see if you can reproduce my bug. In case it does get mangled, I
have included the code from the notebook below, so that I can give more
details about what occurs. The first line is simply an If statement:

f = If[ g==1,  \[Lambda]2=1;
    \[Lambda]1=-d/2
]

Actually, the notebook is in standard format, so I have reproduced the above
code by hand. When this command is executed, ?f returns the following
information:

Global`f
InputForm[f := If[g == 1, (\[Lambda]2 = 1; )*(\[Lambda]1 = -(d/2))]]

Regarding your comments:

b) I think this is definitely a bug in Mathematica. For example, the
statement

a=1;
b=1

should not be interpreted as (a=1;)*(b=1), yet this is what mathematica is
doing.

c) Since this code is part of a module, it doesn't make any sense to have
one input cell for one output.

d) Actually, you have sort of hit upon the only sure fire workaround that I
have found. Since I am trying to use the CompoundExpression command in the
usual syntax of

a;
b;
etc.

my solution is to instead explicitly use the CompoundExpression command,
e.g. CompoundExpression[a=1,b=1] . This approach always produces the
expected result.

Carl Woll

Below is the notebook expression demonstrating the problem. I have deleted
the output from the ?f command for fear that the output would cause the
notebook to be corrupted. Just copy the notebook expression into mathematica
and execute the two commands. I am curious whether the bug can be reproduced
by others.

Notebook[{
Cell[BoxData[
    \(f := If[g == 1, \(\(\[Lambda]2 = 1;\)\[IndentingNewLine]
        \[Lambda]1 = \(-\(d\/2\)\)\)\[IndentingNewLine]]\)], "Input"],

Cell[BoxData[
    \(\(?f\)\)], "Input"]
},
FrontEndVersion->"4.0 for Microsoft Windows",
ScreenRectangle->{{0, 1024}, {0, 695}},
Evaluator->"Local",
WindowSize->{913, 587},
WindowMargins->{{27, Automatic}, {38, Automatic}},
Magnification->1
]

----- Original Message -----
From: "Jens-Peer Kuska" <kuska at informatik.uni-leipzig.de>
To: mathgroup at smc.vnet.net
Subject: [mg25484] [mg25453] Re: Bug: Mathematica multipies statements together


> Hi,
>
> a) uuencode you notebooks. The most mailer cut the line length and
>    the result are syntax errors because mailer don't insert \
>    as line continuations.
> b) that ist not a bug -- it is a feature. Since Mathematica use space
> characters
>    as Times[] operator it is not clear if
>    a=b q=c   mean a=(b*(q=c))  or it it mean
>
>    a=b
>    q=c
> c) simply use the rule one input-cell for one output
> d) use CompoundExpressions[] like a=b;q=c if you mean this
>
> Regards
>   Jens
>
> "Carl K. Woll" wrote:
> >
> > 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
>



  • Prev by Date: Re: Summary: List element manipulation
  • Next by Date: Re: Why is Mathematica so slow ?
  • Previous by thread: Re: Bug: Mathematica multipies statements together
  • Next by thread: Re: Bug: Mathematica multipies statements together