Re: Control Function With NDsolve

• To: mathgroup at smc.vnet.net
• Subject: [mg19438] Re: Control Function With NDsolve
• From: Eckhard Hennig <hennig at itwm.uni-kl.de>
• Date: Wed, 25 Aug 1999 01:25:11 -0400
• Organization: ITWM
• References: <7p5dm5\$127@smc.vnet.net> <7pl53k\$c74@smc.vnet.net> <7pt5n3\$n3l\$2@dragonfly.wolfram.com>
• Sender: owner-wri-mathgroup at wolfram.com

```Allan Hayes schrieb in Nachricht <7pt5n3\$n3l\$2 at dragonfly.wolfram.com>...
>Ekhardt,
>
>A version ot your solution. I have added two print commands to show where
>the switching occurs. One problem is that the accuracy of the switching is
>dependent on the step sizes.
>
>f[y_Real] := Which[
>    y >= ymax && fval == 1, Print[y]; fval = 0,
>    y <= ymin && fval == 0, Print[y]; fval = 1,
>    True, fval
>    ]
>
>
>ymax = 0.9; ymin = 0.1; a = 1; b = 1;
>
>eqs = {y'[t] == a*f[y[t]] - b*y[t], y[0] == 0};
>
>fval = 1; NDSolve[eqs, y[t], {t, 0, 15}];
>
>0.903906
>0.0810061
>0.913014
>0.0807329
>0.912961
>0.0807266
>0.90911

Allan,

indeed, I quietly ignored this problem because solving it efficiently would
require an analog/digital event synchronization mechanism as used in
mixed-mode system simulators such as Saber by Analogy, Inc. Event
synchronization requires support for time rollback, which is not possible
with built-in Mathematica functionality.

Newsgroup readers with a deeper interest in this subject should take a look
at US Patent No. 4,985,860. This document describes in detail a class of
algorithms for solving the synchronization problem in mixed-mode simulators
efficiently. For convenience, a direct link to the abstract of the patent is
given below. To read the full text, click on the button "Full Text" in the

http://patents.uspto.gov/cgi-bin/ifetch4?ENG+PATBIB-ALL+0+960845+0+3+5555+OF
+1+1+1+PN%2f4%2c985%2c860

Best regards,

Eckhard

-----------------------------------------------------------
Dipl.-Ing. Eckhard Hennig      mailto:hennig at itwm.uni-kl.de
Institut fuer Techno- und Wirtschaftsmathematik e.V. (ITWM)
Erwin-Schroedinger-Strasse,  67663 Kaiserslautern,  Germany
Voice: +49-(0)631-205-3126    Fax: +49-(0)631-205-4139
http://www.itwm.uni-kl.de/as/employees/hennig.html