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 am solving a PDE using Mathematica and I would like to know how to implement the condition that the two-variable function y[t,s] is zero whenever t=s. I tried the obvious:

u[t,t]==0

or

u[s,s]==0

but Mathematica gives me the following output:

The arguments should be ordered consistently

To be more specific, I am solving the following PDE:

NDSolve[{p3D[t, s]*D[y[t, s], t, t] - v3D[t, s]*(q^2)*y[t, s] - 
r3D[t, s]*D[y[t, s], t] == 0, y[t, 0] == ysol[t], y[1, 1] == 0, 
y[0, s] == 0}, y, {t, 0, 1.}, {s, 0, 1}]

Where p3D,v3D,r3D and ysol[t] are known functions. I need to include the condition I mentioned inside the NDSolve.

Can I do that?

share|improve this question
4  
Are p3D etc very long functions, or could they be included in the question. That might help people give better answers. –  tkott Mar 4 '12 at 16:32
1  
Hi Marco, welcome at Mathematica.SE. I noticed you rolled back R.M's deletion of your salutation and signature. Please note that it is customary here not to sign or tag your questions with your name or your affiliation as your avatar and name are already included automatically. See also the FAQ for this. Even without explicit thanks in advance we will try to do our best (although this question doesn't look easy, to be honest). –  Sjoerd C. de Vries Mar 4 '12 at 23:05
1  
The condition you state is not a boundary condition because it is not at the boundary but right smack in the middle of your region. You have to define the problem so the condition is on the boundary of your solution region. Also at t=0 the condition y[t,0]==ysol[t] might be a contradition unless ysol[0]==0. It might help to set the region to something like {t, 0, 1}, {s, 0, t} and then develop the solution in two parts. –  Matariki Mar 5 '12 at 1:42
    
Very hard to play with this without access to p3D et al. –  Daniel Lichtblau Mar 13 '12 at 16:12
add comment

migrated from stackoverflow.com Mar 4 '12 at 5:50

This question came from our site for professional and enthusiast programmers.

2 Answers

You may be able to to this with an "EventLocator". Have a look at the documentation: tutorial/NDSolveEventLocator. Unfortunately, you do not give all information in your post, i.e the all functions. Those, however, would be needed to give a definite answer.

share|improve this answer
add comment

It's not really a PDE. You have no derivatives in s.

Here is a way one might go about getting say the half where t<=s. I'll make up some functions so it will look a bit like the original question.

r3D[t_?NumberQ, s_?NumberQ] := Cos[t^2 + s]
ysol[t_?NumberQ] := Sin[t]

We'll make $s$ an index parameter. For a given set of values we'll solve an ODE in $t$.

eqns[s_?NumberQ] := {D[
     y[s][t], {t, 2}] == (y[s][t] - r3D[t, s]*D[y[s][t], t]), 
   y[s][0] == ysol[s], y[s][s] == 0};

Now we make a table of solutions.

soln = Flatten[
   Table[NDSolve[eqns[s], y[s][t], {t, 0, s}], {s, .05, 1., .05}]];

Make a rectangular list of values. Set to 0 outside the range of our solutions. One can check that the boundary conditions were respected, up to a smallish factor of $MachineEpsilon.

vals = Table[
   If[t >= s, 0, y[s][t] /. soln], {s, .05, 1., .05}, {t, 0, 1, .05}];

InterpolatingFunction::dmval: Input value {0.1} lies outside the range of data in the interpolating function. Extrapolation will be used. >>

InterpolatingFunction::dmval: Input value {0.1} lies outside the range of data in the interpolating function. Extrapolation will be used. >>

InterpolatingFunction::dmval: Input value {0.15} lies outside the range of data in the interpolating function. Extrapolation will be used. >>

General::stop: Further output of InterpolatingFunction::dmval will be suppressed during this calculation. >>

I'm too tired to understand where/why I am outside the interpolation boundaries. Apologies. Anyway, we get a perhaps plausible set of values.

ListPlot3D[vals]

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

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