Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

(Newbie question)

For every function I define I get this message:

enter image description here

When I close and reopen Mathematica, and re-enter the function definition, I don't get the message anymore. What does it mean?

share|improve this question
2  
You can see that f is already defined because it's coloured black. You can verify this using ?f too. Instead of the drastic Remove[f] you can also use Clear[f] to clear all definitions, or f =. to remove f's value if f is a simple variable (in Mathematica terms: it only has OwnValues but not DownValues). –  Szabolcs Jun 13 '12 at 7:29
2  
You may find this discussion of some relevance. –  Leonid Shifrin Jun 13 '12 at 9:00
1  
I can't stand seeing the typo ... when you want to define functions with variables (which appears to be what you are doing) you don't use the = sign alone. You should be use the SetDelayed := sign: f[Rx_] := 25 Rx/(Rx+50)^2 –  Nick Aug 12 at 20:07
1  
Nick, I am glad you have chosen to contribute to our site. However, this isn't really an Answer as it does not directly relate to the message in Question. You are correct that (usually) one wants SetDelayed when defining a function, but this note belongs as a comment, not an Answer. I know you do not yet have the "privilege" of posting comments but if you continue to participate that will change. For now I am converting your post into a comment on your behalf. –  Mr.Wizard Aug 12 at 20:14
1  
@Nick you are usually correct in that you want to use SetDelayed instead of Set. But, on occasion, you can use Set if you need the right-hand-side to be evaluated, e.g. f[x_] = Integrate[q^2, {q, 0, x}]. This is cleaner looking than using Evaluate, but with the same effect. –  rcollyer Aug 12 at 20:20

1 Answer 1

up vote 5 down vote accepted

It means you set f = 156 sometime before you executed that function definition. Executing a Remove[f] before your new definition should have fixed the problem.

share|improve this answer
    
Thanks. Makes sense. But I also got this in a new notebook. Does that mean that the scope of symbols is session-wide instead of notebook-constrained? (Not what I would expect) –  stevenvh Jun 13 '12 at 7:19
    
Yes, session-wide. If you want to constrain your symbols to a particular notebook, see this question. –  J. M. Jun 13 '12 at 7:25
2  
@stevenvh The kernel state is not specific to the notebook. You have to restart the kernel to clear its state completely. But if you want notebook-local symbols, you can use Evaluation -> Notebook's Default Context -> Unique to This Notebook. This option is available since version 6. –  Szabolcs Jun 13 '12 at 7:25
    
Thanks, J.M. and @Szabolcs. Szabolcs, I learned about it browsing through the list of SE sites at the top of another SE site's page. I'm mostly active in electronics.SE now, but registered in a dozen or so. –  stevenvh Jun 13 '12 at 7:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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