Skip to main content

Questions tagged [numerical-methods]

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

Filter by
Sorted by
Tagged with
2 votes
2 answers
107 views

I'm implementing a numerical solver for the 1D diffusion (heat) equation using an iterative method. The initial temperature distribution is a Gaussian profile, which should theoretically smooth out ...
PlasmaPhyscsi's user avatar
3 votes
2 answers
581 views

I'm working on a Java assignment where I must implement the cosine function using only basic arithmetic operations (addition, subtraction, multiplication, division) and no built-in math functions, ...
TuffKultur's user avatar
1 vote
0 answers
72 views

I am working with a mechanical system that has five degrees of freedom (a composite plate), and I am trying to compute its frequency response, time-domain response, and natural frequencies. I have ...
AaronTBM's user avatar
  • 119
3 votes
2 answers
199 views

I have written a code that performs numerical integrations—one using the Gauss method and the other using the trapezoidal method. For the Gauss method, I have five separate text files containing the ...
X-SimE's user avatar
  • 33
6 votes
1 answer
460 views

I've written a Python script to solve a system of coupled differential equations and then use the results to solve an eigenvalue problem. The full problem is: \$\frac{d^2}{dr^2} K(r) = \frac{K(r)}{r^2}...
Amirhossein Rezaei's user avatar
2 votes
0 answers
65 views

I have written a N-body simulator in Rust implementing Barnes Hut algorithm and Leapfrog integrator. My code seems to work fine, but I'd like to review on techniques which can improve performance ...
epestr's user avatar
  • 21
1 vote
1 answer
305 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 ...
blov's user avatar
  • 29
2 votes
1 answer
220 views

Please review this C++ listing of an implementation of Leapfrog integration. Was the algorithm implemented correctly? ...
user366312's user avatar
3 votes
1 answer
338 views

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 ...
Klaus3's user avatar
  • 143
5 votes
1 answer
706 views

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 ...
Yuriy S's user avatar
  • 225
2 votes
1 answer
277 views

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 ...
thimoooh's user avatar
0 votes
1 answer
283 views

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 ...
CafféSospeso's user avatar
7 votes
7 answers
1k views

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 ...
CafféSospeso's user avatar
2 votes
3 answers
228 views

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, ...
cocomac's user avatar
  • 123
2 votes
2 answers
482 views

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 ...
CafféSospeso's user avatar
1 vote
1 answer
140 views

I have created an algorithm which calculates the value of PI in JavaScript. Can this algorithm to be improved? ...
John R.'s user avatar
  • 165
1 vote
1 answer
134 views

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 ...
Ξένη Γήινος's user avatar
1 vote
1 answer
270 views

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! ...
D G's user avatar
  • 135
2 votes
1 answer
350 views

I have realized that all the digital filters of the IIR type have the same structure. They are described by difference equation in following form: $$ y(k) = b_0\cdot x(k) + b_1\cdot x(k-1) + \ldots +...
Steve's user avatar
  • 355
4 votes
1 answer
526 views

I have written a program in C++ that processes financial bond mathematics, making extensive use of the valarray class, so that mathematical functions and operations ...
Giogre's user avatar
  • 515
14 votes
4 answers
2k views

I have tried my hand with implementing simple quadrature formulas in C++. Definite integral: $$\int_a^b f(x) dx$$ Domain of integration \$[a, b]\$ divided into \$n\$ intervals of equal length \$h = (b ...
Giogre's user avatar
  • 515
3 votes
1 answer
149 views

The most famous library for Support Vector Machine (SVM) algorithm is libsvm (https://github.com/cjlin1/libsvm/), but I felt that its code style is too old, I rewrote in newer C++ as a hobby project. ...
frozenca's user avatar
  • 1,751
4 votes
2 answers
1k views

I wrote a simple linear/polynomial regressor based on my previous matrix project (https://github.com/frozenca/Ndim-Matrix). ...
frozenca's user avatar
  • 1,751
2 votes
1 answer
243 views

I just asked this question over Stack Over Flow on how to improve my code and reposting it here as someone on Stack Overflow recommended this platform. I have written two python functions and they are ...
AulwTheo's user avatar
3 votes
1 answer
309 views

I'm trying to perform a 4-dimensional numerical integration in R using a function I wrote in C++ code which is then sourced in <...
CafféSospeso's user avatar
4 votes
3 answers
2k views

This is a follow-up question for Two dimensional bicubic interpolation implementation in Matlab and Two dimensional gaussian image generator in C. Besides the Matlab version code, I am attempting to ...
JimmyHu's user avatar
  • 7,575
7 votes
1 answer
1k views

I am attempting to implement two dimensional bicubic interpolation algorithm in Matlab. The input is a two dimensional array and the output is the interpolated result. The test input matrix: ...
JimmyHu's user avatar
  • 7,575
8 votes
1 answer
1k views

I have tried to code a genetic algorithm to guess the coefficients of a degree 4 polynomial. The information initially provided is values of y = f(x) for different x using the original polynomial. I ...
Roni Saiba's user avatar
2 votes
1 answer
104 views

(See the previous version here.) This time, I have encorporated all the suggestions made by Marc. Also, I changed the type of points from Double to ...
coderodde's user avatar
  • 32.3k
1 vote
1 answer
91 views

(See the previous version here.) (See the next version here.) This time, I have incorporated all the suggestions made by Roman; my new version follows. ...
coderodde's user avatar
  • 32.3k
14 votes
1 answer
1k views

I recently needed to create a function to approximate a complex trigonometric function on an embedded system without a floating point unit and without a fast trigonometric library. So I pulled out my ...
Edward's user avatar
  • 67.3k
5 votes
3 answers
316 views

This is an algorithm regarding the RKF method: ...
Amirhossein Rezaei's user avatar
1 vote
1 answer
96 views

I have a system of n oscillators which oscillate with time. To each of these oscillators I am adding a fluctuating coloured noise term with a different seed for each oscillator. Here is my code for ...
Iwan Phillips's user avatar
5 votes
1 answer
565 views

I am trying to implement the Euler–Maruyama method and use it to solve the Ornstein–Uhlenbeck process. I am basing my code on the wikipedia page where a python implementation is shown. More generally ...
Iwan Phillips's user avatar
4 votes
1 answer
537 views

I've written bounded spigot algorithms(Spigot Algorithm) for e and pi. I would like to understand if there is anything I can do to make this more efficient. I've done things already like move the ...
FodderOverflow's user avatar
2 votes
1 answer
80 views

I have a simple task as part of a larger autocorrelation DSP system - to convert from signed 16-bit integer audio samples to floating-point. This part is quite self-contained: ...
Reinderien's user avatar
  • 71.2k
4 votes
1 answer
261 views

This is my first modeling exercise on the particle flow. Recently, I read a paper https://acp.copernicus.org/articles/20/3181/2020/. After reading the paper, thought of modeling it in Python. It seems ...
Vishal's user avatar
  • 43
5 votes
1 answer
369 views

I implemented binary logistic regression for a single datapoint trained with the backpropagation algorithm to calculate derivatives for a gradient descent optimizer. I am primarily looking for ...
James Cagalawan's user avatar
9 votes
3 answers
416 views

This is a follow up of A simple definite integrator class of a single variable in C++. I took most of the advice from Emma X and some from sudo rm -rf slash. Here is my fully revised code: Integrator....
Francis Cugler's user avatar
5 votes
2 answers
2k views

I have written a simple Integrator class in C++17 that can perform either a definite single integration of a single variable or a definite double integration of a ...
Francis Cugler's user avatar
4 votes
2 answers
3k views

I am teaching myself some coding, and as my first "big" project I tried implementing a Steepest Descent algorithm to minimize the Rosenbrock function: $$f(x, y) = 100 (y - x^2)^2 + (1 - x)^2$$ The ...
Blue's user avatar
  • 143
3 votes
1 answer
837 views

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 ...
Stavros Avramidis's user avatar
3 votes
2 answers
120 views

I have the following code, that defines: A polynomial struct with some useful functions. The newton Raphson algorithm for polynomials. and calculates sqrt(2). What ...
mcocdawc's user avatar
  • 974
2 votes
1 answer
307 views

Please see the following code. I am using it to calculate the double integration. Please help me to improve the code. ...
Shankar_Dutt's user avatar
7 votes
3 answers
6k views

I came up with this recursive pure-Python implementation of De Casteljau's algorithm for computing points on a Bézier curve: ...
das-g's user avatar
  • 179
3 votes
4 answers
1k views

I have implemented the Simpson's rule for numerical integration. Check this video for the implemented function. ...
user366312's user avatar
1 vote
1 answer
1k views

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 ...
Shankar_Dutt's user avatar
1 vote
2 answers
653 views

The following is an implementation of Newton's method of finding root of a function. ...
user366312's user avatar
1 vote
2 answers
398 views

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 ...
Simple coder's user avatar
4 votes
1 answer
217 views

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 ...
HotDogCannon's user avatar

1
2 3 4 5