I need you to develop some software for me. I would like this software to be developed for Windows.
3 small functions in matlab.
1. Write a function that receives a number n and determine if it is a prime number (output 1) or not (output 0). You can not use the ‘isprime’ function.
2. Write a script to calculate the value of x in the following nested square root for different numbers of square roots. Plot the value of x versus the number of square roots. Does it converge to a specific number?
3. Confirm Kepler’s 3rd Law (Harmonic Law) and estimate the mass of the Sun
If the orbital period, P is in years and the orbit semimajor axis, a is in AU then P2 = a3. If SI units (mks) are used, the Harmonic Law becomes P2 = 4π2 a3. In some files, GM⊙ these variables are stored separately ([login to view URL] and [login to view URL]) and in ([login to view URL], the semimajor axis is the first row of data and orbital period is the second. The files are small, explore them using a text editor before beginning. N.B. The data in [login to view URL] are in AU (Earth = 1) and in [login to view URL] the data have units of Earth-years. In [login to view URL] and [login to view URL], the units are SI, [a] = m and [P ] = s. G = 6.67 × 10−11m3kg−1s−2.
(a) Use load to read the files
[login to view URL] and [login to view URL] and confirm Kepler’s Third Law by plotting P2 vs. a3. The plot must have x- and y-labels and a title. Use csvwrite to write the estimates to a CSV file called [login to view URL]
(b) Use dlmread to read the file planets.tab. Use the data to create a vector with 8 estimates for the Sun’s mass (one for each planet, which individually satisfy the Harmonic Law). Use dlmwrite to write the estimates to a tab-delimited file called [login to view URL]