Exercises lecture 2

ClearAll["Global`*"];SetDirectory[NotebookDirectory[]]

Exercise 1 : Calculating Fibonacci Numbers

Write a Mathematica code to calculate Fibonacci numbers . The Fibonacci sequence starts with 0 and 1, and each subsequent number is the sum of the two preceding numbers . Your code should generate a list of Fibonacci numbers up to a specified limit . Requirements : The code should have a function that takes an integer n as input and generates a list of Fibonacci numbers up to the nth term . The code should display the list of Fibonacci numbers .

Exercise 2: plot a unit triangular region filled with random points, as in this plot (your result doesn’t have to be identical, provided it satisfies the conditions)

Exercise 3: plot N (write the code for arbitrary N, but show the plot for say N=10) random parabolae (i.e. parabolae with random coefficients between -1 and 1)

Exercise 4. Define a function f[a_,prec_] that gives the numerical integral of Sin[Exp[-x^2 - y^2]] between -3 and a, both for x and y, where prec is the PrecisionGoal and also the WorkingPrecision digits. Make a ListPlot that shows how the time it takes the integral for a=3 depends on prec, with prec in the range 4-12. Show (visually) that the trend it is well approximated by an exponential. Don’t worry about warning messages!