I need to define in Sage some functions with attributes that define
- the name of the function
- its mathematical/physical symbol
- the definition of the function
- (and those in combination)
and methods that return
- those attributes in LaTeX format
both symbolic and with parameters input and then also
- the result of the function on those parameters
An example is something like
>>> somefunction.name
\text{some function}
>>> somefunction.symbol
\mathrm{SF}
>>> somefunction.definition
\mathrm{SF} = 3x + y
>>> somefunction(4, 5)
17
>>> somefunction(4, 5).symbol
\mathrm{SF}\left(4, 5\right)
>>> anotherfunction.name
\text{another function}
>>> anotherfunction.symbol
\mathrm{AF}
>>> anotherfunction.definition
\mathrm{AF} = 2z
>>> anotherfunction('SF')
2(3x + y)
I suppose the way of implementing it is by defining a new class that inherits from the function
Class. And perhaps the method names should have _latex
appended.
Any ideas?
Thanks in advance,
Chris