Message Boards Message Boards

0
|
4581 Views
|
1 Reply
|
0 Total Likes
View groups...
Share
Share this post:

problem with NDsolve of piecewise function

Posted 10 years ago

Hi, I have a problem trying to solve a differentail equation:

neff2a[x_] =  Piecewise[{{0.0, x <= zero}, {neff2[x][[2, 1, 2, 1]],   zero < x < d}, {0.0, x >= d}}]

where neff2[x] element is a constant value, so it is a step function:

step function.

I define differential equation:

ps2 = D[D[V2[x], x], x] == neff2a[x]/\[Kappa]

So it is defined like that:

enter image description here

I'm trying to solve the equation:

psres2 = NDSolve[{ps2, V2[0] == 0.0, V2[d] == U}, V2[x], {x, 0.0, d}]

but I get:

NDSolve::bvdisc: NDSolve is not currently able to solve boundary value problems with discrete variables. >>

why? Is there any way to solve this equation by Mathematica?

Thanks in advance, Mariusz

POSTED BY: Mariusz Sapinski

If U isn't defined, you're asking a numerical algorithm, NDSolve, to handle a symbolic problem. I was able to do a problem similar to yours using DSolve.

f[x_] = UnitStep[x] - UnitStep[x - 1];

In[12]:= sln = DSolve[{y''[x] == f[x], y[0] == 0, y[1] == u}, y, x]

Out[12]= {{y -> Function[{x}, 1/2 (-1 + 2 u) x + 1/2 (-1 + x + 2 u x) + 1/2 (1 - 2 u) x UnitStep[x] + UnitStep[ 1 - x] (1/2 (1 - x - 2 u x) + 1/2 (-x + 2 u x + x^2) UnitStep[x])]}}

POSTED BY: Frank Kampas
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract