All Questions
Tagged with mathematics python
201
questions
5
votes
3
answers
885
views
Optimizing Pi Estimation Code
I'm trying to write a program in Python that estimates pi, but to get a more accurate estimation in a feasible amount of time, I want to make it faster.
I'm using a method that estimates the area of ...
4
votes
1
answer
62
views
Array Math to Calculate Ice Thickness -- Need Help Simplifying
I posted this on Stack but since it's working code, it was suggested I post it here. I wrote this code to calculate ice thickness using the following equation from Stephenson, 2011.
It's a daily ...
2
votes
2
answers
75
views
Can I make my percolation in python function more efficient?
We've been tasked with finding out how many randomly distributed discs with radius = 1 it takes to form a chain of discs from the left side to the other of a square with side length = sqrt(n), and ...
2
votes
1
answer
131
views
Multithreaded sparse linear solver in Python
I would like to know if there are any multithreaded sparse linear solvers for LU decomposed sparse matrices.
I want to increase the solving speed of a system like:
...
6
votes
4
answers
436
views
Optimal Solution for the Four Divisors Problem on LeetCode
I recently encountered the Four Divisors problem on LeetCode and managed to achieve a 100% beat rate with my solution. I'd like to share it with you all and gather feedback on its effectiveness and ...
1
vote
1
answer
259
views
Implementing Preconditioned conjugate gradient
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 ...
2
votes
1
answer
255
views
Python integer optimization with PuLP involving polynomials that I think can be faster
I have a problem where we are given multivariate polynomials in variables like y_i and z_j and the goal is to express them as sums of products of terms of the form y_i-z_j with nonnegative integer ...
3
votes
1
answer
349
views
Python function to find the count of digits of numerals in base n up to a given limit
This is a simple exercise to find the count of digits of all numerals in a given base up to a given limit (not including the limit), I wrote it to determine the ratio of bytes saved when the numbers ...
-2
votes
1
answer
185
views
Design an algorithm to predict words based on a skeleton from a given dictionary
The model I'm building first selects a secret word at random from a list. The model which uses an API then returns a row of underscores (space separated)—one for each letter in the secret word—and ...
5
votes
1
answer
287
views
Identify distance degeneracies on square and hexagonal lattices
I have an interest in how the number of ways you can reach from the origin to a certain distance on both square and hexagonal lattices. If L is the square of the distance and integer pairs (i, j) are ...
2
votes
0
answers
80
views
Python script that generates images using Thue-Morse sequence
In mathematics, the Thue–Morse sequence, or Prouhet–Thue–Morse sequence, is the binary sequence (an infinite sequence of 0s and 1s) obtained by starting with 0 and successively appending the Boolean ...
1
vote
2
answers
583
views
Removing Elements from an Array Based on a Second Array
I've written a function that takes two arrays of integers as input and removes all the elements in the first array that are also present in the second array. I would like to share my code with you and ...
1
vote
1
answer
52
views
Optimizing the Dig Pow function
I have written a Python function to solve the Dig Pow problem, where the goal is to find a number k such that the sum of each digit of n raised to a specific and ...
2
votes
1
answer
82
views
Readable Backprogragation calculations in Numpy Neural Network
As an exercise we should write a small Neural Network with the following structure:
There should be additionally a bias for each layer and sigmoid should be used as the activation function.
The ...
0
votes
1
answer
175
views
Graph function in console
I created a program for drawing graphs of functions and want to hear ideas on "how to improve this program", because I'm only starting to write programs in Python. Would be very good to hear ...