python、Matlab求定积分的实现

作者:laagyzz 时间:2021-08-25 15:43:28 

python求定积分

计算

python、Matlab求定积分的实现


from sympy import *
x = symbols('x')
print(integrate(sin(2*x)/(1+x**2), (x, 0, 3)))

sympy库中integrate函数


integrate(f, (x, lower_bound, upper_bound))
# f-函数,x-变量,lower_bound-下限,upper_bound-上限

但是发现求不出来,如果是sin(2*x)就可以,为什么?

matlab求定积分


syms x
f = sin(2*x)/(1+x^2)
int(f, x, 0, 3)

或者:


syms x
f = @(x) sin(2*x)/(1+x^2) #句柄
integral(f, 0, 3)

同样得到的是要么是化简之后的结果,要么报错,说明这个函数不可能得到理论解。

来源:https://blog.csdn.net/laagyzz/article/details/85057012

标签:python,Matlab,定积分
0
投稿

猜你喜欢

  • Python的信号库Blinker用法详解

    2021-06-23 23:23:19
  • Python+selenium 获取一组元素属性值的实例

    2021-06-06 02:28:27
  • 500行代码使用python写个微信小游戏飞机大战游戏

    2023-01-16 06:58:09
  • 使用Django实现商城验证码模块的方法

    2023-11-04 04:46:23
  • Python爬取国外天气预报网站的方法

    2022-02-22 00:39:07
  • python合并已经存在的sheet数据到新sheet的方法

    2023-07-25 18:05:51
  • 深入透析样式表滤镜(下)

    2011-06-14 09:49:19
  • python实现从pdf文件中提取文本,并自动翻译的方法

    2021-06-08 18:55:56
  • 基于Python实现简易文档格式转换器

    2021-12-12 14:32:31
  • Mootools 1.2教程(2)——DOM选择器

    2008-11-13 12:46:00
  • SQL Server 1069错误(由于登录失败而无法启动服务)解决方法

    2008-09-12 17:35:00
  • python3实现字符串的全排列的方法(无重复字符)

    2022-04-14 19:47:56
  • asp如何制作一个简单的翻页程序?

    2010-06-29 21:26:00
  • 什么是Python变量作用域

    2021-12-25 21:36:24
  • 全新极速CSS选择器引擎whiz

    2009-08-30 15:48:00
  • Pandas 同元素多列去重的实例

    2023-02-09 21:03:32
  • python多线程抓取天涯帖子内容示例

    2021-03-18 11:56:42
  • 优雅地扩大链接响应区域

    2010-09-25 13:04:00
  • PDO::errorCode讲解

    2023-06-08 03:39:17
  • pytorch索引查找 index_select的例子

    2023-09-12 20:45:05
  • asp之家 网络编程 m.aspxhome.com