Message Boards Message Boards

3 Replies
1 Total Likes
View groups...
Share this post:

Error: Set::write: "Tag Power in ... is Protected. "

Posted 10 years ago

So I made a code:

Subscript[m, F] = 18.0009380 u;
Subscript[m, O] = 15.999 u;
\[EmptyUpTriangle]m = Subscript[m, F] - Subscript[m, O];
\[EmptyUpTriangle]mc^2 = 1872.65710876;
Subscript[m, SuperPlus[e]] c^2 = 0.510998928;
Subscript[m, \[Upsilon]] c^2 = 0;

S = Sqrt[\[EmptyUpTriangle]mc^2 - 
    E - (Subscript[m, \[Upsilon]] c^2)^2]*(\[EmptyUpTriangle]mc^2 - 
    E)*Sqrt[E - (Subscript[m, SuperPlus[e]] c^2)^2]*E

Plot[{S, 0, 1}, {E, 0, 1}]

But it gives the error " Set::write: "Tag Power in ... is Protected." for [EmptyUpTriangle]mc^2 ; c^2 Subscript[m, e^+] and c^2 Subscript[m, [Upsilon]].

I simplified the code and I think I got it right. But it's just not "pretty":

a = 1872.65710876;
b = 0.510998928;
c = 0;

y = Sqrt[a - x - (c)^2]*(a - x)*Sqrt[E - (b)^2]*x

Plot[y, {x, 0, 2100}]

How can I change this last code to write ?m(c^2) instead of a and the other two variables instead of b and c?

Thank you.

POSTED BY: Jorge Silva
3 Replies

Actually those are fine for lvalues. One can do for example the examples below.

x[2] = 7

(* Out[57]= 7 *)

x[11][5] = 4

(* Out[59]= 4 *)

Subscript[w, 2] = 6

(* Out[60]= 6 *)

The documentation for Set claims (first item in Details section) "lhs can be any expression, including a pattern". I don't know why that claim is made. If I am not mistaken, it is correct only in cases where the head of the left side expression does not have the Protected attribute set. That said, one can unprotect and remove that attribute (I do not recommend this unless you really know what you are doing though).

POSTED BY: Daniel Lichtblau
Posted 10 years ago

So indexed letters/words are not valid definitions of variables either, right? Thank you for your quick reply.

POSTED BY: Jorge Silva

Look at the FullForm (if it is not clear already from visual inspection) You are attempting to assign, via Set, to an expression with Head of Power. But Set cannot do that because Power[a,b] is not a valid lvalue (that basically means it cannot be assigned to, in CS terminology).

POSTED BY: Daniel Lichtblau
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract