Forums

F.A.Q. F.A.Q.    Register Register    Login Login    Home Home
Search Search
SBML Discussions » sbml-discuss » encoding a maximum function for t<=t0
Show: Today's Posts  :: Message Navigator
| Subscribe to topic 
Return to the default flat view Create a new topic Submit Reply
AuthorTopic
Lucian Smith


Posts: 183
Registered:
July 2008
Re: encoding a maximum function for t<=t0 18 May '11 12:15 Go to previous messageGo to previous message

* Frank Bergmann <fbergman@caltech.edu> [2011-05-18 19:24] writes:
> There is a cheaper way of calculating the maximum, that also gets around the
> circular restriction on assignment rule. The basic idea is to have one event
> fire constantly (say every couple of ms) and there you would do your
> assignment. This trigger function is way easier to find (as the rootfinder
> does no longer have to search for the single root at which a != b).

If you don't want your event firing *all* the time, you could instead
introduce the concept of a tolerance. In Antimony format:

model model01()
x := sin(time); //Just to have an x that varies
xmax = x; //An initial assignment
tolerance = 0.00000001; //This can be changed

E0: at(x>xmax+tolerance): xmax=x; //The event

end

Your event will fire a lot as x increases past xmax, but once it goes down
again, the event stops firing. The tradeoff is that xmax will probably be
some fraction of 'tolerance' too low, as we only reassign xmax if x passes
it by a whole tolerance unit.

Model attached!

-Lucian

Attachment: model01.xml
(Size: 1.89KB, Downloaded 98 time(s))
      

SubjectPosterDate
Read Message   encoding a maximum function for t<=t0 schubert18 May '11 01:51
Read Message   Re: encoding a maximum function for t<=t0 Nicolas Le Novere18 May '11 07:39
Read Message   Re: encoding a maximum function for t<=t0 myers18 May '11 08:31
Read Message   Re: encoding a maximum function for t<=t0 Sven Sahle18 May '11 08:47
Read Message   Re: encoding a maximum function for t<=t0 myers18 May '11 08:55
Read Message   Re: encoding a maximum function for t<=t0 kieransmallbone18 May '11 09:21
Read Message   Re: encoding a maximum function for t<=t0 Nicolas Le Novere18 May '11 09:25
Read Message   Re: encoding a maximum function for t<=t0 myers18 May '11 09:31
Read Message   Re: encoding a maximum function for t<=t0 schubert18 May '11 09:29
Read Message   Re: encoding a maximum function for t<=t0 myers18 May '11 10:12
Read Message   Re: encoding a maximum function for t<=t0 Sven Sahle18 May '11 10:55
Read Message   Re: encoding a maximum function for t<=t0 fbergman18 May '11 11:15
Read Message   Re: encoding a maximum function for t<=t0 myers18 May '11 11:58
Read Message   Re: encoding a maximum function for t<=t0 Stefan.Hoops18 May '11 13:17
Read Message   Re: encoding a maximum function for t<=t0  Lucian Smith18 May '11 12:15
Read Message   Re: encoding a maximum function for t<=t0 Sven Sahle18 May '11 08:41
Read Message   Re: encoding a maximum function for t<=t0 Nicolas Le Novere18 May '11 09:33
Previous Topic:About the upcoming votes on L3 package proposals
Next Topic:Re: [SED-ML-discuss] encoding a maximum function for t<=t0
Go to forum:
-=] Back to Top [=-

Powered by FUDforum. (Copyright Advanced Internet Designs Inc.)

Please use our issue tracking system for any questions or suggestions about this website.