Re: NDSolve problem with switching
- To: mathgroup at smc.vnet.net
- Subject: [mg106251] Re: NDSolve problem with switching
- From: Albert Retey <awnl at gmx-topmail.de>
- Date: Wed, 6 Jan 2010 06:00:03 -0500 (EST)
- References: <201001030842.DAA10093@smc.vnet.net> <hhun8c$ngg$1@smc.vnet.net>
Hi, > Here are simpler choices for the box wave. > > box[x_] = Piecewise@{{1, FractionalPart@x < .5}} > Plot[box@t, {t, 0, 2}] > > or > > box = If[FractionalPart@# < .5, 1, 0] &; > > But, strangely enough, they don't speed things up in NDSolve. > I think there is no reason to expect they would. I think the problem is that a numeric differential equation solver will always use a lot of sampling points near one of the steps. Actually the resolution it will use is just limited by the precision it tries to achieve, since it would need infinitesimaly small steps to resolve the step. So if you want to see speedup, one pragmatic approach would be to use a "smoothing" of your step function, e.g. by replacing it with an appropriate ActTan. Then you can control the resolution of the step function independently of the desired precision. In most pratical problems you will have an idea about what a reasonable resolution for such a step function would be... hth, albert
- References:
- NDSolve problem with switching equations
- From: Haibo Min <haibo.min@gmail.com>
- NDSolve problem with switching equations