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.

  • $\begingroup$ 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. $\endgroup$ – J. M. will be back soon Aug 8 '12 at 5:06
  • $\begingroup$ You can make a simple change of variable in the integral P(r) itself and have it re-written terms of v and w. $\endgroup$ – Vitaliy Kaurov Aug 8 '12 at 5:12
  • $\begingroup$ @J.M. Thank you for your advice. :) $\endgroup$ – Jaehoon Kim Aug 8 '12 at 12:01
  • $\begingroup$ @VitaliyKaurov, Thanks for your advice. :) $\endgroup$ – Jaehoon Kim Aug 8 '12 at 12:02

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


  • $\begingroup$ Yes. Your code helped me. It works nice. Thank you. :) $\endgroup$ – Jaehoon Kim Aug 8 '12 at 7:08
  • $\begingroup$ @JaehoonKim, my pleasure. Welcome to MathematicaSE. $\endgroup$ – kglr Aug 8 '12 at 7:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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