Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have a trouble with plotting a pde system solution. I'm solving a PDE system in 2-dimensional space and then I want to integrate the solution along one dimension and build a log plot along the other. I tried the following piece of code:

rules = NDSolve[{Eqs, Append[{Cond0, Cond00, Cond1}, Cond]}, 
                U[t, x], {t, 0, 0.01}, {x, 0, H}];
F = (NIntegrate[First[U[#, x] /. rules], {x, 0, H}]) &

which produces an error

"Integrand has evaluated to non-numerical values".

I assume it happens because Mathematica is trying to integrate the function before substituting 0.1. I thought that putting it into the pure function that evaluates its body only after substitution would fix the problem, but it didn't. How to make it work?

share|improve this question
Could you post some more details of your code (e.g. the function U[t,x] etc.)? –  partial81 Jun 15 '13 at 19:17
'code' Nmax = 2; U[t_, x_] := Table[Subscript[C, i][t, x], {i, 1, Nmax}]; ... Eqs[[1]] = D[U[t, x][[1]], t] == Di*D[U[t, x][[1]], x, x] - 2 kplus[[1]]*U[t, x][[1]]*U[t, x][[1]] + 2 kminus[[2]]*U[t, x][[2]] - Tail1[t, x]; For[i = 2, i < Nmax, i++, Eqs[[i]] = D[U[t, x][[i]], t] == Tail[t, x, i]; ] Eqs[[Nmax]] = D[U[t, x][[i]], t] == Taill[t, x, Nmax]; 'code' Well, that's how the functions are defined, but it doesn't actually matter, because NDSolve works just fine and its output was plotted with Plot3d successfully. The trouble is about evaluation. –  Vasily Jun 15 '13 at 19:27
@Vasily please consider reading the formatting help page. –  shrx Jun 15 '13 at 19:40
Thanks. Now I know how to format. –  Vasily Jun 15 '13 at 19:52
Vasily, it's much better if we have a full example that we can use to test our hypotheses as to why there may be a problem. That's the reason that having all of the functions and parameters defined for us would be useful for us to be able to help you. –  Jonathan Shock Jun 15 '13 at 22:40
show 4 more comments

Your Answer


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

Browse other questions tagged or ask your own question.