| Author |
Comment/Response |
Sami
|
09/02/12 3:01pm
Hi guys,
I am writing a symbolic program and have "n" variables .... I am new to Mathematica, so sorry if I sound too amateur ....
Somewhere in my code, I get a function with terms exp(x[1]^2)+ exp(y[1]^2)+ exp(z[1]^2) .... +exp(x[n]^2)+exp(y[n]^2)+exp(z[n]^2)....
Now I want mathematica to combine exp[ x[i]^2 + y[i]^2 + z[i]^2 to exp (R[i]^2): Meaning exp([i]^2).... exp(R[n]^2)
I tried different ways like:
A) R[i]^2= x[i]^2 + y[i]^2 + z[i]^2;
Simplify[Function]
B) rules = {Exp[x[i]^2 + y[i]^2 + z[i]^2] -> Exp[R[i]^2]}
For[i = 1, i < n + 1, i++, prob /. rules]
C) rules1 = {Exp[ (x[i]^2 + y[i]^2 + z[i]^2)] -> Exp[ (V[[i]] ) ]};
simplified = For[i = 1, i < n + 1, i++, ReplaceList[prob, rules ] ]
in which V is a vector of R[1] to R[i]....
Could anyone please help me with this??
I am struggling with this for two days! I am just new in Mathematica...
But none of them worked out.
Could you please help me with this?
Thanks.
URL: , |
|