简体   繁体   English

将 function 指数写入 python

[英]Write function exponential in python

I want to get the derivative of this function Function我想得到这个 function Function的衍生物

This is how i write it in the code but it gave me this这就是我在代码中编写它的方式,但它给了我这个

745*(1-e(-x/10)-49*x Derivate with python so I guess I wrote it wrong, since I manually did it and it gave me another result. 745*(1-e(-x/10)-49*x Derivate with python所以我想我写错了,因为我手动完成了它,它给了我另一个结果。

Could someone tell me how to express it correctly in python?有人能告诉我如何在 python 中正确表达吗?

This is my code这是我的代码

from sympy.interactive import printing
from sympy import Derivative, diff, simplify, Symbol
from sympy import exp as e
printing.init_printing(use_latex="mathjax")

"Calculo de la primera derivada de f"

x = Symbol ('x')
Derivative(745*(1-e(-x/10)-49*x),x, 1).doit()

Like Ritwik said, you have added the brackets incorrectly, and that is why you are getting an incorrect answer.就像Ritwik所说,您错误地添加了括号,这就是您得到错误答案的原因。 Derivative((745*(1-e(-x/10))-49*x),x, 1).doit() is the right way. Derivative((745*(1-e(-x/10))-49*x),x, 1).doit()是正确的方法。

And the right answer is -49 + 149*exp(-x/10)/2 according to this .正确答案是 -49 + 149*exp(-x/10)/2 根据this

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM