From: Rainer M. <ra...@tb...> - 2006-06-16 11:53:39
|
I can't really find a nice description of piecewise. There are only two examples, one is the simple case piece/otherwise: piecewise(0, lt(x, 0), x) the other one is the case with three pieces: piecewise(-x, lt(x, 0), 0, eq(x, 0), x, gt(x, 0)) (which is a definition of abs(x)). Can there also be cases with e.g. two pieces and one otherwise? Or only two pieces? Can the following distinction: * odd number of AST children indicates that the last expression is an otherwise expression * even number of AST children indicates that all children a pairs of pieces solve it generally or are there other cases? Rainer On Fri, 16 Jun 2006, Rainer Machne wrote: > >> You are right this is a bug in the test suite > > Ok. We have implemented this bug in SOSlib :) > > i guess i have done the piecewise function when going through the tests > and used these examples as a template for implementation :) > > r > > > On Fri, 16 Jun 2006, Andrew Finney wrote: > >> Rainer >> >> You are right this is a bug in the test suite >> >> Andrew >> >>> -----Original Message----- >>> From: Rainer Machne [mailto:ra...@tb...] >>> Sent: 16 June 2006 12:23 >>> To: Andrew Finney >>> Cc: SOSlib Development >>> Subject: MathML Piecewise function[Scanned] >>> >>> hi Andrew, >>> >>> The use of piecewise in the semantic test suite seems to >>> differ from official definitions: >>> >>> E.g. in discontinuityTimeAndDelay-geq-l2.xml >>> it's: >>> >>> <piecewise> >>> <piece> >>> <apply> >>> <geq/> >>> <ci> s2 </ci> >>> <cn> 4 </cn> >>> </apply> >>> <cn>1.5</cn> >>> </piece> >>> <otherwise> >>> <cn>0.05</cn> >>> </otherwise> >>> </piecewise> >>> >>> which is >>> >>> piecewise(geq(s2, 4), 1.5, 0.05) >>> >>> in libSBML infix and interpreted as >>> >>> 1.5 if s2 >= 4 >>> and >>> 0.05 otherwise >>> >>> by SOSlib. >>> SOSlib produces the results required by the testsuite. >>> >>> >>> However, at >>> http://www.w3.org/TR/MathML2/chapter4.html#contm.piecewise >>> the definition is slightly different: >>> >>> <piecewise> >>> <piece> >>> <cn> 0 </cn> >>> <apply><lt/><ci> x </ci> <cn> 0 </cn></apply> >>> </piece> >>> <otherwise> >>> <ci> x </ci> >>> </otherwise> >>> </piecewise> >>> >>> in libSBML infix >>> piecewise(0, lt(x, 0), x) >>> >>> interpreted as >>> 0 if x < 0 >>> and x otherwise. >>> >>> Note, that the if condition of the piece element is BEFORE >>> the associated result, while it is AFTER the result in the >>> test suite example. >>> >>> The same ordering is found in the piecewise example for more >>> pieces - see below. The result associated with a piece is >>> always BEFORE the condition. >>> >>> Am i missing something or is the test suite example (and >>> SOSlib) wrong? >>> >>> Rainer >>> >>> >>> >>> The general example with more pieces: >>> >>> <piecewise> >>> <piece> >>> <apply><minus/><ci> x </ci></apply> >>> <apply><lt/><ci> x </ci> <cn> 0 </cn></apply> >>> </piece> >>> <piece> >>> <cn> 0 </cn> >>> <apply><eq/><ci> x </ci> <cn> 0 </cn></apply> >>> </piece> >>> <piece> >>> <ci> x </ci> >>> <apply><gt/><ci> x </ci> <cn> 0 </cn></apply> >>> </piece> >>> </piecewise> >>> >> > > > _______________________________________________ > sbmlsolver-devel mailing list > sbm...@li... > https://lists.sourceforge.net/lists/listinfo/sbmlsolver-devel > |