【Python问题】contains an element of the set of generators.

简介: 【Python问题】contains an element of the set of generators.

问题描述

求积分时如下

print(float(integrate(sympy.log(x, math.e), (x, a, b))))

报错:
contains an element of the set of generators.'

解决办法

在函数表达式前添加nsimplify,如下

print(float(integrate(nsimplify(sympy.log(x, math.e)), (x, a, b))))

参考:github上的解答

目录
相关文章
|
1月前
|
Python
python中的map(function, iterable...)
【4月更文挑战第4天】`map()`是Python内置函数,用于对一个或多个可迭代对象的每个元素应用指定函数,返回一个迭代器。基本语法是`map(function, iterable, ...)`。示例中,定义函数`multiply_by_two(x)`将元素乘以2,`map()`将此函数应用于列表`numbers`,返回迭代器`doubled_numbers`,需通过`list()`转为列表显示结果,输出为[2, 4, 6, 8, 10]。注意,`map()`返回的是迭代器而非列表。
13 0
python中的map(function, iterable...)
|
2月前
|
Python
gyp ERR! stack Error: Can‘t find Python executable “python“, you can set the PYTHON env variable.
gyp ERR! stack Error: Can‘t find Python executable “python“, you can set the PYTHON env variable.
42 1
|
4月前
Python-set()
Python-set()
18 0
|
7月前
|
开发者 Python
Python 集合(Sets)3
在 Python 中,有几种方法可以合并两个或多个集合。您可以使用`union()`方法,该方法返回一个包含两个集合中所有项的新集合,或使用`update()`方法,将一个集合中的所有项插入另一个集合中: 示例,`union()`方法返回一个包含两个集合中所有项的新集合:
50 0
|
7月前
|
开发者 索引 Python
Python 集合(Sets)2
您无法通过引用索引或键来访问集合中的项。但是,您可以使用`for`循环遍历集合项,或者使用`in`关键字检查集合中是否存在指定的值。 示例,遍历集合并打印值:
46 0
|
7月前
|
存储 开发者 索引
Python 集合(Sets)1
集合用于在单个变量中存储多个项。集合是 Python 中的 4 种内置数据类型之一,用于存储数据集合,其他 3 种是列表(List)、元组(Tuple)和字典(Dictionary),它们都具有不同的特性和用途。集合是一种无序、不可更改(*)、无索引的集合。
67 0
|
10月前
|
索引 Python
Python中list和dict的详细用法
Python中list和dict的详细用法
97 0
|
10月前
|
Python 容器
python中dict的详细用法以及set集合使用
python中dict的详细用法以及set集合使用
146 0
|
11月前
|
Python
Python|函数list和set
Python|函数list和set
75 0