[GiNaC-list] Piecewise function

Vincent Huber vincent.huber at cemosis.fr
Wed Apr 22 16:47:13 CEST 2015


Hello Dr. Kisil,

The question from C. Trophime is not about evaluating the function but to
define it.
​ Feel++ <http://www.feelpp.org> is a Finite Element library that main goal
is to solve the variational problem a(u,v)=f(v) that arises from a lot of
physical problems.

​We use GiNaC to dynamically define the right hand side of our problem, or
our boundaries conditions and whatever can be expressed with it.

The question - I guess - can be explained like that​ :
I would like to define

   -

   ​f(x) = 2*x if x>0
    -

   f(x) = 3*x if x<=0.

Thus, basically, I would like to write


ex MyEx = (x<=0)?3*x:2*x

To my best knowledge, boolean expression are not handled in GiNaC, isn’t it
?

all the best,

Vincent H.
​
-- 
Docteur Ingénieur de recherche
CeMoSiS <http://www.cemosis.fr> - vincent.huber at cemosis.fr
Tel: +33 (0)3 68 8*5 02 06*
IRMA - 7, rue René Descartes
67 000 Strasbourg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cebix.net/pipermail/ginac-list/attachments/20150422/676bad92/attachment.html>


More information about the GiNaC-list mailing list