区分功能未知的产品 - sympy [英] Differentiating a product with an unknown function - sympy
本文介绍了区分功能未知的产品 - sympy的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试了各种搜索,但找不到合适的 google 字符串来显示正确的结果.
我有一个形式的产品
y = x*f(x)
其中 f 是 x 的未知函数.我希望 sympy 将 y 与 x 区分开来.有谁知道我怎么能做到这一点?
解决方案
怎么样:
<预><代码>>>>x = sympy.Symbol("x")>>>f = sympy.Function("f")>>>y = x * f(x)>>>是x*f(x)>>>y.diff(x)x*Derivative(f(x), x) + f(x)I tried various searches but couldn't find a good google string to bring up the right results.
I have a product of the form
y = x*f(x)
where f is a function of x which is not known. I want sympy to differentiate y with respect to x. Does anyone know how I can do this?
解决方案
How about:
>>> x = sympy.Symbol("x")
>>> f = sympy.Function("f")
>>> y = x * f(x)
>>> y
x*f(x)
>>> y.diff(x)
x*Derivative(f(x), x) + f(x)
这篇关于区分功能未知的产品 - sympy的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文