Questions tagged [mathematics]
For code that aims to solve problems in all branches of mathematics. (Please do NOT use this tag for incidental trivial use of arithmetic. A simple test to apply is: would an amateur or professional mathematician take an interest in the question?)
648 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
5
votes
6
answers
944
views
The Haversine formula in Java for computing distance along the Earth between two locations expressed in geographical coordinates
This time, I have implemented the Haversine formula:
io.github.coderodde.geom.Haversine.java:
...
11
votes
3
answers
1k
views
Golden-section optimization with complication
I'm trying to implement the so-called golden-section optimization in C++.
This is a simple algorithm to find an extremum of a univariate function \$f\$ within an interval \$[a,b]\$.
The crux is to ...
2
votes
3
answers
168
views
Calculating volume expressions of \$n\$ -dimensional balls in Java - follow-up 2
(See the previous iteration.)
This time, I have refactored my code a bit. It follows immediately:
Code
...
4
votes
2
answers
219
views
Calculating volume expressions of n -dimensional balls in Java - follow-up
Intro
(The previous/initial iteration is there.)
(The next iteration is there.)
This time, I have incorporated a nice answer by Martin R.
Updated code
...
4
votes
1
answer
321
views
Calculating volume expressions of \$n\$-dimensional balls in Java
(See the next iteration.)
Intro
This time I have a Java program that prints some expression denoting the volumes of \$n\$-dimensional balls. All the math behind this is there.
Code
...
5
votes
1
answer
330
views
Multiplying two large numbers whose digits you have in a string, in AEC compiled to WebAssembly
You can see it live here: https://flatassembler.github.io/multiplying-strings-aec.html
...
2
votes
0
answers
26
views
Mathematica implementation of Welch method for constructing Costas arrays
I ported C++ implementation of Welch method for constructing Costas arrays to Mathematica.
Any feedback would be appreciated.
...
6
votes
2
answers
435
views
(Codewars) Goldbach's Conjecture (by @rsalgado) in Ruby
Link to kata: linkRank: 6 kyuKata author: @rsalgado
I have been recently learning Ruby-lang and have been attempting to solve the following kata from Codewars involving Goldbach's Conjecture:
...
5
votes
2
answers
826
views
Bruteforce integer multiplication in Java
Intro
This time, I have attempted to prove the following bruteforce multiplication formula:
$$
(a_n \cdots a_0) \cdot (b_m \cdots b_0) = \sum_{i = 0}^n \sum_{j = 0}^m a_i b_j \cdot 10^{i + j},
$$
...
2
votes
0
answers
160
views
How to make this arbitrary precision π calculator using Machin-like formula run faster?
Two days ago (or yesterday depending on your timezone) was π-day. So I thought it was a good day to calculate π.
I used Machin-like formula to calculate π, in homage of William Shanks, who calculated ...
-5
votes
1
answer
361
views
int128 handling in C code, gcc / glibc / linux - follow up IV [closed]
[edit] Hint: a similar project for C++20 which - as far as I see - also manages bigger than 128-bit integers can be found at: Infinite precision integer in C++20 . [/edit]
I got lots of kind hints on ...
7
votes
2
answers
257
views
Two-Step Linear Equation Solver with Input Validation and Formatting
This code defines a function to solve two-step linear equations of the form coefficient * variable + constant = solution. It prompts the user for the coefficient, ...
10
votes
3
answers
1k
views
Computing π(x): the combinatorial method
This is my C++ implementation of Computing π(x): the combinatorial method by Tomás Oliveira e Silva. The math involved is elementary number theory, but fiddly and not the focus here. I have ...
4
votes
2
answers
130
views
Polynomial.java - multiplication algorithms: naïve, Karatsuba, FFT
Intro
This post is a supplement to Polynomial.java - a Java class for dealing with polynomials with BigDecimal coefficients. It presents the three polynomial multiplication algorithms. Given two ...
7
votes
3
answers
739
views
Polynomial.java - a Java class for dealing with polynomials with BigDecimal coefficients
(You can find multiplication algorithms in Polynomial.java - multiplication algorithms: naïve, Karatsuba, FFT.)
Intro
This post presents the main class (Polynomial) ...