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
1 answer

Numerically Solving A Multivariate Differential Equation Without odeint

I am curious. I know this can be solved by using odeint, but I'm trying to do it from scratch, and I've encountered an interesting behaviour. Assume a simple oscillator, of equation m * x_ddot + k * x = 0. Wikipedia Initial conditions are x0 !=…
0
votes
0 answers

Negative values obtained in the solution of the 1D advection-dispersion equation using FD method

I am trying to solve the 1D ADE This is my code so far: clc; clear; close all %Input parameters Ao = 1; %Initial value L = 0.08; %Column length [m] nx = 40; %spatial gridpoints dx = L/nx; %Length step size [m] T =…
gary105
  • 49
  • 7
0
votes
0 answers

programming secant method with a table of outputs for each iterations

Im currently learning about numerical methods in my numerical analysis course and wanted to program Secant Method for finding roots of an equation in python I checked different sources for that (for example) and found really helpful codes on this…
0
votes
1 answer

What is a correct way to implement memcpy inside a CUDA kernel?

I am implementing a PDE solver (Lax-Friedrichs) in CUDA that I previously wrote in C. Please find the C code below: void solve(int M, double u[M+3][M+3], double unp1[M+3][M+3], double params[3]){ int i; int j; int n; for (n=0; n
rungekutta
  • 39
  • 5
0
votes
3 answers

IndexError: index x is out of bounds for axis 0 with size x

I am going to plot the velocity function of time, when I have gathered acceleration function of time. However, I get an error code, IndexError: index 51 is out of bounds for axis 0 with size 51, 51 is the last index of my data, as my data is set up…
0
votes
2 answers

Constructing Taylor Series from a Recursive function in Pari-GP

This is a continuation of my questions: Declaring a functional recursive sequence in Matlab Is there a more efficient way of nesting logarithms? Nesting a specific recursion in Pari-GP But I'll keep this question self contained. I have made a coding…
Richard Diagram
  • 209
  • 1
  • 7
0
votes
1 answer

Is there a more efficient way of nesting logarithms?

This is a continuation of the two questions posted here, Declaring a functional recursive sequence in Matlab Nesting a specific recursion in Pari-GP To make a long story short, I've constructed a family of functions which solve the tetration…
Richard Diagram
  • 209
  • 1
  • 7
0
votes
0 answers

How to get the time series of the Duffing oscillator to plot the Poincare section?

I have used the 4th Order Runge-Kutta method in order to estimate the values in which the Duffing Oscillator is chaotic. According to Wikipedia, the Duffing Oscillator is chaotic for values of alpha =1, beta = 5, delta = 0.02, gamma= 8 and omega =…
James
  • 27
  • 5
0
votes
1 answer

Iterative methods to solve an ill-conditioned linear system

I am currently solving a problem that in the process ends up having to solve a linear system with a symmetric matrix. The matrix of this system is not always positive-definite, and at most this matrix can be positive semi-definite. In the case that…
0
votes
1 answer

How to resolve double_scalar error in numpy?

I was using the 4th order Runge Kutta method to solve differential equations of the duffing oscillator with NumPy arrays, but I had received an Error. RuntimeWarning: overflow encountered in double_scalars Does anyone know the possible sources of…
James
  • 27
  • 5
0
votes
0 answers

Python - Numerical integration using t as parameter and as variable

I am trying to implement a numerical integration. Specifically, I am using the trapezoidal rule one gets the following analytical expression When I try to implement it numerically. gamma=0.1 #parameter Tmax=100 N=100000 #number of…
J.Agusti
  • 161
  • 11
0
votes
1 answer

Migration Matrix in a Two-Dimensional Torus-Like Space: create a migration matrix in R

I'm working on a standard problem in random walk in two dimension. In particular, I'm trying to generate a migration matrix for a toroidal model (Toroidal Transition Matrix) in R. I have previously posted the same problem here: Transition matrix for…
CafféSospeso
  • 1,101
  • 3
  • 11
  • 28
0
votes
0 answers

cross correlation of more than two files in python

I have a large numerical data and I must split it into 100 files and then compute C(i,j) = 〈x(ti)x(tj)〉. To this end, I must do the averaging on the 100 data sets and make a matrix and plot it as a density plot. So what I have done…
0
votes
1 answer

Gauss seidel Implementation in python

import numpy as np from scipy.linalg import solve_triangular as triSolve #O(n) per iteration, so overall O(nN), good for large SPD/SDD matrices def GS_iter(A, b, N): m = len(A) L = np.tril(A) P = L-A print(P) x =…
LHC2012
  • 187
  • 6
0
votes
1 answer

How to perform adaptive step size using Runge-Kutta fourth order (Matlab)?

For me, it seems like the estimated hstep takes quite a long time and long iteration to converge. I tried it with this first ODE. Basically, you perform the difference between RK4 with stepsize of h with h/2.Please note that to reach the same…
Maximus Su
  • 17
  • 7