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


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

DSolve gives different answer to NDSolve

From Theo Moore <tsg.moore@googlemail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject DSolve gives different answer to NDSolve
Date 2011-06-23 11:35 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <itv8dp$pfh$1@smc.vnet.net> (permalink)

Show all headers | View raw


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.

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web