LoginSignup
1
0

More than 5 years have passed since last update.

sympyで「コンピューターでの微分」を参考にした

Last updated at Posted at 2017-06-08

(参考)「コンピューターでの微分」
http://qiita.com/namitop/items/55536bbbd5f92d18b2a0

from sympy import *
var('x')
y=0.01*x**2 + 0.1*x
yd=diff(y,x)
print(type(y),y)
print(type(yd),yd)
input={x:5}
print(yd.subs(input))
input={x:10}
print(yd.subs(input))
print('-----------------------------')
print(diff(0.01*x**2+0.1*x).subs([(x, 5)]))
print(diff(0.01*x**2+0.1*x).subs([(x,10)]))

# <class 'sympy.core.add.Add'> 0.01*x**2 + 0.1*x
# <class 'sympy.core.add.Add'> 0.02*x + 0.1
# 0.200000000000000
# 0.300000000000000
# 0.200000000000000
# 0.300000000000000

--------------
【補足】(2017/06/12)リンクが途中で切れています。
(参考)Wolfram|Alpha: Computational Knowledge Engine>derivative 0.01*x*2 + 0.1*x
http://www.wolframalpha.com/input/?i=derivative+0.01*x
2+%2B+0.1*x
0.1 + 0.02 x
(参考)Wolfram|Alpha: Computational Knowledge Engine>derivative 0.01*x
2 + 0.1*x,x=5
http://www.wolframalpha.com/input/?i=derivative+0.01*x
2+%2B+0.1*x,x%3D5
0.2
(参考)Wolfram|Alpha: Computational Knowledge Engine>derivative 0.01*x
2 + 0.1*x,x=10
http://www.wolframalpha.com/input/?i=derivative+0.01*x
*2+%2B+0.1*x,x%3D10
0.3

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0