Skip to main content

All Questions

Tagged with
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 ...
Ξένη Γήινος's user avatar
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 ...
Aemyl's user avatar
  • 760
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 ...
Sean Balbuena's user avatar
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 ...
Anit Shrestha's user avatar
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 ...
BlackPanther's user avatar
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 ...
mathishard's user avatar
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 ...
am2021's user avatar
  • 315
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 ...
Levon Avetisyan's user avatar
0 votes
1 answer
428 views

Finding Mersenne primes

An attempt to find Mersenne primes using the Lucas-Lehmer primality test: ...
LOHO's user avatar
  • 11
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 ...
CATboardBETA's user avatar
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 ...
artemis's user avatar
  • 193
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 ...
10GeV's user avatar
  • 295
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 ...
JerryTn's user avatar
  • 19
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 ...
10GeV's user avatar
  • 295
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: ...
Chezhiiyan Sabapathy's user avatar

15 30 50 per page
1 2
3
4 5
14