I want to create, print and be able to use (i.e. do symbolic operations) variables in Mathematica using a for loop or equivalent.
So, I have a bunch of variables of this form:
$$dS_i = -\beta_i S_i$$ where $i$ is an index.
I would like to end up with the variables defined in the notebook like this:
$$dS_1 = -\beta_1 S_1$$ $$dS_2 = -\beta_2 S_2$$ $$dS_3 = -\beta_3 S_3$$
etc.
So that I can see each of them in my screen and I can actually perform symbolic operations with them (e.g. $dS_1 + dS_2$).
If I do:
Do[Print["dI", i, "= -beta", i, "*S"], {i, 4}]
then I get the printing part but they are not variables, just strings.
I have also tried:
Table[dI[i] = -beta[i]*S, {i, 4}]
which generates the variables but then I don't get to see them on the screen.
Any ideas? thanks in advance
[[]]
a.k.aPart
instead of[]
. And also this question just needs more details. You can always use the symbolic entities and pipe them to, say,Grid
. $\endgroup$