Tag × protected in Mathematica?

  • Context: Mathematica 
  • Thread starter Thread starter nikolafmf
  • Start date Start date
  • Tags Tags
    Mathematica Tag
Click For Summary

Discussion Overview

The discussion revolves around an issue encountered in Mathematica regarding the error message "Tag Times in 0 × 1.52098*10^11 is Protected." Participants explore potential solutions and code corrections related to conditional statements in their code.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant reports an error message related to a protected tag in Mathematica and seeks a solution.
  • Another participant suggests a correction to a conditional statement syntax, indicating a possible error in the original code.
  • A different participant notes that despite the error message, results are printed, which aligns with their desired outcome.
  • Further corrections are proposed regarding the syntax of conditional statements, including the use of equality versus assignment.
  • One participant asserts that a right bracket is not missing in the provided code, countering an earlier claim about syntax issues.
  • Another participant suggests specific changes to the code that may resolve the issues being faced.

Areas of Agreement / Disagreement

The discussion contains multiple competing views regarding the syntax and structure of the code, with no clear consensus on the best approach to resolve the error message.

Contextual Notes

Participants express uncertainty about the correct syntax and the implications of the protected tag error, indicating that the discussion is dependent on specific coding practices and interpretations of Mathematica's behavior.

nikolafmf
Messages
112
Reaction score
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

Physics news on Phys.org
The line
Code:
If[Or[i == 100000, i == 200000, i = 300000],
should read
Code:
If[Or[i == 100000, i == 200000, i == 300000],
 
It still says tag is protected, but also prints the results, which is what I want.
 
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.
 
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]]]
 
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:

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 9 ·
Replies
9
Views
3K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 4 ·
Replies
4
Views
1K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K