A general purpose high-level programming language that emphasizes ease of code syntax and readability.
3
votes
1answer
33 views
plotting a 2D animated data surface on MatPlotLib
I'm trying to get an animated 2D data surface on MatPlotLib. After a bit of search on the internet, i've found an example that almost works:
...
1
vote
0answers
78 views
Newton Iteration method convergence
I wrote a Python code which solves a second degree nonlinear equation with two boundary condition using the Newton iteration method. Even this code seems to converging, I am not getting a solution, as ...
8
votes
2answers
125 views
Astoundingly large difference when evaulating trigonometric identity with NumPy
According to Wolfram Alpha and the Sage computer algebra system, the following identity holds:
$$
\cos\left(\arctan\left(\frac{l_1-l_2}{d}\right)\right) = \frac{1}{\sqrt{1 + \frac{(l_1-l_2)^2}{d^2}}}
...
3
votes
0answers
24 views
Package for determining power output of windmill shapes?
I'm looking for the best package for doing the following: building a 3D model (or loading externally) of a non-standard windmill shape, simulating an airflow over the model, and determining the ...
3
votes
1answer
27 views
SciPy interpolation with Univariate Splines
I have coded a routine for interpolation with B-splines, only to discover later that this functionality is already included in Python's SciPy.
However, I do not understand one parameter in the SciPy ...
4
votes
2answers
112 views
F2Py with allocatable and assumed shape arrays
I would like to use f2py with modern Fortran. In particular I'm trying to get the following basic example to work. This is the smallest useful example I could ...
8
votes
1answer
94 views
Why does SciPy eigsh() produce erroneous eigenvalues in case of harmonic oscillator?
I'm developing some larger code to perform eigenvalue computations of huge sparse matrices, in the context of computational physics. I test my routines against the simple harmonic oscillator in one ...
1
vote
2answers
95 views
Solver error in SciPy/LSODA with a very specific parameter set
I'm implementing a very simple Susceptible-Infected-Recovered model with a steady population for an idle side project - normally a pretty trivial task. But I'm running into solver errors using either ...
2
votes
1answer
47 views
python numpy print array(x,y,z) as (x by y) by z?
Printing photo matrices (x,y,z) where z is 0:2 colour, I want to see (x in rows, y in columns) 3 times, once for each colour (the way I've been taught by every mathematician). By default, numpy does ...
6
votes
1answer
103 views
Schroedinger/Diffusion equation with Crank-Nicolson in Python/SciPy
I tried to make the question as detailed as possible. I have an extremely simple solver written for the Schroedinger equation but with imaginary time, which transforms it basically into the diffusion ...
13
votes
0answers
124 views
How does the performance of Python/Numpy array operations scale with increasing array dimensions?
How do Python/Numpy arrays scale with increasing array dimensions?
This is based on some behaviour I noticed while benchmarking Python code for this question: How to express this complicated ...
3
votes
1answer
42 views
TypeError from scipy.optimize.curve_fit
I am trying to fit a data set to an exponential model using scipy. However, the covariance matrix that is returned is 'inf' and I receive the following error:
Traceback (most recent call last):
...
5
votes
2answers
95 views
Rearrange an ordinary matrix to block diagonal form
Is there an algorithm to rearrange a matrix into block diagonal form, given that the matrix is block diagonal in nature but randomized with an unwise choice of basis?
In particular, are there any ...
8
votes
2answers
207 views
How to express this complicated expression using numpy slices
I wish to implement the following expression in Python:
$$
x_i = \sum_{j=1}^{i-1}k_{i-j,j}a_{i-j}a_j,
$$
where $x$ and $y$ are numpy arrays of size $n$, and $k$ is a numpy array of size $n\times n$. ...
8
votes
1answer
152 views
Numerical integration for modelling curve for superconductors (Python)
I am a physicist who is trying to model the current-voltage characteristics of a superconductor-superconductor junction.
The equation for this model is:
\begin{align}
I(V) = ...