Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm looking for the way to substitute variables in interpolated function again to original one.

(I want to know how to get P(r, theta) from Psol(v, w).)

The original variables :

    r , theta (d<=r<=Infinity, 0<=theta<=Pi).

New variables :

    v , w (0<=v<=1, 0<=w<=1). 

The relationship is

Relations of variables.

I now have the interpolated solution Psol(v, w). Psol(v,w) has no analytic expression, and was interpolated from numerical calculation.

The final goal is to get P(r=d), after angle-averaging the P(r,theta)

Angle-averaged P.

I want to know how to get P(r, theta) from Psol(v, w) using above variable-to-variable relationship.

May I have your advice?

Thanks in advance.

share|improve this question
Why not replace the $v$ and $w$ in your Psol with the expressions you have? Your question could be a bit more concrete; we don't even know what your "interpolated solution" looks like. – J. M. Aug 8 '12 at 5:06
You can make a simple change of variable in the integral P(r) itself and have it re-written terms of v and w. – Vitaliy Kaurov Aug 8 '12 at 5:12
@J.M. Thank you for your advice. :) – Jaehoon Kim Aug 8 '12 at 12:01
@VitaliyKaurov, Thanks for your advice. :) – Jaehoon Kim Aug 8 '12 at 12:02
up vote 2 down vote accepted

Something like:

sol = NDSolve[{D[p[v, w], v] == D[p[v, w], w, w], p[0, w] == 0, 
p[v, 0] == Sin[v], p[v, 5] == 0}, p, {v, 0, 10}, {w, 0, 5}]

enter image description here

Plot3D[Evaluate[p[v, w] /. %], {v, 0, 10}, {w, 0, 5}, PlotRange -> All]

enter image description here

pt[r_, \[Theta]_, rc_, d_, \[Gamma]_] /; d <= r := (p[v, w] /. sol ) /. 
{v -> (Exp[-\[Gamma] rc/r] - Exp[-\[Gamma] rc/d])/(1 - Exp[-\[Gamma] rc/d]), 
w -> \[Theta]/Pi};
Plot3D[{pt[r, \[Theta], .9, 0.3, 1], pt[r, \[Theta], .1, 0.3, 1]}, 
{r, 0.3, 3}, {\[Theta], 0, Pi}, PlotRange -> All]

enter image description here


share|improve this answer
Yes. Your code helped me. It works nice. Thank you. :) – Jaehoon Kim Aug 8 '12 at 7:08
@JaehoonKim, my pleasure. Welcome to MathematicaSE. – kglr Aug 8 '12 at 7:14

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.