A general purpose high-level programming language that emphasizes ease of code syntax and readability.

learn more… | top users | synonyms

0
votes
0answers
13 views

How to run a paraview Python code using pvbatch or pv python [migrated]

I am trying to run this Python file using pvpython [filename].py ...
3
votes
0answers
28 views

2D Poisson Solver for Taylor Green Vortex Problem

I am trying to write a 2D Navier Stokes solver using an RK3 for time advancement in python. For debugging, I have converted the RK3 to an Euler step for simplicity. Checking my divergence for my ...
1
vote
1answer
42 views

interactive mode vs animation - python [on hold]

Is it better matplotlib interactive mode or matplotlib animation in terms of performance? I have a continous flow of data coming from the serial port. I get 2 measures let's say var1 and var2. I ...
0
votes
0answers
14 views

Generate KDE plot with scipy gaussian_kde

I would like to generate a plot of the density of a set of data, and compare to a scatterplot of individual data points. My first plot is generated with: ...
1
vote
2answers
161 views

Python, numpy and complex functions (PDE's)

Update 4 I have almost given up on getting this right. This is the solution to the time-independent Schrodinger's equation, so the analytical solution is: $\psi(x,t) = \psi(x,0)e^{\frac{-iE ...
3
votes
1answer
113 views

Software for triangulating a point set (with restrictions)

I want to triangulate a point-set like the one below. I would like the triangulation of the point-set to have the following properties The triangles must have as vertices the black and orange ...
2
votes
0answers
32 views

Iteratively finding both left and right eigenvectors for non-symmetric complex matrix

I have a complex, non-Hermitian matrix $\mathbf{A}$, for which I need to find a few eigenvalues and eigenvectors in the generalised eigenvalue problem: $$\mathbf{A}\cdot \mathbf{x} = \lambda ...
0
votes
1answer
50 views

Scipy min warning meanings?

What does "Desired error not necessarily achieved due to precision loss" mean in the context of the scipy_fmin methods? I can't ...
1
vote
1answer
210 views

What is the preferred and efficient approach for interpolating multidimensional data?

What is the preferred and efficient approach for interpolating multidimensional data? Things I'm worried about: performance for construction, single/batch evaluation handling dimensions from 1 to 6 ...
0
votes
1answer
63 views

Python plotting a function [closed]

Hi I am new to Python and I am using version 2.7. I came across a problem which requires me to plot a function: $$f(z) =\frac{z^3}{(1-z)^5 ...
1
vote
0answers
20 views

Using HMM for speech synthesis [closed]

I am trying to make a speech synthesizer using a Hidden Markov Model. I read the wikipedia page and several whitepapers and presentations (such as this one) but I am still not sure how this algorithm ...
0
votes
1answer
52 views

Mathematical error when attempting to represent step function using fourier series

I am attempting to work through a very simple problem. Determine the Fourier series expansion for the following heat PDE problem with ICS and BCS: $$ u_{t} = \alpha^2u_{xx}$$ $$ u(0, t) = u(L, t) ...
0
votes
0answers
81 views

Gonzalez algorithm

I'm getting confused about implementing the Gonzalez algorithm for k-center clustering. The algorithm is : let $S$ be a data set Choose $z_1 \in S$ arbitrarily. Number $z$ is center. (In general ...
0
votes
0answers
40 views

Extrapolating a function with increasing slope

I want to extrapolate data for a set of function values on a regular grid. To test different extrapolation routines, I decided sample data from a function, which I believe is the closest known ...
3
votes
2answers
433 views

literature on scientific computing

Maybe, this is a dump question. But anyway. I developed a finite difference code for a class of problems in dynamo theory. I used GNU Octave (MATLAB) which is good for testing. The problem size ...
0
votes
2answers
149 views

How to obtain a convergent solution iteratively for a linear system of equations? [on hold]

I am working on a problem that requires an iterative procedure to solve a linear system of equations, the system of equations in matrix form is: $$\underbrace{\begin{bmatrix} r_{11} & r_{12} ...
4
votes
1answer
86 views

How to evaluate a series of derivatives?

Consider the function $$f(\mathbf{x}) = \sum_{n=0}^{N} a_n \left( (\mathbf{b}-\mathbf{x})\cdot \nabla \right)^n \frac{1}{r}$$ where $r = |\mathbf{x}| = \sqrt{(x-x_0)^2 + (y-y_0)^2}$ and $a_n$ and ...
0
votes
0answers
35 views

Phylogenetics in Python 3

I'm looking for a package supported in python 3, which would perform well in visualizing, manipulating and analyzing phylogenetic trees. Since Bio.Phylo isn't very good at this, I looked into ETE2 and ...
0
votes
1answer
77 views

Temperature dependent 1-d conduction in Python?

I'm trying to write a Python code that is a numerical solver for 1-d heat conduction (using FVM) with a temperature dependent thermal conductivity. The solver has three functions I need to iterate ...
2
votes
1answer
101 views

optimization (using python) how to find the most suitable solver?

I have a fitting routine set up. It works, but pretty slow. I was wondering if there is a better method to use. I checked my (forward) code against some literature data and at least I do have no bugs ...
0
votes
1answer
73 views

What Python libraries do I need to do computational physics? [closed]

I need to install Python to do some undergraduate level computational physics (course, not research). What library do I need? Scipy only?
4
votes
2answers
65 views

Computation of multipole expansion of potential not converging

According to Beatson and Greengard's short course on FMM: ( Eq. 5.15 & 5.16 setting k=1, q=1 ) We can approximate a potential $\phi = 1/(r-R)$ using: $$ {1\over |\vec{r}-\vec{R}|} = ...
0
votes
0answers
74 views

Python: Boundary constraint issue with Scipy.optimize

It seems that I have an issue with my boundary conditions when I use the function [fmin_l_bfgs_b][1]. ...
1
vote
0answers
144 views

Stationary 2D/3D Navier-Stokes source code

Trying to solve stationary Navier-Stokes problem for incompressible laminar Newtonian fluid. I've found a couple solutions for instationary Navier-Stokes equations (like FeniCS examples or CFD ...
0
votes
0answers
83 views

Solving 10000, Non-Linear, Simultaneous Equations

Could anyone let me know if there is any optimization solver that I can use to solve about 10,000 simultaneous equations (most of which are non-linear) using Python? Please also advise if it is ...
3
votes
2answers
177 views

Dynamically ending ODE integration in SciPy

I have a light ray moving through space-time, i.e. a curve in R⁴, parametrized by some variable λ. The exact trajectory, i.e. the coordinate functions $x^μ(λ)$ of the curve are given by some ODE ...
1
vote
1answer
177 views

How to write a function-generating code in Python/MATLAB?

I want to write a code that generates a function I(t) that satisfies the following condition: $\frac{\big<I(t)^2\big>}{\big<I(t)\big>^2} > 2$ In other words, $\frac{\lim_{T \to ...
2
votes
0answers
67 views

4th order tensor [closed]

I'm new with FEniCS and Python and I'm stuck with this issue: is there a way to write a 4th order tensor in an easy way to implement? I have to compute the following stiffnes tensor: $A_{ijkl}= ...
5
votes
1answer
264 views

Numerical evaluation of an elliptic integral in python

Goal: I need to evaluate numerically an integral of the following form: $$ \int_0^\infty \frac{dx}{(a^2+x)\sqrt{(a^2+x)(b^2+x)(c^2+x)}} $$ where $a,b,c \in \mathbb{R}$ are in the interval ...
4
votes
0answers
306 views

Why does Matlab's integral outperform integrate.quad in Scipy?

I am experiencing some frustration over the way matlab handles numerical integration vs. Scipy. I observe the following differences in my test code below: Matlab's version runs on average 24 times ...
1
vote
1answer
131 views

Matlab equivalent of scipy's 'vode' and 'zvode' ode routines

In python I have used the ode method from scipy.integrate. There I used the vodeintegrator ...
2
votes
1answer
217 views

Solving Advection (Convection) - Diffusion - Reaction Partial Differential Equation in Python

I am looking for library written in Python which will enable me to solve the coupled nonlinear equations which looks like: I need the library which will enable me to couple this solver to other ...
11
votes
1answer
901 views

How to avoid catastrophic cancellation in python function?

I am having trouble implementing a function numerically. It suffers from the fact that at large input values the result is a very large number times a very small number. I am not sure if catastrophic ...
2
votes
2answers
271 views

Why does scipy's odeint function give a non-monotonic solution for a problem whose solution should be monotone?

The solution to the ode below looks like it is monotonically increasing: However on closer inspection we see that it is not: How can I ensure that the numerical solution is monotonically ...
1
vote
1answer
86 views

How to deal with indeterminate function limit?

How do I ensure that my function below is well conditioned as $s$ approaches $\infty$? The problem I get is that for large $s$ the function returns an indeterminate form $\frac{0}{0}$. I would ...
0
votes
0answers
104 views

Laplacian of Gaussian (LOG) for Edge Detection

The LOG is determined by the following function as given in this http://homepages.inf.ed.ac.uk/rbf/HIPR2/log.htm. I used Excel and also python to get the LOG kernel. But surprisingly my kernel values ...
0
votes
0answers
496 views

Using scipy.quad to calculate difficult integral

When evaluating the integral below in python using scipy.quad I get the following warning: UserWarning: The maximum number of subdivisions (50) has been achieved. If increasing the limit yields no ...
2
votes
2answers
141 views

How to implement Gauss-Laguerre Quadrature in Python?

To get the hang of Gauss-Laguerre integration I have decided to calculate the following integral numerically, which can be compared to the known analytical solution: \begin{align} \int_0^{\infty} ...
2
votes
1answer
440 views

Is there a Gauss-Laguerre integration routine in Python?

I am reading the book "Numerical Recipes in Fortran 77: The Art of Scientific Computing" (Second Edition) and I came across some methods for numerical integration of 1D functions. More specifically ...
2
votes
2answers
232 views

How to generate a rotated (by 90 degrees) logistic sigmoid function in Python

I created this Python function to generate a sigmoid function where I can modify position and width: ...
3
votes
1answer
221 views

Numerically solve a PDE in Python with a term calculated by coarse-graining

I'm trying to solve a PDE in Python of the form, $\dfrac{\partial c(\mathbf{x}, t)}{\partial t} = \mathrm{D} \nabla^2 c(\mathbf{x}, t) -\gamma \rho(\mathbf{x}, t) c(\mathbf{x}, t)$ where $c$ ...
0
votes
1answer
89 views

How can I use Scipy to fit data generated from a C++ model?

I currently have a functioning and blazing fast model written in C++ and CUDA. However, I'd like to use Scipy.minimize to fit the model to some experimental data. I was hoping it would be easy, but ...
1
vote
1answer
59 views

Speedier alternative to “skimage.morphology._pnpoly import points_inside_poly”?

I am using scikit-image's points_inside_poly function, and in my code I am calling it enough times that it takes up about 50% of ...
0
votes
1answer
126 views

Python: Computation time Issue with mpi4py

I am using in Python mpi4py to process in parallel 20 minimization functions. Each of the 20 worker processes the same algorithm but with different random initial ...
2
votes
1answer
278 views

Unwrap cylinder to plane in Paraview

I want to extract the data from the boundary surface of a cylinder (in a .vtu file) and plot it onto a plane, where the coordinates are theta (rotation angle) and ...
1
vote
2answers
179 views

Maximum function evaluation with NLOPT in Python

I am having an issue with the implementation of NLOPT in Python. My objective is to minimize a somewhat complicated Maximum Likelihood function. My function is called mle and there are 6 parameters ...
4
votes
4answers
95 views

Measurement error library

Is there a python library that would keep track of uncertainty in measured data? i.e. if I put in a figure of a±b is there an easy way to track the propagation of error through calculations.
4
votes
2answers
230 views

Line Integral Convolution (LIC) Requirements

I'm trying to plot some vector fields using LIC technique. More specifically, I'm using the Python solution for this kind of plot. Before applying that approach, I was plotting my vectors as quiver. ...
2
votes
2answers
150 views

Parametric spectrum estimation using aryule: difference between Python and Matlab

I have some code illustrating my problem below. As you can see from the results- Matlab is significantly faster than python. It seems that the function which performs the levinson durbin recursion in ...
0
votes
0answers
51 views

Principal Components Analysis Not Behaving as I Expect it to

I have a bunch of points in $\mathbb{R}^3$ that I would like to translate and rotate so that their center is at the origin and the variance along the $x$ and $y$ axes are maximal (greedy, and in that ...