Solved

Diophantine Equations (Inspired by Project Euler, problem 66)

Consider the quadratic Diophantine equation of the form: x^2 – Dy^2 = 1 When D=13, the minimal solution in x is 649^2 – 13...

3 years ago

Solved

Make a Star Pyramid

Create a star pyramid. First line will have 1 star, second will have two stars and so on... a basic program which is easily done...

3 years ago

Solved

Create Volcano (or Atoll) martix. It is an extension of Bullseye matrix problem.

For example, if n=2 (maximum value), the output matrix should be [1 1 1 1 1; 1 2 2 2 1; 1 2 1 2 1; 1 2 2 2 1; 1...

3 years ago

Solved

The Birthday Phenomenon

First off, leap years are not being considered for this. In fact the year that people are born shouldn't be taken into considera...

3 years ago

Solved

Vector to 3-Column Matrix

Consider a vector *A* such as A = [1 2 3 3 4 5 6] Can you convert this vector to a three-column matrix like this: ...

3 years ago

Solved

Moving average (variable kernel length)

Find the moving average in a vector. The kernel length is a variable. For example x = 1:10 kernel_length = 2 would r...

3 years ago

Solved

Mirror Image matrix across anti-diagonal

Given an input number x, create a mirror image matrix 'Y' across the anti-diagonal. For example, if x=3, Y = [1 2 3; ...

3 years ago

Solved

Volume of Spherical Shell

In three-dimensional space, a spherical shell can be constructed from two concentric spheres. Determine the volume of a spheric...

3 years ago

Solved

Calculating Ring Area

In two-dimensional space, a ring can be constructed by using two concentric circles. Determine the area of a ring which has r1 ...

3 years ago

Solved

Given a matrix A (size m x n) create a matrix B (size m+2 x n+2) which consists of matrix A surrounded by zeros. See Example below:

A = [1 2 3 4 5 6] ----------- B = [0 0 0 0 0 0 1 2 3 0 0 4 5 6 0 0 0 0 0 0]

3 years ago

Solved

Given a matrix A (size m x n) create a matrix B which consists of matrix A sorted in descending order by columns and then by rows.

--------------- A= [ 2 6 -3 7 12 0 -12 5 1] --------------- B= [12 7 1 6 2 0 5 -3 ...

3 years ago

Solved

Given a Vector v1, create v2 which is the sum of each two adjacent elements in v1. {length(v2)=length(v1)-1}

if v1 is [1 2 3 4 5 6 7 8] then v2 should be [3 5 7 9 11 13 15]. if v1 is [1; 3; 5; 7] the...

3 years ago

Solved

Back to basics 16 - byte order

Covering some basic topics I haven't seen elsewhere on Cody. Switch the byte order of the input (i.e. if little-endian -> big...

3 years ago

Solved

Back to basics 2 - Function Path

Covering some basic topics I haven't seen elsewhere on Cody. Given a string that is the name of a MATLAB function, return a s...

3 years ago

Solved

Sum the elements in either diagonal of a square matrix

Sum the elements of a square matrix that lie on either the major diagonal or anti-diagonal. (Include all elements that are part ...

3 years ago

Solved

Back to basics 18 - justification

Covering some basic topics I haven't seen elsewhere on Cody. Given a string with extra spaces in front and/or in back, return...

3 years ago

Solved

Calculate Euler's phi function

Compute the Euler's phi function of a large integer. For more information about this topic please visit: <https://en.wikiped...

3 years ago

Solved

Ackermann's Function

Ackermann's Function is a recursive function that is not 'primitive recursive.' <http://en.wikipedia.org/wiki/Ackermann_fun...

3 years ago

Solved

Generalized Laguerre polynomials

Given an integer _n_ ≥ 0 and a scalar _a_, generate the _n_-th <http://en.wikipedia.org/wiki/Laguerre_polynomials#Generalized...

3 years ago

Solved

Legendre polynomials

Given an integer _n_ ≥ 0, generate the _n_-th <http://en.wikipedia.org/wiki/Legendre_polynomials Legendre polynomial>. *Ex...

3 years ago

Solved

Radial Zernike polynomials

Given an integer _n_ ≥ 0 and an integer _m_ ≥ 0, generate the <http://en.wikipedia.org/wiki/Zernike_polynomials radial Zer...

3 years ago

Solved

Chebyshev polynomials of the 2nd Kind

Given an integer _n_ ≥ 0, generate the _n_-th <http://en.wikipedia.org/wiki/Chebyshev_polynomials Chebyshev polynomial of the...

3 years ago

Solved

Chebyshev polynomials of the 1st Kind

Given an integer _n_ ≥ 0, generate the _n_-th <http://en.wikipedia.org/wiki/Chebyshev_polynomials Chebyshev polynomial of the...

3 years ago

Solved

Transpose the Matrix

Transpose the given matrix, e.g. x=[a b;c d] transpose of x = [a c;b d]

3 years ago

Solved

Prime numbers between a , b.

Find all prime number between a & b (including a and b). example: a=100 b=120 y= [101 103 107 109 113]

3 years ago

Solved

Sum of diagonals

Compute the sum of diagonal elements of a square matrix and store the larger sum to s. Eg : a = [1 2 3; 2 3 4; 4 5 10] ...

3 years ago

Solved

Repetition of matrices

*A is a bold matrix: [1 2 3; 4 5 6;7 8 9]* Given an integer 'n' , a matrix B exists such that has n copies of A in the row an...

3 years ago

Solved

Calories in a slice of pizza?

The total calories C in a pizza is printed on its box. You know the angle A (degrees) of the slice you placed on your plate. Ple...

3 years ago

Solved

0<=x<=pi?

Check whether the given angle is between zero and pi. Return logical true or false.

3 years ago