Questions tagged [numerical-methods]

Algorithms which solve mathematical problems by means of numerical approximation (as opposed to symbolic computation).

Numerical methods include the study of algorithms that use numerical approximation (as opposed to general symbolic manipulations) for the problems of mathematical analysis (as distinguished from discrete mathematics). Numerical methods naturally find applications in all fields of science and engineering, and include implementations of many important aspects of computation including: solving ordinary and partial differential equations, numerical linear algebra, stochastic differential equations, Markov chains, and so forth.

Numerical methods use several approaches to calculate observables. For example, iterative methods that form successive approximations that converge to the exact solution only in a limit. A convergence test, often involving the residual, is specified in order to decide when a sufficiently accurate solution has (hopefully) been found. Examples include Newton's method, the bisection method, and Jacobi iteration. Another example is the use of discretization, a procedure that is used when continuous problems must sometimes be replaced by a discrete problem whose solution is known to approximate that of the continuous problem.

The field of numerical methods includes many sub-disciplines. Some of the major ones are:

  • Computing values of functions

  • Interpolation, extrapolation, and regression

  • Solving equations and systems of equations

  • Solving eigenvalue or singular value problems

  • Optimization

  • Evaluating integrals

  • Differential equations

2104 questions
0
votes
2 answers

Solving natural convection equations (heat and flow) with the shooting method

TL;DR I've been implementing a python program to solve numerically equations for natural convection based on a particular similarity variable using runge-kutta 4 and the shooting method. However I don't get the right solutions when I plot it. Did I…
0
votes
0 answers

Possible blunders in secant method implementation?

I was asked to code a root finding program which uses the secant method. Although the exercise itself isn't any hard I am passing only 2 of 5 declared examples and I have no idea why. My function looks like this: template bool secant (…
Jakub Sapko
  • 304
  • 2
  • 15
0
votes
0 answers

Coupling a bvp differential equation with two non linear equations in python

I am new to python. I have a system of 3 equations (variables are y1,y2,y3) :- 1. y1+y2=5, 2. d2y3/dx2= (y1/y3)**2, y(0)=y(1)=1, 3. y1= y3*(exp(y2)+exp(-y2)) All the functions y1,y2 and y3 are functions of x in [0,1].The second equation is a…
Anweshan
  • 29
  • 6
0
votes
0 answers

System of non linear differential equation numerical solution

I am trying to solve a system of non-linear differential equations. My system has 15 parameters which I have to estimate, I am using optimization for it. Some of parameters can make my system be stiff and some maybe not. This can make my…
0
votes
1 answer

Stable solution of a 4th order non linear differential equations

I have solved the following bvp problem using bvp solver in python. d4y/dx4= 0.00033*V/(0.000001-y)^(2) , y(0)=y'(0)=y(1)=y'(1)=0 In the above eqn 'V' is a parameter which has been varied using the for loop. The interesting part is that the…
0
votes
1 answer

Unexpected result when solving a system of coupled ode's implicitely

Aiming to solve this system of coupled differential equations: $ frac{dx}{dt} = -y $ $\frac{dy}{dt} = x $ following the below implicit evolution scheme: $$ y(t_{n+1}) = y(t_{n}) + \frac{\Delta t}{2}(x_{old}(t_{n+1}) + x(t_{n})) $$ $$ x(t_{n+1}) = …
0
votes
2 answers

What is the reason for IndexError: list index out of range?

So, my professor asked me to create a program that will use the Runge-Kutta Method (2nd order) to solve the problem. But I get an IndexError: list index out of range which goes back to my first function. I don't completely understand what is the…
0
votes
1 answer

PDE Solving: 'NoneType' has no attribute 'toarray' error

I am learning how to employ finite difference methods in Python, using Poisson's equation as an example. But when I run everything is fine until the A=ASparse.toarray() line of code in the inverse section where I get the error mentioned in the post…
0
votes
2 answers

Passing large time dependent data to solve differential equation in python,

Consider this simple first-order differential equation: Where k is a constant with value 0.5 and is a variable that changes with time. I used the following code to input the values of y_bar at different times which works perfectly. import numpy…
0
votes
0 answers

Multiprocessing simple code for numerical calculations

I need to implement multiprocessing on this code. Basically it makes a grid of nxn data in the using numpy linspace, and enters on a while loop checking a condition on the t parameter. On each run inside the while loop it calculates z for each point…
eulag
  • 11
0
votes
1 answer

Coupled set of equations - Wrong answer from scipy's fsolve

I'm trying to solve the following coupled equations: x = 1; y - 0.5*y - 0.7*v = 0; w - 0.7*x - 0.5*x = 0; v = 1. (I know that the equations = 1 seem unnecessary but I need them for a later generalization of the code). My code is the…
avemaria
  • 5
  • 1
0
votes
0 answers

Solution for 1 D heat conduction with Finite Difference not reducing error with increase in grid points

I am solving 1 D heat conduction equation. #include #include #include void grid(int nx, double xst, double xen, double *x, double *dx) { int i; *dx = (xen-xst)/(double)(nx-1); for(i=0; i
0
votes
2 answers

How do I solve a 2nd order differential equation for projectile motion with air resistance?

the equation is: d^2 r/dt^2 = -c/m (dr/dt)+g where r is the position of the projectile, c is the drag coefficient, m is the mass of the projectile and g is the acceleration due to gravity. Assuming only two-dimensions in component form this, of…
0
votes
0 answers

I have an improvement to a scipy function, but the PR gets no attention. How do I get my change in?

I recently wrote some code to substantially improve the scipy.stats.binom_test method. Basically, the function was creating an array of the size of the inputs and this was causing memory errors when the inputs were of the order of 100 million.…
Rohit Pandey
  • 2,443
  • 7
  • 31
  • 54
0
votes
3 answers

Python multiprocessing gets stuck

I am pretty new to Python and totally new to multiprocessing, I found a few tutorials online to help me understand the multiprocessing package. My code has a set of differential equations using RungeKutta4 method and I need to run tons of…
1 2 3
99
100