Message Boards Message Boards

0
|
4967 Views
|
1 Reply
|
0 Total Likes
View groups...
Share
Share this post:

Save the variable after one turn of the loop function ?

Posted 9 years ago

Hi guys I have a expression like this one :

Q[r_ , ri_] := {DiracDelta[r - ri], 5*DiracDelta[r - ri]  , DiracDelta[r - ri]^2 ,  Derivative[1][DiracDelta][r - ri]}

my ri is a list of following numbers: ri = {-0.5 , -0.2 , 0.5 , 0.5} now I want to introduce a new symbolic function as S[r_ , ri[ which is the same like Q[r , ri_] but with some chamges in the expressions. So I used this command:

For[i = 1 , i <= FromDigits[Dimensions[Q[r , ri]]] , i++ , 
 QI[r , ri[[i]]] = 
  Q[r , ri[[i]]] /. 
   DiracDelta[r - ri[[i]]] -> HeavisideTheta[r - ri[[i]]]]

But the Problem is the for loop function just applys the changes of the last iteration and does not save the loop after each turn. Since this is so important for me, any possible answers are appreciable.

POSTED BY: Mohsen Rezaee
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract