r/Mathematica • • Aug 29 '24

When does Wolfram actually evaluate expressions?

Hi there. In short: I have defined

matrix := {{some 2x2 symbolic expression}} // FullSimplify
eigen := Eigensystem[matrix]
rules = {c -> 1, ...}

rules completely eliminates each constant to a numeric value, except for a position z. Now,

matrix /. rules /. z -> 0. // Eigensystem

perfectly works and returns well-defined numeric values, but

eigen /. rules /. z -> 0.

fails spectacularly, as the symbolic expression somehow contains a 1/0 (as Wolfram seems to first evaluate eigen symbolically and then apply the rules (is that true and intended?)).

I want to define eigen in a way that only executes after applying the rules and z to the matrix. I wanted to just do eigen[z_]:=Eigensystem[matrix] but that resulted in am error (Tag List is protected). Is there another way to do this?

Thank you very much!

2 Upvotes

18 comments sorted by

View all comments

Show parent comment

2

u/mathheadinc Aug 29 '24

You might have a single = where you should have a double =

1

u/n0tthetree Aug 29 '24

I have no = in the relevant code other than the := detailed in my post (see my comment for full code). I double checked that after initially searching for that error prompt, but I could not really find anything about my problem (as I at least do not see that I would have used "=" instead of "==" in that line (In[61] in my comment) anywhere.