I have code that automatically outputs a parametric function that's found by using ParametricNDSolveValue:

enter image description here

I'm using a Module to automatically solve the equation. I'm posting these as images because there's just too much code to post, but I can post the code if there's no way of solving this by inspection.

When I solve for this parametric function and output it manually I get this instead (without Module):

enter image description here

They seem to be exactly the same, except the first one is in deconstructed form, showing all the "insides". The problem is that I can't seem to Plot the first function, but I can Plot the second one. This might have something to do with the Module creating local variables that Mathematica can't later use when plotting but I'm not sure.

Any help or ideas is greatly appreciated.

Edit: When I was trying to recreate the problem I found the solution. Here is what I meant -- we use a ParametricNDSolveValue in the setup to solve this differential equation and plot it:

s = ParametricNDSolveValue[{z'[t] == Exp[-2 t^2] t^(9/5) (x - t)^(4/5) HypergeometricPFQ[{1/2, 1}, {7/5, 19/10}, -t^2], z[0] == 0}, z, {t, 0, x}, {x}]; 
g = s[x];

You plot $g(x)$ and the curve appears. Then, I put this inside a Module and called the Module and wrapped an ExpandAll around it to see all the terms:

test = Exp[-2 t^2] t^(9/5) (x - t)^(4/5) HypergeometricPFQ[{1/2, 1}, {7/5, 19/10}, -t^2];

y[test_] := Module[{}, s = ParametricNDSolveValue[{z'[t] == test, z[0] == 0}, z, {t, 0, x}, {x}];
g = s[x]]

This is the calling function here:

ans[x_] = ExpandAll[y[test][x]]

It produces the output seen in the first image above, with all the crazy detail. If you try to plot it, no curve shows up. I originally thought this was because of Module, but actually it's because of ExpandAll. If you remove ExpandAll, you can plot $ans(x)$. Somehow one thing interferes with another.

  • 2
    $\begingroup$ Please do not post images of your work, especially when the images display at a size that make them unreadable. Please post your actual Mathematica code in the form of text that can be copied and pasted into a Mathematica notebook. Without such, it will be difficult to reproduce your problem and to experiment with possible repairs. $\endgroup$
    – m_goldberg
    Aug 18 '16 at 20:53
  • 2
    $\begingroup$ It's much worse than "no solution by inspection": what you have posted is extremely fragmentary information with pieces missing, which in fact is total nonsense in its current form. Your description is also not clear: Module is a scoping construct, so one can only wonder how it is used to solve anything. Please construct and post a minimal (not) working example, otherwise the chances of anyone being able to help you are extremely slim. Your other questions are good, so I expect you know the drill by now. $\endgroup$ Aug 18 '16 at 22:42
  • $\begingroup$ I updated the post and I think I found the solution as well. Thanks for keeping me in check @OleksandrR. $\endgroup$
    – Buddhapus
    Aug 19 '16 at 6:16

Your Answer

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

Browse other questions tagged or ask your own question.