# Questions tagged [scipy]

SciPy is a Python-based ecosystem of open-source software for mathematics, science, and engineering.

196 questions
Filter by
Sorted by
Tagged with
1answer
66 views

### Fitting using curve_fit of scipy in python gives totally different answer for 1/t and t

I was trying to fit some data to a single degree exponential decay function but a*exp(-x*t) and a*exp(-x/t) gives completely ...
0answers
29 views

### scipy.optimize.minimize(method=“SLSQP”) does not give the minimal value along its own search path [closed]

I would like to enquire about a situation I encountered while using the scipy function scipy.optimize.minimize(method="SLSQP"). It seems to loose track of the global minimum in the path of ...
0answers
24 views

### Scipy: Sampling a custom distribution

Using Scipy, I would like to draw a random sample according to a certain probability density. The probability density function I consider is defined on the real line and depends on k parameters that I ...
0answers
47 views

### scipy solve_ivp with adaptive solution

I am struggling to understand how scipy.solve_ivp() handles errors in a system of ODE. I have a complex systems of ODE with very large varying time-scales, for which my state "y" is composed ...
1answer
171 views

### Translating the Euler code in scipy's solve_ivp

My code is based on the similarity transformation X=VZ.I simulate the model for transformed equations involving Z by replacing ...
2answers
79 views

### numerical solution for differential equation

I have these 3 equations and i want to solve them with numerical methods. so I am using scipy library but I don't know how to solve 3 equations together. R, g, sigma and density are constants. \begin{...
1answer
87 views

### Error using scipy.integrate.solve_ivp: index error: the index 0 is out of bounds for axis 0 with size 0

I am recently working on the code based on the stick-slip phenomenon in Python. It's the stick-slip oscillator (chapter 3.4) in https://www.sciencedirect.com/science/article/pii/S0888327020301205. And ...
1answer
352 views

3answers
151 views

4answers
20k views

### Plot integral function with scipy and matplotlib

I want to plot a numerical integral function of some function $f$ using scipy and matplotlib. How can I do this? I tried the ...
1answer
322 views

### ODEintWarning: Excess work done on this call (perhaps wrong Dfun type)

I was messing around with some numerical integration functions. I wrote an arbitrary differential equation to test my understanding, the code is as follows: ...
1answer
166 views

### How to compare 2D vector fields and minimize the difference?

I want to compare the field of two electrical currents and compare the resulting field to a magnetic dipol field and find magnetic momentum that minimizes the difference of the two fields. My current ...
1answer
233 views

### Trouble with backwards time integration in Python

I am struggling with a rather basic numerical integration task: Using Python's scipy.integrate.solve_ivp module to integrate an ODE sytem backwards in time. As a test, I am using the following ODE ...
1answer
111 views

### Help with modified bessel functions

I'm trying to parse the following expression (Eq. 35 in The Magnetic Field in the Vicinity of Parallel and Twisted Three-Wire Cable Carrying Balanced Three-Phased Current) in Python and calculate its ...
3answers
5k views

### How are scientific computing workflows faring on Apple's M1 hardware

The initial wave of reviews for Apple's M1 hardware are out, and there's lots of generic benchmarks and data on workflows on professional programs for creative users, but I haven't seen anyone talking ...
1answer
201 views

### User friendly scipy optimize wrapper package?

I'm creating too much throw away code for interfacing with the scipy optimize package in a user friendly way. (See code below for example of interruptible optimization that keeps last optimization ...
1answer
130 views

### Is there a way to bound the values of a variable when using scipy.integrate.solve_ivp in python?

I want to solve an IVP in python with two variables, x and u, but I need the values of u to be between 0 and 1. Right now it is giving me a solution with negative values for u. Here is the code I have....
2answers
592 views

### Computing numeric derivative via FFT - SciPy

I wrote the following code to compute the approximate derivative of a function using FFT: ...
1answer
131 views

0answers
30 views

### Scaling tensor approximation by symmetric tensor decomposition with SciPy's L-BFGS-B

I am trying to approximate a symmetric tensor of which the values are in the range of [1e-7,1e-4], by a symmetric tensor decomposition of lower rank. For this I am using the L-BFGS-B method in SciPy's ...
1answer
86 views

### Odeint error for nonlineal differential equations

I receive the following error when I run the code. ODEintWarning: Excess work done on this call (perhaps wrong Dfun type). Run with full_output = 1 to get quantitative information. warnings.warn(...
2answers
406 views

### Python scipy eigh(Arpack) giving wrong eigenvalues for generalized eigenvalue problem

I am trying to solve a generalized eigenvalue problem using Arpack, right now the code is using LAPACK but that's too slow, we only need a few eigenvalues and the matrices are sparse so using Arpack ...
1answer
141 views

### How to get a more accurate cancelation

I shall try to get to the point, so let me know if there is something left and you need more details. I am solving a couple of equations that are not coupled explicitly, but their corresponding ...
1answer
269 views

### DOP853 integration method is missing (SciPy)

I was checking some integration methods provided by SciPy, in which the DOP853 should be included according to the webpage (https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate....
0answers
28 views