Skip to main content

All Questions

0 votes
0 answers
190 views

Continued fraction with python

How to find the terminating value of the continued fractions S=3−2/(3−2/(3−2/(... by writing a recurrence relation in Python? (Start from any guess value other than 1.)
Lusypher's user avatar
1 vote
0 answers
204 views

How can I optimize my nth order derivative program for all orders?

I am trying to write a program to print the nth order derivative of any function. The approach I am using is calculating the coefficients of a Lagrange polynomial of the function by inverting the ...
Manas Dogra's user avatar
2 votes
3 answers
4k views

Using scipy.fsolve on a matrix

Following the help I was given here I've been trying to implement it in my script but I'm failing at running it smartly. I need to use this algorithm for each pixel of a 4072x3080 image, this takes ...
suxdavide's user avatar
  • 133
2 votes
1 answer
839 views

Finding the solution of a summation of exponentials

I'm trying to solve numerically this equation in Python (numpy/scipy, everything is available) In this formula K is a constant, f and g are two terms those depends on the E counter (this is a discrete ...
suxdavide's user avatar
  • 133
0 votes
1 answer
934 views

Euler method approximation is too accurate

I'm trying to code Euler's approximation method to solve the harmonic oscillator problem, and then compare it on a plot with the exact solution. However, I'm finding that my approximation seems to be ...
curious_cosmo's user avatar
0 votes
1 answer
1k views

ImportError: No module named error

In Numerical Methods in Engineering with Python, 2nd Edition, Author: Jaan Kiusalaas, I wrote the same module found on page 146 that calculates the roots, f(x) = 0, using the bisection method: from ...
sam's user avatar
  • 15
0 votes
0 answers
535 views

python numpy.libalg.eigh() returns wrong eigen vectors. why?

For a brief info, I was tasked to model a wave function for a quantum particle imprisoned in a parabolic potential (this problem is related to quantum harmonic oscillator). I used matrix method for ...
rodrykbyk's user avatar
  • 105
0 votes
2 answers
180 views

Create a function that accepts an expression as an input in python

I am busy just doing some code on the bisection method. It is easy of course to just write the script and run it. However, the trick comes in when I want to define a function that will take an ...
user avatar
0 votes
1 answer
2k views

singular matrix in python implementation of newton-raphson method

I've written a code in python which implements the Newton-Raphson method to solve multiple nonlinear equations. The specific question I've taken is from Mark Newman's - Computational Physics, ...
Kartik Krishna's user avatar
0 votes
2 answers
138 views

Move from an array of 'labels' to array of equations corresponding to those labels in Python 2.7

How can I efficiently move from an array of essentially labels to equations corresponding to those labels in python 2.7? This image illustrates what I mean: The equations pull values from array x, so ...
Tom Stockman's user avatar
1 vote
1 answer
5k views

Implementing Euler's Method in python to solve ODE

I am working on a little science project to simulate a mechanical system with ODE (Ordinary Differential Equation). I would like to use Euler's Method to do so, however I believe that I am doing ...
Zwierzak's user avatar
  • 686
2 votes
1 answer
599 views

Need help fixing my implementation of RK4

I'd appreciate it if someone more experienced on implementation would help me to spot my logical flaw in my current code. For the past couple of hours I've been stuck with the implementation and ...
Spaced's user avatar
  • 231
0 votes
4 answers
789 views

Having problems with user input function with Python 2.7 and couldn't get those input to work with program

I'm very new to python world though I've done a lot with php... and here's my case... I'm writing some code for my little program with python 2.7. In that program, I need to take 2 user input, both of ...
user1947735's user avatar