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

Division by zero error while calculating derivative at high precision

I am calculating a derivative of a function by using the slope method. I need to zoom into the graph to see what actually is happening but the data points are too low to give a smooth curve. So when I increase the number of iterations in my loop,…
0
votes
1 answer

Index list out of range error for Fourth-Order Runge-Kutta integrator for an n-dimensional system of ODEs

Problem Parameters: The function that you build needs to take in The current value of the independent variable (x) The current values of the dependent variables (y) <-- (list) The step-size of the independent variable (h) The function which…
Shiaa
  • 1
0
votes
0 answers

Numerical error in vector direction calculations

I am writing a code, which would input a vector ri and calculate the angles it makes with x, y and z axis. This way I will know the direction of the vector and be able to calculate the components of the force (which I calculate separately) in that…
Ruffi
  • 23
  • 5
0
votes
2 answers

Implementing Euler's Method in GNU Octave

I am reading "Numerical Methods for Engineers" by Chapra and Canale. In it, they've provided pseudocode for the implementation of Euler's method (for solving ordinary differential equations). Here is the pseucode: Pseucode for implementing Euler's…
0
votes
0 answers

How can I solve BVP with multiple boundary conditions?

I am facing some problems in solving my differential equations using the forward difference method. I have two regions (0 to t and t to 1, and t is any value from 0 to 1). In first region (0 to t), I have 4 differential equations and in the second…
0
votes
0 answers

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
  • 53
  • 1
  • 1
  • 5
0
votes
1 answer

how to use solve_ivp solve Partial Differential Equations with spectral method?

I want to use the spectral method to solve partial differential equations. The equations like that, formula,the initial condition is u(t=0,x)=(a^2)*sech(x),u'_t (t=0)=0. To solve it, I use the python with the spectral method. Following is the…
0
votes
1 answer

How can I fix this for loop to solve a system of linear equations through the Jacobi iteration method?

I'm trying to write a function that goes through the Jacobi iteration method for solving a system of linear equations. I've got most of it down, I just need to figure out how to iterate the last for loop either 1000 times or until the break…
nicons
  • 13
  • 4
0
votes
1 answer

`fzero` function in matlab fails to find the root and keeps on generating error

I am using MATLAB and I want to find the root of an equation F(x)-u=0. Here u=0.2861 and F=normcdf(sqrt(lambda/t)*(t/mu-1))+exp(2*lambda/mu)*normcdf(-sqrt(lambda/t)*(t/mu+1)). The value of lambda and mu are both 1. I typed the following…
KevinKim
  • 1,382
  • 3
  • 18
  • 34
0
votes
1 answer

I need to create a python function that makes an n-dimensional vector such that each element is a real number in [0,100)

I'm not very good with python and I need to create a function, randvec(n), that will create an n-dimensional vector where each element is a random real number in [0,100). Below is what I have so far. def randvec(n): vector =…
0
votes
0 answers

Crank-Nicolson Method

I need to write the following pseudocode into Python code: enter image description here And here is my code: import math def f(x): v = math.sin(math.pi/2*x) return v def zero_matrix(i, j, start_from=1): matrix = [[-1] *…
David Xu
  • 1
  • 1
0
votes
0 answers

Gridding data points and interpolation

suppose i have (x1,x2) plane which is a subset of R^2 and i consider certain intervals (x1,x2), i1=[-100,100] on x1, i2=[-100,100] on x2. i want to grid this in both x1 and x2, with some step size say h=0.01 and interpolate for all x in R^2 using…
0
votes
0 answers

Numerical algorithm for multidimensional root finding

Given a continuous two-dimensional function over the reals, f(x, y), I want to find the "line of roots", i.e. the path(s) along which f(x, y) = 0. The function does not have a closed form. Therefore, this is a numerical problem and I cannot hope to…
0
votes
1 answer

Can I apply CPS (continuation passing style) in numeric analysis/method?

Using functional continuation in ReasonML, can I apply CPS in numeric analysis/method? e.g. euler method, finite difference method. let factorial3 = n => { let rec cont = (n, func) => if (n <= 1) { func(); } else { cont(n - 1,…
madeinQuant
  • 1,721
  • 1
  • 18
  • 29
0
votes
2 answers

Amplitude increasing in the verlet method in backward difference

I am facing trouble in the increasing oscillation on a simple harmonic oscillator using a backward difference. here is my code in Scilab function [x] = back(h, tf) k = 2; m = 1; i = 2; t(i - 1) = 0; x(i - 1) = 10; v(i - 1) = 0; t(i) = t(i - 1) +…
1 2 3
99
100