# Questions tagged [numerical-methods]

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

215 questions
Filter by
Sorted by
Tagged with
24 views

I have implemented the Preconditioned Conjugate Gradient (PCG) method for solving a system of linear equations in Python and I would appreciate it if someone could verify its correctness since I am ...
23 views

### cubic spline routine

I tried to implement the cubic spline algorithm in cython. I want to ask how I can make the code more efficient in terms of speed. Any suggestions or references ...
115 views

### Minimalistic implementation of Leapfrog integration algorithm

Please review this C++ listing of an implementation of Leapfrog integration. Was the algorithm implemented correctly? ...
227 views

### Finite difference estimation of partial derivatives for arbitrary grids in python

I am currently working on testing some codes on python to solve differential equations by finite differences, but some problems and equations i am dealing with are: Too big to keep manually writing ...
429 views

### Runge-Kutta 4 implementation in Rust

This is a toy problem. I want to try using Rust for numerical modeling, but I found zero tutorials for this kind of stuff. I also just started learning Rust yesterday, so please bear with me. Usually ...
208 views

### Integration loop over multiple doping and temperature levels

I want to perform some calculations on a large dataset. The code can be found below, where I want to calculate the values for 'results_nr' over a large loop (1000 x 910) values. Can you help me out ...
231 views

### Parallelise numerical integration with OpenMP in C++

I would like to parallelise with OpenMP a one-dimensional integral using the integrate() function implemented in the Boost library. I found a rather obscure ...
1k views

### A probability distribution function, to be called repeatedly during numerical integration

I am trying to speed up as much a possible this function in C++. As I explained in another post, Implementing multidimensional integral for a custom function in C++, this function will be used inside ...
152 views

### Calculating square roots using binary search

I'm trying to find the square root of a number (num) using binary search in Rust. I'm new to Rust, but I've done quite a bit of programming in other languages, ...
326 views

### Implementing multidimensional integral for a custom function in C++

I am not an expert with C++, but I am trying to implement a 4-dimensional integral using GSL numerical integration approach. The code below shows the whole algorithm. Although it seems correct what I ...
1 vote
82 views

### Calculate the value of PI in JS

I have created an algorithm which calculates the value of PI in JavaScript. Can this algorithm to be improved? ...
1 vote
106 views

### Three efficient JavaScript functions that converge to pi extremely fast

I am learning JavaScript and decided to translate my Python scripts into JavaScript. Approximations of π are extremely popular programming challenges and I am sure they must be a staple of the ...
1 vote
170 views

### Calculating sine and cosine

Are there any thing that I have to consider to improve the following code in either performance and others? Any comments and suggestions are welcome! ...
242 views

603 views

### Linear Interpolation for sorted arrays

I have made a linear interpolation functions as a side project of mine. It assumes everything is sorted before hand - x and f(x) are the same length. I would like to ask for: general recommendations ...
89 views

### Newton Raphson and polynomials in C

I have the following code, that defines: A polynomial struct with some useful functions. The newton Raphson algorithm for polynomials. and calculates sqrt(2). ...
1 vote
225 views

5k views

### pure Python Bézier curve implementation

I came up with this recursive pure-Python implementation of De Casteljau's algorithm for computing points on a Bézier curve: ...
987 views

### Simpson's method for numerically computing the integration of a function

I have implemented the Simpson's rule for numerical integration. Check this video for the implemented function. ...
1 vote
765 views

### What would be the computationally faster way to implement this 2D numerical integration?

I am interested in doing a 2D numerical integration. Right now I am using the scipy.integrate.dblquad but it is very slow. Please see the code below. My need is to ...
1 vote
487 views

### Implementation of Newton's method of finding root of a function

The following is an implementation of Newton's method of finding root of a function. ...
1 vote
284 views

### Simple definite integral calculator

I made this code to compute definite integrals in Processing. It works by getting the rectangle between the maximum value between the previous function value and the current function value, and then I ...
176 views

### Fortran 90 / openmp heat transfer simulation optimization

I'm a newbie playing around with Fortran 90 and openmp and wrote the code below (a simple 2D heat transfer simulation) for testing purposes. So far I don't see any speedup by using openmp / parallel ...
1 vote
401 views

Best rational approximations is a technical term and not subjective. The best rational approximations are the convergents of a value plus it's semi convergents that are closer to the original value ...