All Questions
Tagged with mathematics array
10 questions
4
votes
1
answer
82
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 ...
1
vote
1
answer
64
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
2
answers
811
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 ...
4
votes
1
answer
333
views
Simulated annealing for magic square-of-squares puzzle
I'm working on a function that takes in a NumPy array containing only mutually distinct positive square numbers. I want the function to pick an element at random, find if there is a lower positive ...
2
votes
1
answer
2k
views
Menu driven program to represent polynomials as a data structure using arrays
Write a menu-driven program to represent Polynomials as a data
structure using arrays and write functions to add, subtract and
multiply two polynomials; multiply a polynomial with a constant, find
...
5
votes
1
answer
266
views
Optimising Funny Marbles
Problem statement is at http://www.codechef.com/DEC13/problems/MARBLEGF
Lira is given array A, which contains elements between 1000 and 2000.
Three types of queries can be performed on this array: ...
30
votes
3
answers
83k
views
Find all subsets of an int array whose sums equal a given target
I am trying to implement a function below:
Given a target sum, populate all subsets, whose sum is equal to the target sum, from an int array.
For example:
Target ...
2
votes
1
answer
17k
views
Testing if numbers in the array can be added up to equal the largest number in the array
Okay, here's a challenge at Coderbyte that completely stumped me. I came up with a solution, but I know it is flawed.
Have the function ArrayAdditionI(arr) take ...
6
votes
2
answers
10k
views
Finding greatest value in array smaller than x
Code review requested to make this code simpler, cleaner, and better. Input array is sorted.
This program finds the greatest number smaller than x. So, in an ...
4
votes
0
answers
306
views
Summing 2D NumPy array by multiple labels [closed]
Each element of the array is a coordinate (x, y).
Each coordinate has two labels.
Goal:
sum the elements that have the same two labels.
How can this ...