2

我需要在 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)

我想实现它的方法是定义一个继承自functionClass 的新类。也许应该_latex附加方法名称。

有任何想法吗?

提前致谢,

克里斯

4

1 回答 1

1

function如果您正在计划更有趣的事情,您绝对不想使用。看看实现新符号函数的技巧是否符合您的需要(尽管这可能是矫枉过正)。是的,您肯定想要具有乳胶属性/方法的东西。

于 2016-12-01T14:10:21.257 回答