Skip to main content

All Questions

2 votes
2 answers
109 views

Creating a short, d-dense list of points on the sphere S^4 in Python

I am a mathematician and this is my first time using Stack Overflow, sorry if the question is not adequate or there is some better place to ask this. I would like to know if there is a standard way ...
Saúl RM's user avatar
  • 121
0 votes
0 answers
410 views

How the mod() function works internally in languages like Java, Python, etc?

in Java or Python this function is given by the % operator. I would like to know the mathematical algorithm that uses this function.
Franco Allende's user avatar
0 votes
1 answer
312 views

Minimize number of shops while reaching all customers

In this particular issue, I have an imaginary city divided into squares - basically a MxN grid of squares covering the city. M and N can be relatively big, so I have cases with more than 40,000 square ...
Infinity77's user avatar
  • 1,449
1 vote
0 answers
431 views

Efficient algorithm to find number density of points in 3D space

I have the position data for particles in 3D space. The particles are in random positions in the 3D box and I am trying to find the position of the maximum number density. Is there a simple algorithm ...
Warrenmovic 's user avatar
2 votes
1 answer
2k views

Finding Fourier coefficients algorithm

Ok, so I have been trying to code a "naive" method to calculate the coefficients for a standard Fourier Series in complex form. I am getting very close, I think, but there are some odd behaviors. This ...
rocksNwaves's user avatar
  • 6,232
2 votes
1 answer
96 views

How to use positional arguments appropriately for a complex problem

I am revisiting a school project, which I did not complete to my satisfaction. Namely, I wrote an algorithm that takes an ALMOST arbitrary size set of equations and solves them iteratively. The ...
rocksNwaves's user avatar
  • 6,232
2 votes
1 answer
889 views

Fastest algorithm for computing 3-D curl

I'm trying to write a section of code that computes the curl of a vector field numerically to second order with periodic boundary conditions. However, the algorithm I made is very slow and I'm ...
P. Reinecke's user avatar
14 votes
2 answers
2k views

Solving PDE with implicit euler in python - incorrect output

I will try and explain exactly what's going on and my issue. This is a bit mathy and SO doesn't support latex, so sadly I had to resort to images. I hope that's okay. I don't know why it's inverted, ...
Oria Gruber's user avatar
  • 1,533
-1 votes
1 answer
2k views

Algorithms to find min/max of a single variable function in fixed domain

I was looking for a numerical algorithm to find global minimum or maximum of a function in "given interval [a, b]", for example finding minimum and maximum of function f(x) = sin(x) in domain [3*pi/...
Mahdi Baghbani's user avatar
-1 votes
1 answer
2k views

How are 2nd order ODEs solved in python? With two variables in each of two second order differentials?

I have been given two second order ODEs and I've been asked to solve them with odeint in python. These are the equations: d^x(t)/dt^2 = 10dy(t)/dt + x(t) - (k + 1)(x(t))/z^3 d^2y(t)/dt^2 = - 10dy(t)...
First Name Basis's user avatar
3 votes
0 answers
378 views

Gradient Descent code used to minimize a convex function not finding minima

I am trying to find the geometric median for a set of of n points. For this I have to minimize the sum of sqrt((x-xn)^2+(y-yn)^2). To do this I decided to try a method of Gradient Descents. The ...
wjmccann's user avatar
  • 522
1 vote
1 answer
326 views

Approximating an unknown value in Python

I need to approximate an unknown value, a bound that separates divergent values from those that converge. I'm trying to do so like this: # dont worry about the value of i, its one of many bounds ...
opticaliqlusion's user avatar
-1 votes
4 answers
3k views

Using Python for loop to solve an equation with numerical method

I am learning Python and Probabilities. I have as a given that the expression: c = n! /((n-1)!1!) + 2*n! /((n-2)*2!) + 3*n!/((n-3)*3!) + ...+ n*n!/((n-n)*n! where 0! = 1 and ! signifies 'factorial', ...
im7's user avatar
  • 673
1 vote
2 answers
2k views

Divide a stream into bins with equal counts

Ideally, I want the following without reading the data from hard disk for too many times. The data is big and memory can't hold all of the data at the same time. Input is a stream x[t] from hard disk. ...
hamster on wheels's user avatar
5 votes
4 answers
389 views

Construct an array spacing proportional to a function or other array

I have a function (f : black line) which varies sharply in a specific, small region (derivative f' : blue line, and second derivative f'' : red line). I would like to integrate this function ...
DilithiumMatrix's user avatar

15 30 50 per page