0
$\begingroup$

I used NIntegrate to calculate an integral with the final limit as a variable, which later will be listed in a table,

C[a_?NumberQ] := 
  C[a] = (5ΩmQ)/2 (H[a]/H0) NIntegrate[1/(x H[x]/H0)^3, {x, 10^-5, a}];
lst6 = Table[{a, C[a]}, {a, 0.1, 1, 0.05}];

The above is just to show how I wrote the proccess.

The problem is, function H has several sets of values, and the integral must be calculated for each one. So I wrote the same code for each case in the same notebook (copy-paste). For the first and second set of values inside H, the integral is calculated. The third one yields

SetDelayed::write: Tag C in C[a_?NumberQ] is Protected. >>

I changed the label of the "symbolic integral" C[a_?NumberQ] for each set, say A[a_?NumberQ],B[a_?NumberQ] and C[a_?NumberQ]. The problem is in the last case. H function is not changed, I mean it is H in all three cases.

Whats is the meaning of the error message?

$\endgroup$
  • $\begingroup$ Do I have to use something like Quit at the end of each case? $\endgroup$ – Patrick El Pollo May 1 '15 at 21:57
  • 2
    $\begingroup$ C is a protected symbol from Mathematica: "is the default form for the i^th parameter or constant generated in representing the results of various symbolic computations" $\endgroup$ – Santi May 1 '15 at 22:02
  • $\begingroup$ In general, you should avoid using variables with an uppercase initial letter (camel case is fine) to avoid conflicts like this. $\endgroup$ – Sjoerd C. de Vries May 2 '15 at 8:12
3
$\begingroup$

The reason for the error message is that C is a reserved system symbol.

http://reference.wolfram.com/language/ref/C.html

Since C has the attribute Protected, no further definitions can be made for it.

http://reference.wolfram.com/language/ref/Protected.html

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.