Dear Sage-developers, Let's first take a look at this example
sage: f = 2*cos(1/2) sage: f 2*cos(1/2) sage: f.n() 1.75516512378075 I would like to program something like cos(x) that behaves the same as what I showed above. So I want to program a function F which can interact with RingElements and stays symbolic until I want to evaluate it. Then this function F (always) becomes an element of the Ring so you can multiply, add, etc. So I want to create a class F such that you can so something like this: sage: g = 2*pi*F(1,2,3,4)/3 sage: g 2/3*pi*F(1,2,3,4) sage: g.n() 1.23456789 # or any other element from some arbitrary Ring in which you work I looked at the source code of /sage/functions/trig.py, but cos(x) is using the GinacFunction class to calculate symbolically. Could someone tell me if this thing is possible? If yes, how can you do this. Are there examples in the source code of Sage which I should look up? Best regards, Noud ps. I also want to let it interact with itself! Something like sage: F(1,2,3,4) * F(5,6,7,8) F(9,10,11,12) But it should not directly interact with other RingElements. -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sage-devel?hl=en.
