The usage of Scipy module in Python

文章介绍了如何在命令行中使用pip安装scipy库,并在PyCharm中配置环境变量。接着展示了如何利用scipy进行定积分和微分的计算,例如计算x^3在(0,4)的积分。此外,还引入了numpy库来处理数学表达式,结合scipy实现更复杂的积分运算,如e^x在(0,3)的积分。
摘要由CSDN通过智能技术生成

At first , open the cmd and enter "pip install scipy";

 After the successful installation of the scipy , don't forget to configure the environment variable .

The configuration process: Pycharm->"File"->"Settings"->"Project:Desktop"->"Python Intepreter"->the setting-like button->"Add"->"Existing Environment"->the Ellipsis0-select the "python.exe"->"OK". 

And now we can capitalize on the module scipy to caculate the definite integrations or the differentials .  


Here is an example to caculate ∫(x^3)dx . x∈(0,4) .

from scipy import integrate;
y=lambda x:x**3;
result=integrate.quad(y,0,4);
print(result);


And here , we import the module numpy to capitalize on some mathematic expressions. Combined with the scipy we can realize some relatively complex integral caculations .     

import numpy as np;
from scipy import integrate;
y=lambda x:np.exp(x); # It means y=f(x),f(x)=e^(x);
result=integrate.quad(y,0,3); #It means that ∫ydx,the Integral interval is (0,3);
print(result);


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值