All Questions
Tagged with mathematics python
202
questions
3
votes
3
answers
467
views
Python program to find all possible ways an integer num can be expressed as sum of integers between 1 and lim
This is a Python program that finds all possible ways a positive integer num can be expressed a sum of a number of integers between 1 and ...
6
votes
1
answer
677
views
Calculating decimal places of pi in Python
I have written this small program in Python to calculate decimal places of \$\pi\$. I tried to code it as readably as possible, but since this is a bit calculation heavy, it is reasonable to think ...
1
vote
2
answers
67
views
Ask 2 terms from user and add them
I'm making a program that can add 2 terms that the user types.
I think I've got identifying or evaluating the terms down. I used classes because I just recently learned it and I also heard it was good ...
1
vote
0
answers
174
views
Applied Solution Based On Polya Enumeration Theorem
Problem
A function solution(w, h, s) that takes 3 integers and returns the number of unique, non-equivalent configurations that can be found on a grid w blocks wide, h blocks tall and s possible ...
4
votes
2
answers
140
views
Formula filler and calculator
So I made this script for my calculator, so that I can just write whatever formula I want and the calculator would just ask for the missing pieces to do the calculations.
I made it so that it would be ...
3
votes
2
answers
72
views
Runge Kutta 2 Python ODE fluid flow
I am trying to solve a set of differential equations in x,y,z, I have made simple kutta 2 code in python before but not with 3 variables. I am not sure if what i have done is an acceptable way to ...
1
vote
1
answer
3k
views
Lo Shu Magic Square (Python)
I wrote a python program to find if a matrix is a magic square or not. It works, but I can't help feeling like I may have overcomplicated the solution. I have seen other implementations that were a ...
2
votes
2
answers
775
views
Finding distance between vectors of matrices
So here is the problem:
Given 2D numpy arrays 'a' and 'b' of sizes n×m and k×m
respectively and one natural number 'p'. You need to find the
distance(Euclidean) of the rows of the matrices 'a' and ...
0
votes
1
answer
428
views
Finding Mersenne primes
An attempt to find Mersenne primes using the Lucas-Lehmer primality test:
...
0
votes
2
answers
105
views
Small Python math library
I have been writing a math library with more options than the standard builtin one, partially to make my life easier in the future, and partially just for practice.
Here is what I have so far in the ...
5
votes
1
answer
207
views
Algorithm Optimization -- Automatic Dimensionality of PCA
I have implemented (rather, edited the implementation of) a technique to automatically detect the optimal number of dimensions for PCA, based off of this paper.
This was inspired by ...
5
votes
1
answer
433
views
Bancroft's method implementation
Background
I've written an algorithm to solve the three-dimensional Time Difference of Arrival (TDoA) multi-lateration problem. That is, given the coordinates of n ...
1
vote
1
answer
570
views
Coin Flip Streaks script
I am attempting to complete the coin flip streaks problem from automate the boring stuff with python.
My code works fine but my only concern is the phrasing of the task.
Does the question want us to ...
2
votes
0
answers
203
views
Gradient descent algorithm for solving localization problem in 3-dimensional space
Task
This code accomplishes the Time Difference of Arrival (TDoA) multilateration problem (see) using gradient descent (known otherwise as steepest descent).
Goal
I'm looking to:
a) Improve speed:
In ...
9
votes
5
answers
5k
views
Efficiently find all the Pythagorean triplets where all numbers less than 1000
How can I make this code run faster:
...