Tag × protected in Mathematica?

In summary, the conversation is about a problem with Mathematica not giving the desired results due to a tag being protected. The solution involves correcting syntax errors and missing brackets in the code.
  • #1
nikolafmf
114
0
Instead of giving the results of the calculation, Mathematica says:

"Tag Times in 0 × 1.52098*10^11 is Protected."

as in the attached file. Anyone has any idea how to get the results?
 

Attachments

  • Runge-Kutta.nb
    22 KB · Views: 539
Physics news on Phys.org
  • #2
The line
Code:
If[Or[i == 100000, i == 200000, i = 300000],
should read
Code:
If[Or[i == 100000, i == 200000, i == 300000],
 
  • #3
It still says tag is protected, but also prints the results, which is what I want.
 
  • #4
DrClaude said:
The line
Code:
If[Or[i == 100000, i == 200000, i = 300000],
should read
Code:
If[Or[i == 100000, i == 200000, i == 300000],

Also, there's a right bracket missing in both expressions above.
 
  • #5
The right bracket is not missing, since the whole sentence is:

If[Or[i == 100000, i == 200000, i == 300000],
Print[NumberForm[x, 13], "\t", NumberForm[y, 13], "\t",
NumberForm[r, 13], "\t", u, "\t", v, "\t", NumberForm[w, 6], "\t",
i*h, "\t", NumberForm[average, 13]]]
 
  • #6
Change

i = 300000

to

i == 300000

and

If[r < j, j = r]

to

If[r < j, j = r];

and your problems seem to go away
 
Last edited:

Related to Tag × protected in Mathematica?

1. What does "Tag × protected" mean in Mathematica?

"Tag × protected" means that a symbol or function in Mathematica has been protected from being modified or assigned a new value. This is done to prevent accidental or unwanted changes to important built-in functions and to maintain consistency within the Mathematica language.

2. How can I unprotect a symbol in Mathematica?

To unprotect a symbol in Mathematica, you can use the "Unprotect" command followed by the name of the symbol. For example, "Unprotect[f]" will unprotect the symbol "f" and allow you to modify or assign a new value to it.

3. What happens if I try to modify a protected symbol in Mathematica?

If you try to modify a protected symbol in Mathematica, you will receive an error message stating that the symbol is protected and cannot be modified. This is to prevent any accidental changes and to maintain the integrity of the Mathematica language.

4. Can I protect my own functions in Mathematica?

Yes, you can protect your own functions in Mathematica by using the "Protect" command followed by the name of your function. This will prevent any accidental changes or assignments to your function.

5. Is it possible to bypass the protection of a symbol in Mathematica?

It is possible to bypass the protection of a symbol in Mathematica by using the "Clear" command followed by the name of the symbol. However, this is not recommended as it can lead to unexpected results and should only be done if you fully understand the implications of modifying a protected symbol.

Similar threads

Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
192
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
Back
Top