I am not familiar with Python and do not know what the error is and how to resolve it.
Does this mean that the called kv does not support integration?
source code
import numpy as np
import pandas aspd
import matplotlib.pyplot asplt
import scipy.
from scipy.special import kv
from sympy import*
from scope.integrate import quad
z = Symbol ('z')
v=5/3
y=quad(f(v,z),(z,x,np.inf))
F=x*y
plot((F), (x, 0, 10), title='test', xlabel='x', ylabel='F')
error message
TypeError Traceback (most recent call last)
<ipython-input-9-8f89c7044d48>in<module>
9z = Symbol ('z')
10 v = 5/3
--->11y=quad(f(v,z),(z,x,np.inf))
12 F = x*y
13plot((F), (x, 0, 10), title='test', xlabel='x', ylabel='F')
TypeError: ufunc 'kv' not supported for the input types, and the inputs could not be safely engaged to any supported types recording to the casting rule' 'safe'"
Distinguish between sympy and scipy libraries, where sympy is the library for symbolic calculations and scipy is the library for numerical calculations.Each has a different algorithm used internally.Basically, you can't live together as you are.
This program is probably running on Jypter Notebook software, and the program in the questionnaire is incomplete.Specifically, the function f
is not defined.However, the results show that the f
evaluation was successful.Perhaps you have removed something defined in another cell or have not reset it once.
The error ufunc'kv' not supported for the input types
is probably related to the definition of this function f
. Are you using the function kv
in the definition of f
? This import statement is probably kv
.kvial>The error "An unsupported type of value has been passed to the argument" appears because it passes the data used to calculate the symbol for the sympy to a function where a specific number is expected to be passed to the argument.
If you want to do the integration symbol calculation, why don't you first read the integration document for sympy: https://docs.sympy.org/latest/modules/integrals/integrals.html, and depending on the content of f
, functions such as sympy.lambdify
may be useful: https://docs.sympy.org/latest/modules/numeric-computation.html.
If you're not looking to do an integration numerical calculation, the implementation examples in the integration documentation for the scipy library may help: https://docs.scipy.org/doc/scipy/reference/tutorial/integrate.html.
© 2024 OneMinuteCode. All rights reserved.