| Author |
Comment/Response |
Nicolette Caister
|
10/07/08 09:40am
In Response To 'Re: Names for general variables' --------- Hi again
Thank you for the info. I am battling to apply it to my work though. Please excuse me if I over explain or do not explain well enough. It is hard to write this up without the use of subscripts or superscripts!
I have tables called S0, S1, S2, etc. But I cannot call them "S0", at the moment I have Subscript[S,0] etc. From the previous response, I can see that I must use the ToExpression[] function. But this does not work in my notebook. I am using it in a ReplaceAll function.
(Here I name the table Subscript[S,i] where i is the number of times 'S' is differentiated w.r.t. p - in fact p is just a sort of "dummy variable")
From my differentiation I have S^(0,b)[t,p] which is S differentiated 0 times by t and 'b' times by p. I.e. standard notation for MM.
Before (to create the S_i's (S subscript i)) I had:
(mydiff function)/.{S^(0,b_)[t,p]->Subscript[S,b]}
this worked perfectly, and if S was differentiated twice, i had S_2. Exactly what I want. BUT, I now need to use the tables with files and instead of S_i I want plain Si. When I try this is my ReplaceAll (/.) part, it does not link the actual number, i, to the b, i.e., I have:
(mydiff function) /.{S^(0,b_)[t,p]->ToExpression["S",ToString[b]]}
This does not work - i get "Sb" in my expression instead of (for example) S2. What am I doing wrong?
Thank you for your help.
Nicolette
URL: , |
|