|
From: Rainer M. <ra...@tb...> - 2006-06-13 13:31:16
|
On Tue, 13 Jun 2006, Stefan Mueller wrote:
> hi rainer!
>
> you are right. currently the implementaion is wrong.
> it should be as it's written in the comment.
> f(x)=abs(a(x)) => f' = sig(a)*a'
sig(a) is not an ASTNode type, so I guess we need to construct a piecewise
function:
if a < 0: -1
if a > 0: +1
What if a = 0?
The next problem then is, that our piecewise implementation is also not
generally valid.
case AST_FUNCTION_PIECEWISE:
if ( evaluateAST(child(n,0),data) )
result = evaluateAST(child(n,1),data);
else
result = evaluateAST(child(n,2),data);
Which is only valid for piecewise/otherwise combinations, but not for more
then one `piece'.
See e.g
http://www.zvon.org/xxl/MathML/Output/el_piecewise.html
and click example repository for two examples.
Rainer
>
> don't worry about the discontinuity at x=0! :)
>
> cheers, s
>
>
> Am Freitag 09 Juni 2006 17:46 schrieb Rainer Machne:
>> Hi Stefan
>>
>> I am currently going through the code, implementing the style convention
>> and getting familiar with SOSlib again :-)
>>
>> in differentiateAST we have the lines
>>
>> case AST_FUNCTION_ABS: /** ABS: WRONG */
>> /* f(x)=abs(a(x)) => f' = sig(a)*a'
>> WRONG: CAN RESULT IN A DISCONTINUOUS FUNCTION! */
>> ASTNode_setType(fprime, ASTNode_getType(f)); /* WRONG !!! */
>> ASTNode_addChild(fprime, differentiateAST(ASTNode_getChild(f,0),x));
>> break;
>>
>> So it's actually not doing what it claims in the comment, and also there
>> are these uppercase WRONG warnings.
>>
>> What should we do about that. Should we implement it as written in the
>> comment?
>>
>> Rainer
>>
>>
>>
>>
>> _______________________________________________
>> sbmlsolver-devel mailing list
>> sbm...@li...
>> https://lists.sourceforge.net/lists/listinfo/sbmlsolver-devel
>
|