Skip to main content

All Questions

6 votes
3 answers
1k views

Implementation of Euler-Maruyama numerical solver

I am trying to write a python implementation of Euler-Maruyama and Milstein schemes for numerically solving stochastic differential equations. The pseudo-code for the algorithms is in the Wikipedia ...
Quasar's user avatar
  • 397
3 votes
1 answer
350 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 ...
Ξένη Γήινος's user avatar
-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 ...
driver's user avatar
  • 232
1 vote
2 answers
584 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 ...
XMehdi01's user avatar
  • 523
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 ...
XMehdi01's user avatar
  • 523
3 votes
1 answer
556 views

(Google Foobar XOR Checksum Challenge) How do i optimize this function to run for much larger values?

I wrote a function that accepts 2 integers start and length as input and returns the bitwise XOR of certain numbers as described below: ...
Ibrahim-san's user avatar
0 votes
1 answer
70 views

Generating floats from integers

I wanted to make an algorithm that is a counter-example of Cantor's diagonalization argument. Given an integer, this Python code will produce a unique rational number. Fed the sequence of positive and ...
Brent's user avatar
  • 451
2 votes
0 answers
217 views

Maximizing Efficiency of Collatz Conjecture Program Python

My question is very simple. I wrote this program for pure entertainment. It takes a numerical input and finds the length of every Collatz Sequence up to and including that number. I want to make it ...
Ghull's user avatar
  • 41
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
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
2 votes
1 answer
684 views

Binomial Expansion Calculator

So i wrote a program with the documentation for my fx cg50 calculator's micropython to calculate various items, each of which are: Pascal Triangle Entry Pascal Triangle Level/Entire Row Binomial ...
Eren Yaegar's user avatar
6 votes
1 answer
2k views

Scan-line algorithm to fill in a triangle

I wrote the following script to fill a Triangle. ...
Apple_Banana's user avatar
2 votes
1 answer
484 views

Graphing various mathematical functions in Python

1) This code's task is to create graphs of various algebraic, logarithmic and trigonometric functions and relations using Python's matplotlib.plyplot module. ...
notak's user avatar
  • 605
5 votes
2 answers
1k views

Magic Square with Five Methods (Python)

Problem Write a program to return a boolean if an input grid is magic square. A magic square of order \$N\$ is an arrangement of \$N^2\$ distinct integers in a square such that the \$N\$ numbers in ...
Emma's user avatar
  • 3,527

15 30 50 per page