Skip to main content

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).

Filter by
Sorted by
Tagged with
1 vote
1 answer
81 views

Book Recommendations for Learning Python for Mathematics.

Lately, I've been finding that I often need to compute various things and graph some pretty complicated functions. I've realized that learning to program, especially in Python, could be really helpful ...
Mathematics enjoyer's user avatar
-2 votes
0 answers
29 views

Select a random number for a certain seed, being sure the previous seed doesn't select the same random number [closed]

Say I have a random number generator which takes a seed and gives an integer between 1 and 10. Say I have a seed '100'. This would generate a random number '4'. Now, how would I be sure that this ...
ComputerDoggie's user avatar
0 votes
0 answers
17 views

How to solve a paths optimization problem in node-labeled and weighted graphs

I am having trouble finding a way to optimize this problem in Python. Even if it is not exact, I am trying some heuristics. Let $G = (V,\mathbf{L}, E,\mathbf{W})$ be a graph where $V$ is the set of ...
The Bosco's user avatar
  • 1,965
-2 votes
0 answers
25 views

Find closet point to C in an intersection of two circle A,B [closed]

Let $C_{A},C_{B},C_{D}$ denote all the points in the circles A,B,C with radius r,d,d respectively. Let $dist(x,y) $ denote the euclidian distance between point x & y. Let denote $m_{i}$ closest ...
EliteBiker7's user avatar
2 votes
1 answer
26 views

How to Find Closest Average for a set of variables from Multiple Sets of Numbers

I'm working on a problem where I have several sets of numbers and I need to find the closest average for a set of target values by combining numbers from these sets. For example, let's say I want to ...
4DBug's user avatar
  • 21
0 votes
1 answer
32 views

How can I make a vector of the products of the elements $(a_0b_0,a_0b_1,a_1b_0,a_1b_1)$ from the vectors $(a_0,a_1)$, $(b_0,b_1)$?

Given the vectors $$\bar{a}=\left(\begin{array}\\a_0\\a_1\end{array}\right), \hspace{5pt} \bar{b}=\left(\begin{array}\\b_0\\b_1\end{array}\right) \in \mathbb{R}^2,$$ is there any way to get the ...
Truls Henriksson's user avatar
1 vote
2 answers
139 views

Is everything an object in Math, just like in Objected-Oriented Programming? (Tao's Analysis I)

I am reading Tao's Analysis I, and there are a number of passages which seem to suggest an object-oriented point of view of mathematics reminiscent of the object-oriented programming with which I, as ...
Princess Mia's user avatar
  • 2,533
0 votes
0 answers
33 views

Circular Breakout Game: time or collisions needed to reach nth layer

Shower thoughts... A tiny ball starts inside a unit circle, surrounded by fixed concentric circles of increasing integer radius length. So it starts in is the 0-th "level". The ball moves in ...
vallev's user avatar
  • 294
0 votes
0 answers
23 views

Solving systems of linear algebraic equations in singular case

I want to solve this system: $A \in \mathbb{R}^{n \times n}, \quad Ax = b, \quad det(A) = 0$ Hence, there are either no solutions or there are infinitely many of them, then I want to find a pseudo-...
Mr Robot's user avatar
1 vote
0 answers
37 views

Rotation invariant representation of strings

I came across the following simple programming question: You need to create a boolean function that will return True if you get String A by shifting the alphabets in String B. Example: ...
moe asal's user avatar
  • 121
12 votes
6 answers
1k views

Book recommendations for Combinatorics for Computer Science Students

I am a computer science student with an interest in competitive programming. I am currently looking to deepen my understanding of combinatorics, as it is a crucial part of algorithm design and ...
Sersawy's user avatar
  • 343
7 votes
4 answers
2k views

Is it possible to find sum of x^x from a to b without using summation but rather a less computationally heavy method?

I don't know if I have an odd question, or if this has been asked before (research has not provided me with an answer or question about this). But I have a large amount of summation I need to do, ...
DaisyLlife's user avatar
0 votes
0 answers
26 views

Determine if point can be projected on any segment in polyline

I am trying to implement a script that determines if a series of points can be projected on any segment of a polyline. The projection must be exactly on the segment, not in the rest of the line ...
NeuroTheGreat's user avatar
0 votes
0 answers
17 views

Why adding functional derivative of entropy doesn't get an uniform distribution?

From https://mbernste.github.io/posts/functionals/, the functional derivative of entropy is $−1−logP_x(x)$. From my understanding, adding this derivative to a distribution, it will get an uniform ...
Mark's user avatar
  • 53
1 vote
1 answer
66 views

Find the center point of ellipse by only 2 points on it and radiuses

For a project, I am requested to find the center point of an ellipse (not necessarily centered), by just 2 points on it and radiuses. B and E are points on an ellipse (Begin and End of an elliptic arc)...
Xerix's user avatar
  • 123
0 votes
0 answers
13 views

Are there any theorems about the existence of feasible solutions to the Mixed-Integer Nonlinear Programming (MINLP) problem?

I am just wondering if there are any theorems about the existence of feasible solutions to the Mixed-Integer Nonlinear Programming (MINLP) problem. For example: Theorems about sufficient conditions ...
Shujun Tan's user avatar
1 vote
2 answers
38 views

How to find both of the degrees and length of the hypotenuse in a circle if were stretched?

I'm trying to calculate the degrees of an angle and the length of the hypotenuse if they were stretched/scaled horizontally or vertically. Here's a picture to demonstrate. a = width b = height c = ...
SamYazo's user avatar
  • 43
0 votes
0 answers
10 views

Latent Change Score Modelling

I am currently undertaking a research project that aims to assess the effectiveness of an intervention program. However, I am encountering difficulties in locating suitable resources for my study. ...
Vivian's user avatar
  • 1
2 votes
0 answers
32 views

Representing a Groebner basis decomposition in sympy

In Sympy package there is Groebner() function, which allows to find a Groebner basis={$g_1, g_2,..., g_k$} for an ideal I, generated by polynomials $\{f_1, f_2,..., f_n\}$. I wonder if there is ...
Dmitri Scheglov's user avatar
1 vote
0 answers
14 views

Help - How to separate 4th order transfer function (Butterworth Approximation) into 2nd order using Python Control Library?

Previously I had the following coefficients in the program. In this program I want to create a transfer function of butterworth approximation (Figital Filter Fesign - Digital Signal Processing). ...
SKevinAR18's user avatar
2 votes
2 answers
304 views

Find a the Position and Rotation of an Object in 3D Space Given the Pan and Tilt Angle to 3 Other Known Points.

Goal I want to find the rotation and position of an object in the real world given the pan/tilt or azimuth/elevation angles between the object and 3 or more other points in the room. The rotation of ...
Benjamin Danger Johnson's user avatar
0 votes
2 answers
76 views

Help with reformulating linear programming with rounding numbers

I have the following problem, abstracting away a few details from a real-world application, that I want to solve with linear programming (or any other mathematical optimization with constraints, ...
qalis's user avatar
  • 157
2 votes
0 answers
54 views

Find X such that X is the largest divisor of Y that is less than or equal to M.

I have this function that finds X such that X is the largest divisor of Y that is less than or equal to M (and X != 1). in other words, Y/X gives least amount of remainders when dividing from 2 to M. ...
M.kazem Akhgary's user avatar
0 votes
0 answers
21 views

Minimize the Frobenius norm between two matrices with inequality and equality constraints.

I had previously asked a question in which the problem was incorrectly specified. I am rephrasing it in this new question. The specific model is this one: Let A $\in \mathbb{R}^{n \times m}$ and B and ...
andres's user avatar
  • 9
3 votes
1 answer
226 views

Vietnam Mathematical Olympiad 2024 - First Question

Problemset paper (in Vietnamese): https://www.facebook.com/share/p/PpV3EQVE4chTZnZC/?mibextid=TrneLp I am looking at the problem set of the VMO2024, but I can't solve any of them, nor have an idea of ...
Minh Đức Hoàng's user avatar
3 votes
3 answers
674 views

Chance of generating two zeros in a row, compared to chance of generating a zero and a one in a row when generating random numbers between 0 and 5?? [closed]

I tried to code a simple python program which does the following: it generates random numbers between 0 and 5 until a zero is generated twice in a row. it does this N times and calculates the average ...
Weaktor's user avatar
  • 39
2 votes
1 answer
92 views

Deriving constants that are used to construct an isometric cube [closed]

Problem Overview I'm working on a website that uses CSS/JS to create this isometric, resizable cube. Through some "logical" experimentation, I was able to determine the constants that allow ...
Maximilian Meiler's user avatar
0 votes
0 answers
57 views

Prime partitions of a rectangle

Prime partitions of a rectangle partitions of a rectangle ABCD is a rectangle such that AB ≥ AD. AB, AD, AE and AF are integer lengths. A configuration is called “first” when the 8 surfaces Si (i = 1, ...
philippe benedetti's user avatar
1 vote
0 answers
59 views

Good textbooks on optimization to read?

I am a user of CPLEX and I routinely came across more or less theoretical issues in my work. So I have to keep improving my optimization skills and knowledge. So far I have finished two well known ...
qqzj's user avatar
  • 11
0 votes
0 answers
31 views

non-homothetic configurations such that the area of triangle ABC is integer

Let a, b, c, and n be four integers such that b < a ≤ n and c ≤ n. In a triangle ABC (ABC is oriented in the positive counterclockwise direction), let D be a point on side [BC] such that BD = a, DC ...
philippe benedetti's user avatar
0 votes
1 answer
55 views

Defining a recursive function (structural induction)

A list of integers can be recursively defined as follows: <IntList> ::= [] | cons(<Int>, <IntList>) Write a recursive function named ...
Need_MathHelp's user avatar
0 votes
0 answers
31 views

Failing to understand (scaled) partial pivoting

I have a few questions regarding the (scaled) partial pivoting method. In my lecture slides, it says that partial pivoting chooses the biggest pivot in magnitude to prevent round-off errors from ...
soph's user avatar
  • 1
3 votes
1 answer
141 views

The number of triangles in the fractal, which is formed from a square by the additional construction of isosceles right triangles

There is an algorithm for constructing a fractal: Take a square with a side of size 1; An isosceles right triangle is completed on each side; GOTO step 2. There is an example of that shape: How can ...
Alexander D's user avatar
0 votes
0 answers
32 views

calculating dynamic offset

there are two given functions. One (blue) is detailed but has a certain offset from its actual value. The other (red) doesn't have this offset, but it is less detailed. I'd like to use the first ...
Era D's user avatar
  • 1
2 votes
1 answer
654 views

Project Euler #864, count $\sum\limits_{i=1}^C \mu^2(i^2+1)$ for large $C$

Link: https://projecteuler.net/problem=864 For short, you are asked to calculate: $\sum\limits_{i=1}^C \mu^2(i^2+1)$, where $\mu$ is the Mobius function and $C=123567101113$ is a large integer ...
Muses_China's user avatar
  • 1,006
0 votes
0 answers
78 views

How to derive the Log and Exp functions of a Geometric Algebra Rotor for Spherical Interpolation (Slerp) in 4D

I am trying to create a Slerp function between two 4D Rotors Rotor Slerp(Rotor a, Rotor b, t) { ... } I have been told you can do an interpolation using Log and ...
Joe's user avatar
  • 1
0 votes
0 answers
24 views

What are the steps for the LQ decomposition of a tall matrix

I need to write an R function that decomposes a rectangular $6 \times 4$ matrix into $6\times 4$ lower triangular L matrix and an orthogonal Q matrix, however I can't seem to find any information on ...
EM823823's user avatar
  • 463
0 votes
0 answers
23 views

Multiple summation for 1D Ising model

I am trying to perform multiple summation in a Matlab code, but I don't know how to write a code to perform multiple for's . $$\sum_{S_1=\pm1}...\sum_{S_N=\pm1}(\Pi_{i=1}^{N-1}e^{S_iS_{i+1}})=\sum_{...
Pedro Ye's user avatar
2 votes
0 answers
101 views

Using the phrase "Tautology False" to describe something that is always FALSE or OFF

Programmer here. I sometimes catch myself saying that something is a Tautology False because it always evaluates to FALSE or OFF. I know Tautology means always True in discrete math but I use it to ...
christian winterhalter's user avatar
0 votes
0 answers
19 views

Efficiently determine a matrix using equations made out of its elements

Suppose $\sigma$ is a real, symmetric and positive matrix ($\sigma > 0$). The elements of $\sigma$ satisfy a certain number of quadratic equations, this number is less than the number of ...
Bard's user avatar
  • 45
0 votes
0 answers
35 views

Difficulty in understanding a program for binary operations on differential objects

I'm currently reading the book Software Design for Flexibility, by Hanson and Sussman. Section 3.3 of that book is about implementing automatic differentiation in the language Scheme by defining an ...
Johann Michael's user avatar
1 vote
0 answers
23 views

What method(s) do computers or calculators use to solve polynomial equations? [duplicate]

I want to make a program that will solve polynomials, but I don't want to just look at another program that already works as I think that would defeat the purpose of the exercise. And that's why I'm ...
James Baw's user avatar
0 votes
0 answers
32 views

Boundary Values for the Convolution Theorem for the Inverse Fourier Transform

I am attempting to numerically solve the Vorticity-Streamfunction Equation (a 2D incompressible simplification of the Navier-Stokes Equations) in Fourier Space: $$ \omega_t + \psi_y \omega_x - \psi_x \...
Jacob Ivanov's user avatar
2 votes
2 answers
186 views

Combinatorial Proof for the Number of Squares in a Grid

I am exploring combinatorial methods to solve a problem related to counting the number of squares in a grid. Given an 'a x b' grid of evenly spaced points, I want to understand how to determine the ...
Aljaz Brodar's user avatar
1 vote
0 answers
65 views

Using Sage to compute facts about modules

I am new to programming in general but in my project, I am required to work with a finite set $S = \{A_1,...,A_n\}$ of $m \times n$ matrices over a finite ring $R$, and the submodule $M$ they generate....
JBuck's user avatar
  • 713
1 vote
4 answers
176 views

Find combinations of 3 values that add to final value

So I only took math up to high school level and a bit during uni, but I do code a lot and can figure out a lot of algorithms and formulas to get what I want, but this stumped me... I never had to ...
ItsKazBorn's user avatar
0 votes
0 answers
26 views

Understanding of the Squares World Problem

I am currenlty improving my problem solving skills and i stumble upon this problem, I thought it is quite a simple problem but upon further exploring it is harder than i thought it would be. Here is ...
Chris Bray's user avatar
2 votes
1 answer
72 views

optimal sandwiches in first $n$ positive integers

Consider an ordered permutation of $n$ integers $\lbrace a_1,a_2,\ldots,a_{n} \rbrace$. Define a sandwich to be a pair $(a_i,a_j)$ such that $a_i,a_j > a_{i+1},a_{i+2},\ldots,a_{j-1}$. Find the ...
xousious's user avatar
  • 109
1 vote
1 answer
79 views

Nested for loop summation

Func(V, n) { int a = 0 int b = n - 1 while(a < b) { for(int i = a; i < b; a++) { // do something } a = a + 1 b = b - 1 } } ...
JOAO VITOR FAGUNDES DE LIMA's user avatar
1 vote
0 answers
134 views

isDivisible function in lambda calculus for Church numerals

After trying without success for several days to find a proper software/website that can correctly simplify lambda terms (see this question), I ended up deciding to use JavaScript to do the same. The ...
Soham Saha's user avatar
  • 1,366

1
2 3 4 5
15