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
0 answers

Lambda functions maximum recursion depth exceeded

I was trying to create a function that solves multiple integrals using Simpson's method and my idea was to integrate out variables one by one until I'm left with a single integral but I'm getting recursion depth exceeded and I'm unable to figure out…
0
votes
2 answers

Inconsistent vector length when using the `plot` command

I have created a function below. The function is a generic solver for a stochastic differential equation that uses the Euler-Maruyama method. function [Y,t]=eulermaruyama_solver(Y0,T,a,b,c,F,G,deltaW) % deltaW is called on in the test…
0
votes
1 answer

Scipy Optimization Solution for Multivariable equation

I have a formula here to calculate the volume. def VolCalc(H,L,R,V): return L * ((math.acos((R - H)/R) * R**2) - ((R - H)* math.sqrt((2 * R * H) - H**2))) # Volume However, I have been given the value of the volume (V) and from this the height…
Paul Essex
  • 25
  • 5
0
votes
1 answer

Numerical solution for a pendulum

I am having a trouble in providing a graphical representation of my system, which happens to be a harmonically driven pendulum. The problem is shown below for reference. Problem The source code I used is shown below using the Verlet Scheme. #Import…
0
votes
1 answer

Interpolating a complex-valued boundary function inside a circular disk with the Cauchy Intergral?

I have heard that the Cauchy integration formula can be used to interpolate complex-valued functions along a closed boundary of a disk to points inside the disk. For my current project, this sounds rather valuable, so I attempted to give this a…
0
votes
1 answer

Implementing cos(x) by its Taylor series in python

I have to implement the cosine function in python by using its Taylor series. I have to print its values and the absolute and relative errors for all the values in listt from below. Here is what I tried: import math def expression(x, k): return…
Math Guy
  • 101
  • 1
0
votes
1 answer

How can I compute (exp(t) - 1)/t in a numerically stable way?

The expression (exp(t) - 1)/t converges to 1 as t tends to 0. However, when computed numerically, we get a different story: In [19]: (exp(10**(-12)) - 1) * (10**12) Out[19]: 1.000088900582341 In [20]:…
Jack M
  • 4,769
  • 6
  • 43
  • 67
0
votes
1 answer

bisection method in C

I wrote a code to find the root of a 4th degree polynom with bisection method. I wrote the same code for 3th polynom,too and that works fine. I just copy and paste, and add 4th degree term and it didn't work fine.Here is my code double root4(double…
0
votes
1 answer

Solving a non-linear second order differential equation on Scilab?

I need to solve the following -cos(y)y''+sin(y)y'^2+sin(y)=0, y'(0)=y'(1)=0, such that y=y(t) I find it hard to solve because of the term y'^2 and also the boundary conditions.
0
votes
0 answers

Partial derivatives of a function found using interp2d in python/sagemath

I have a function of two variables, R(t,r), that has been constructed using a list of values for R, t, and r. This function cannot be written down, the values are found from solving a differential equation (d R(t,r)/dt). I require to take the…
Deepdoop
  • 1
  • 1
0
votes
1 answer

numba cuda on matrix decomposition code in python

I'm trying to implement this code to use my gpu import numpy as np import math import numba from numba import vectorize , cuda @cuda.jit(['float32(float 32)'], device=True) def CholeskyInc(A): n,m = A.shape if n!=m: print('La…
matdlara
  • 139
  • 4
0
votes
1 answer

Is the computation precise in 64-bit floating point

Let's say I have probabilities between 0.1 and 0.2(10,000 of them), and I want to store the result, which is the multiplication of all these probabilities in the 64-bit floating point? Is it a reliable computation?
0
votes
1 answer

Leapfrog algorithm to compute a objects trajectory in a Gravitational field around a central body (Python 3.8.2)

I pretty much deleted the last code and started new. I added a new class called Object which is the replacement for the lists called body_1 and body_2. Also all the calculations are now done from within the Object class. Most previous existing…
0
votes
1 answer

Custom Python Monte Carlo integration function is underestimating multi-dimensional integrals

I need to create a custom Monte Carlo integration function to adapt to custom multi-dimensional distribution objects using NumPy. I need it to integrate over the same values in each dimension. It works correctly for a single dimension, but…
0
votes
0 answers

Most accurate way to calculate matrix powers and matrix exponential for a positive semidefinite matrix

I do need to numerically calculate the following forms for any , possibly in python: , where is a PSD matrix, where k can get quite large values -possibly up to order of hundreds. I prefer k to be a real number, but it is ok if it can only be an…
Cupitor
  • 11,007
  • 19
  • 65
  • 91