我需要在 Sage 中定义一些具有定义属性的函数
- 函数名_
- 它的数学/物理符号
- 函数的定义
- (以及那些组合)
和返回的方法
- LaTeX格式的那些属性
符号和参数输入,然后也是
- 函数对这些参数的结果
一个例子是
>>> 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)
我想实现它的方法是定义一个继承自function
Class 的新类。也许应该_latex
附加方法名称。
有任何想法吗?
提前致谢,
克里斯