Questions tagged [programming]
For mathematical questions related to programming, and questions where a computer-aided solution is strongly suggested. A strong connection with a mathematical topic is needed to make programming questions on-topic. This should not be the only tag. Consider also using the tags (algorithms), (numerical-methods), or (linear-programming).
741 questions
7 votes
5 answers
344 views
Proving that $x := x - yt$; $y := y + xt$ traces an ellipse
I was investigating the iterated function formed by the following JavaScript code, trying to find an invariant that can prove that the system doesn't slowly diverge: ...
2 votes
2 answers
218 views
Necessary and sufficient condition for a binary operation to be associative and commutative?
I'm implementing a type conversion routine for a programming language. Under arithmetic context, there can be 4 types: null, ...
0 votes
0 answers
245 views
Efficient algorithm for solving Diophantine equation $x ^ 2+y ^ 3+z ^ 5=w ^ 7$ with $\gcd (x, y, z)=1$.
My Mathematica Codes: ...
0 votes
1 answer
31 views
Separating Axis Theorem for 2 arbitrary convex polygons. cannot work out how to make axis for projection, do projections from vertices for testing
i have watched numerous tutorials on implementing the SAT, but i think the math eludes me (as it usually does). Say, theoretically, that you are looping over each edge in a programming language, now ...
0 votes
0 answers
51 views
Best tool for solving MINLP
I would like to consider a rocket impulse plan from Earth to Mars for my Personal Project (IB-MYP) I am currently working on, and I am a student in high school in Hiroshima, Japan. Could you please ...
0 votes
0 answers
79 views
Rewriting a n-dimensional matrix of dot products as a matrix multiplication
I am currently working on a Fortran codebase for numerical simulation, I have managed to simplify some loops to the following code ...
2 votes
1 answer
112 views
A LCM/coprime-related question (Codeforces Round 1037 (Div. 3) - E)
The context of this question is a competitive programming contest that occurred in July 2025. Solving this would allow me to understand the solution posted here. Indeed, that would allow to prove &...
1 vote
0 answers
71 views
Algorithms for factoring high degree polynomials
I have been reading the literature "Factoring very-high-degree polynomials" by G.A. Sitton, C.S. Burrus, J.W. Fox, and S. Treitel". This algortihm seems to be efficient for very high ...
2 votes
2 answers
119 views
How do I find and classify a stationary point of the function $5x^3 - 3yx - 6y^3 - 2$ using Newton's method and the Hessian eigenvalues?
Setup to the problem: We are going to determine the stationary points of the function $5x^3 - 3yx - 6y^3 - 2$ in the region $-1 \leq x \leq 1, \ -1 \leq y \leq 1$. Calculate the gradient $\nabla f(\...
0 votes
1 answer
104 views
Fitting general but "smooth" convex shape to points
I am aware that there are algorithms to fit, say, an ellipse to a bunch of given points on a plane. For instance, this SO question has answers which feature both literature on the algorithms and ...
1 vote
1 answer
92 views
Hidden Markov model (HMM) for multiple time series
I have a question regarding training HMM and then applying it to new data: Is it possible to train a HMM with several time series as inputs? My point here is that it'd be convenient to have a ...
0 votes
2 answers
146 views
I have a system of $6$ matrix equations, where the matrices are $64 \times 64$. How can I approach this problem in a more efficient way?
I think this question is more of a mathematics question rather than a programming question, read below for further details. Goal I have a system of somwehat big ($64 \times 64$) matrix equations of ...
2 votes
1 answer
66 views
How to convert the square root of an integer n to an array index in an array consisting only of primes? [closed]
I have a function in javascript that is supposed to calculate the nth prime. ...
0 votes
2 answers
161 views
What am I doing wrong implementing minimal residue method?
The given scheme $AU = F,$ where $A$ is an operator, and $U, F$ are the square $(N+1)\times(N+1)$-sized matrices. The action of operator $A$ is given by: $$ -a \frac{U_{i-1,j}-2U_{i,j}+U_{i+1,j}}{h^2} ...
5 votes
1 answer
114 views
Sequences that are rearrangements of $\{1,2,2,3,3,\dots, n,n\}$ such that each pair $(i,i)$ are exactly $i$ apart (where $i\ge 2$)
This question is inspired by leetcode. Obviously, this is a math website, so I will ask math questions. Given an integer $n\ge 1$, consider the set of all sequences with elements in the range $[1, n]$...