简体   繁体   中英

Write function exponential in python

I want to get the derivative of this 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.

Could someone tell me how to express it correctly in 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. Derivative((745*(1-e(-x/10))-49*x),x, 1).doit() is the right way.

And the right answer is -49 + 149*exp(-x/10)/2 according to this .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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