Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #3256 > unrolled thread

DSolve gives different answer to NDSolve

Started byTheo Moore <tsg.moore@googlemail.com>
First post2011-06-23 11:35 +0000
Last post2011-06-23 11:35 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  DSolve gives different answer to NDSolve Theo Moore <tsg.moore@googlemail.com> - 2011-06-23 11:35 +0000

#3256 — DSolve gives different answer to NDSolve

FromTheo Moore <tsg.moore@googlemail.com>
Date2011-06-23 11:35 +0000
SubjectDSolve gives different answer to NDSolve
Message-ID<itv8dp$pfh$1@smc.vnet.net>
I want to solve:

0.2*dy/dz + y = 0.2/z
y (1 - 1000*I) = 0

on the line z = 1 + s*I with s in [-10, 10]. Simple, right? I can first give
the exact solution a go:

f[x_] = 0.2/x;
eqn = 0.2*y'[x] + y[x] == f[x];
yExact[x_] = y[x] /. DSolve[{eqn, y[1 - 1000*I] == 0}, y[x], x][[1]];
P1 = Plot[Re[yExact[1 + t I]], {t, -10, 10} , PlotStyle -> Thick,  PlotRange
-> 0.3]

It gives s solution which tails off on the left, but has (significantly
large) oscillations on the right.

Fair enough. What about a numerical solution? We solve for a function w[t] y[1 + t*I]

sol = NDSolve[{0.2*w'[t] + w[t] == f[1 + t*I], w[-1000] == 0}, w, {t, -10,
10}];
P2 = Plot[Evaluate[Re[w[t] /. sol]], {t, -10, 10}, PlotStyle -> {Thick,
Red}, PlotRange -> 0.3]

Now there are no more oscillations.

Why do we get two different answers? The solution is well behaved along the
domain, with no singularities or branch cuts. If you like, you can also
integrate the first-order ODE and either symbolically or numerically
evaluate the integral. However, you get a solution with oscillations. I
expect oscillations, and I think the numerical NDSolve is incorrect. Have I
made a mistake?

Any help would be appreciated! Thanks.

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web