Homework 0 – exercise text 2021-01-17, 6:37 PMabout:blank Page 1 of 3IntroductionWelcome to the Learn-OCaml automated grading platform! Your homeworks will be suppliedon this website for the duration of this course.Please check our complete submission guideline here!estion 1 : Fix MeThree functions have been implemented incorrectly in the provided template code:distance: (int * int) -> (int * int) -> float: Given two points (x1, y1) and(x2, y2), return the Euclidean distance between the two points, equivalent to the lengthof a straight line segment connecting the two points. The result should be returned as afloating-point number.hanoi: int -> int: returns the optimal number of moves in the Tower of Hanoipuzzle for a tower of height n. This must be a recursive implementation, using theequation .fact: int -> float: Given a number , return , that is,. The result should be returned as a floating-point number.Did you know?The Tower of Hanoi puzzle, invented by Édouard Lucas in 1883, has since been applied incognitive science research [1], as a method of data backup [2] and even has been solvedby ants! [3]First, write up some tests for these three functions. Write tests for the function distance inthe list named distance_tests , the ones for hanoi in hanoi_tests , and the ones forfact in fact_tests respectively. Some example test cases are provided for the factfunction, but they are incorrect; you should fix them.Note: you should only write test cases for valid inputs, i.e. you should not write tests fornegative numbers for this question.Then, correct the various syntax, type and logical errors contained in the functions’implementations. Use the Compile bu”on at the top-right to help yourself find syntax andtype errors, then use the Grade bu”on to analyze the logical errors.!estion 2 : Hailstone SequenceThe Collatz conjecture is a famous unsolved problem in mathematics, initially introduced byLothar Collatz in 1937. It is based on two simple rules that dictate the progression of asequence of integer numbers. Given a number , the next term in the sequence is obtainedhanoinh = 2 ⋅ + 1n hn-1n ≥ 0 n!n ⋅ (n – 1) ⋅ (n – 2) ⋅ … ⋅ 1nnHomework 0 – exercise text 2021-01-17, 6:37 PMabout:blank Page 2 of 3based on the parity of . If is even, the next term is ; otherwise, the next term is .The conjecture is as follows: no ma”er what number we start with, this Collatz or hailstonesequence issuing from it will always reach the number 1 (and then cycle on with).Did you know?So far, the scientific consensus is that this conjecture is true; however, no proof exists andtests have only verified numbers up to . [4]For this exercise, your goal is to count the number of steps it takes to go from the startingnumber to reach 1. First, write tests for the function; then, implement the function collatz :int -> int. Note that this should use (and thus you should also implement) a helperfunction collatz_helper : int -> int -> int that uses tail recursion to keep track ofthe number of steps done. Also, the top-level function should make sure only positive integersare passed to the helper.!estion 3 : Riemann HypothesisTo continue on the topic of famous unsolved problems, one such problem is the RiemannHypothesis. While it has to do with complex numbers and infinite sequences, we will insteada”empt to evaluate the connected Riemann zeta function at real-valued arguments.Did you know?The Riemann Hypothesis is one of 6 remaining Millenium problems; solving any one ofthem grants incredible prestige as well as $1,000,000! [5]. It also was one of the 23problems that famous mathematician David Hilbert put forth in 1900; only 4 of those,including the Riemann hypothesis, are definitely unresolved presently. [6]The Riemann zeta function is an infinite sum:Your job is to implement a function approx_zeta that approximates the value for a givenfloat , as well as an accuracy value acc . As this is about adding more and more terms,your function’s job is to stop once the next term to add is below acc . As usual, first write upsome tests in the list named zeta_tests . One way you can get the expected outputs for anyinputs for your tests is via WolframAlpha; search for “zeta function at s = 3” for example.We use epsilon_float as the desired accuracy, which in OCaml is the difference betweenn nn23n + 11 → 4 → 2 → 1 → …268ζ(k) = ∑n=1∞n-kζ(k)kHomework 0 – exercise text 2021-01-17, 6:37 PMabout:blank Page 3 of 31.0 and the smallest exactly representable floating-point number greater than 1.0 .Note that we made approx_zeta a local function to be defined inside the function zeta k .This function also makes sure that your function receives values of larger than 2 – while thisfunction is well-defined for even for numbers between 1 and 2, the evaluation would taketoo long for such arguments.Food for thoughtOnly one Millenium Problem has been solved so far: the Poincare Conjecture wassolved by Grigori Perelman in 2002-2003. However, he has turned down the prize anddeclined the Fields Medal – the equivalent of a Nobel Prize in mathematics. Amongstmany speculated reasons, the reason stated by the mathematician was that he foundunfair to be the sole recipient of prizes for this proof, as it would have been impossiblewithout the assistance of Richard S. Hamilton, an American mathematician.kk

- Assignment status: Already Solved By Our Experts
*(USA, AUS, UK & CA PhD. Writers)***CLICK HERE TO GET A PROFESSIONAL WRITER TO WORK ON THIS PAPER AND OTHER SIMILAR PAPERS, GET A NON PLAGIARIZED PAPER FROM OUR EXPERTS**

**NO PLAGIARISM**– CUSTOM PAPER