I am using OdePkg in Octave to solve a system of stiff ODEs, e.g. by ode5r:
function yprime = myODEs(t,Y,param)
yprime = [
- param(1) * Y(1); # ODE for Y(1)
param(1) * Y(1) - param(2) Y(2) * Y(3); # ODE for Y(2)
param(2) Y(2) * Y(3) # ODE for Y(3)
...
Hi,
I need to calculate the inverse of complementary error function (erfc^(1))for a problem.
I was looking into python tools for it and many threads said Enthought has most of the
math tools needed, so I downloaded and installed in my local user account. But I am not
very sure about how to use it?
Any ideas?
Thanks
...
Good day coders and codereses,
I am writing a piece of code that goes through a pile of statistical data and returns what I ask from it. To complete its task the method reads from one multidimensional array and writes into another one. The piece of code giving me problems is:
writer.variables[variable][:, :, :, :] = reader.variables[va...
Hi,
I am trying to optimize a function using l_bfgs constraint optimization routine in scipy.
But the optimization routine passes values to the function, which are not with in the Bounds.
my full code looks like,
def humpy(aParams):
aParams = numpy.asarray(aParams)
print aParams
####
# connect to some other software for simulation...
I'm trying to create a simple probability density function(pdf) graph using data from one column of a csv file using csv dictreader, matplotlib and numpy...
Is there an easy way to use CSV DictReader combined with numpy arrays? Below is code that doesn't work. The error message is TypeError: len() of unsized object, which I'm guessing ...
Hi!
From scipy I am using the interpolate.splrep and interpolate.splev functions to get interpolate my data set. Unsurprisingly, this does not work very well if I try to get an interpolated value near the edges of the data set.
I came up with a workaround (extending the data set by two additional entries which have the same value as th...
I use Python 2.5.
I am passing bounds to the cobyla optimisation:
import numpy
from numpy import asarray
Initial = numpy.asarray [2, 4, 5, 3] # Initial values to start with
#bounding limits (lower,upper) - for visualizing
#bounds = [(1, 5000), (1, 6000), (2, 100000), (1, 50000)]
# actual passed bounds
b1 = lambda x: 5000 ...
Since an assignment problem can be posed in the form of a single matrix, I am wandering if numpy has a function to solve such a matrix. So far I have found none. Maybe one of you guys know if numpy/scipy has an assignment-problem-solve function?
Edit: In the meanwhile I have found a python (not numpy/scipy) implementation at http://www....
Hi all,
I face a problem in scipy 'leastsq' optimisation routine, if i execute the following program it says
raise errors[info][1], errors[info][0]
TypeError: Improper input parameters.
and sometimes index out of range for an array...
from scipy import *
import numpy
from scipy import optimize
from numpy import asarray
from math...
import numpy
from numpy import asarray
Initial = numpy.asarray [2.0, 4.0, 5.0, 3.0, 5.0, 6.0] # Initial values to start with
bounds = [(1, 5000), (1, 6000), (2, 100000), (1, 50000), (1.0, 5000), (2, 1000000)]
# actual passed bounds
b1 = lambda x: numpy.asarray([1.4*x[0] - x[0]])
b2 = lambda x: numpy.asarray([1.4*x[1] - x[1...
I am trying to fit a step function using scipy.optimize.leastsq. Consider the following example:
import numpy as np
from scipy.optimize import leastsq
def fitfunc(p, x):
y = np.zeros(x.shape)
y[x < p[0]] = p[1]
y[p[0] < x] = p[2]
return y
errfunc = lambda p, x, y: fitfunc(p, x) - y # Distance to the target function
x ...
How do I install SciPy on my system?
Update 1: for the NumPy part (that SciPy depends on) there is actually an installer for 64 bit Windows: numpy-1.3.0.win-amd64-py2.6.msi (is direct download URL, 2310144 bytes).
Running the SciPy superpack installer results in this
message in a dialog box:
"Cannot install. Python version 2.6 require...
I have a problem installing Numpy and Scipy from
http://www.scipy.org/Installing%5FSciPy/Windows
I went to download page and downloaded .exe files for Python26. I have Python26 on my machine. After installation, I tried
>>> import nympy, scipy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No modu...
Suppose I have a integer matrix which represents who has emailed whom and how many times. For social network analysis I'd like to make a simple undirected graph. So I need to convert the matrix to binary matrix and later into a list of tuples.
My question: is there a fast, convenient way to reduce the decimal matrix to a binary matrix. ...
Hi all,
I have a variable exon = [[[1, 2], [3, 4], [5, 6]], [[7, 8], [9, 10]]]. I would like to create a mat file like the following
>>
exon : [3*2 double] [2*2 double]
When I used the python code to do the same it is showing error message. here is my python code
import scipy.io
exon = [[[1, 2], [3, 4], [5, 6]], [[7, 8], [9, 10]]...
I'm trying to compute this:
from scipy import *
3600**3400 * (exp(-3600)) / factorial(3400)
the error: unsupported long and float
...
Short Question:
Lets say, I want to solve Project Euler problem 9 using python and some equation solving libraries.
a + b + c = 1000.
a2 + b2 = c2
How do you do it.
Long Question:
I want to solve a set of equations; linear, sometimes may be quadratic too. Not a specific problem; but often, I have been in situation I wanted to.
I...
Hi, I regularly make figures (the exploratory data analysis type) in R. I also program in Python and was wondering if there are features or concepts in matplotlib that would be worth learning. For instance, I am quite happy with R - but its image() function will produce large files with pixelated output, whereas Matlab's equivalent figur...
I am trying to learn programming in python and am also working against a deadline for setting up a neural network which looks like it's going to feature multidirectional associative memory and recurrent connections among other things. While the mathematics for all these things can be accessed from various texts and sources (and is access...
It seems I can only load everything as uint8 type, just with the following two lines,
import scipy.io
X1=scipy.io.loadmat('one.mat')
all double precision numbers get transformed. I believe the creators of scipy
are aware of the fact that floating-point numbers are much more common...
So, what should I do?
Thank you!
...