Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

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

Search the Archive

Re: Can you tell me what is wrong with this program

  • To: mathgroup at smc.vnet.net
  • Subject: [mg110347] Re: Can you tell me what is wrong with this program
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Tue, 15 Jun 2010 02:27:05 -0400 (EDT)

>c = 0;
>m = 0;
>z = 0;
>count = 0;
>for [lc = 0, lc < 8, lc++]
>{
>lc = lc + 1;
>for[lm = -4, lm < 8, lm++]
>{
>lm = lm + 1;
>for [lz = -4, lz < 8, lz++]
>{
>lz = lz + 1;
>A = (2*(lc - lm)*(lc - lm)) + 4*lz*lz;
>B = -2*(lc + lm)*lz;
>C = 4*lc*lm;
>if [A > 0]
>if[(B*B - A*C) > 0]
>{
>K1 = (B + sqrt (B*B - A*E))/A;
>K2 = (B - sqrt (B*B - A*E))/A;
>e = abs (lc);
>m = abs (lm);
>z = abs (lz);
>L = c + m + z;
>if [K1 <= 0.707 && K1 > 0 , print[n, L, lc,   lm ,  lz, K1]]
>if [K2 <= 0.707 && K1 > 0 , print[n, L, lc,   lm ,  lz, K2]]
>
>}
>
>
>}
>}
>}

>I get the following error

>Out[5]= for[0, True, 0]

>During evaluation of In[1]:= Set::wrsym: Symbol C is Protected. >>

Let's start with *all* built-in Mathematica functions start with
an uppercase letter. No exceptions.

Next, arguments to all functions are delimited with *square*
brackets "[" and "]" not parentheses. So your abs(lc) needs to
be Abs[lc] etc. And since there are several built-in things
named with a single uppercase letter such as C,D and E, you
would be well advised to not use a single upper case letter as a
variable name.



  • Prev by Date: Reading Binary Data from SQL Request
  • Next by Date: Re: problem with the usage or implemetation of EllipticF[x,m] and
  • Previous by thread: Can you tell me what is wrong with this program
  • Next by thread: Re: Can you tell me what is wrong with this program