{ "nbformat_minor": 2, "nbformat": 4, "cells": [ { "source": [ "$$\n", "\\def\\CC{\\bf C}\n", "\\def\\QQ{\\bf Q}\n", "\\def\\RR{\\bf R}\n", "\\def\\ZZ{\\bf Z}\n", "\\def\\NN{\\bf N}\n", "$$\n", "# Functions `def`\n", "\n", "## Exercise 1\n", "\n", "Write a function computing the area of a triangle from the length of the three sides:" ], "cell_type": "markdown", "metadata": {} }, { "execution_count": null, "cell_type": "code", "source": [ "# edit here" ], "outputs": [], "metadata": {} }, { "source": [ "## Exercise 2\n", "\n", "The duration of sunshine $D(\\beta, d)$ on a given place on Earth is given by the formula\n", "\n", "$$D(\\beta,d) = 24 - \\frac{24}{\\pi}\\arccos\\left( \\tan \\beta \\cdot\n", "\\tan\\left(\\arcsin\\left(\\sin(\\kappa)\\cdot \\sin\\left(\\frac{2\\pi}{365}d\n", "\\right)\\right)\\right)\\right)$$\n", "\n", "where $\\kappa=\\frac{23.44}{180}\\pi$ is the inclination of the eart in radian, $d\\in[0,365]$ is the number of days after the spring equinox and $\\beta\\in[-\\pi/2,\\pi/2]$ is the latitude of the place in question. Write the function `D(beta, d)` :" ], "cell_type": "markdown", "metadata": {} }, { "execution_count": null, "cell_type": "code", "source": [ "# edit here" ], "outputs": [], "metadata": {} }, { "source": [ "Construct the list of duration of sunshine in Marseille for the 31 days of the month of July 2017:" ], "cell_type": "markdown", "metadata": {} }, { "execution_count": null, "cell_type": "code", "source": [ "# edit here" ], "outputs": [], "metadata": {} }, { "source": [ "## Exercise 3\n", "\n", "Let the sequence $u_{n+1}= \\frac{1}{1+u_n^2}$ with $u_0=0$. Write a function `U(n)` which returns the value of $u_n$. Compute $u_{20}$ :" ], "cell_type": "markdown", "metadata": {} }, { "execution_count": null, "cell_type": "code", "source": [ "# edit here" ], "outputs": [], "metadata": {} }, { "source": [ "## Exercise 4\n", "\n", "Write a function `product_of_digits(n)` which returns the product of the digits of $n$ written in base $10$ :" ], "cell_type": "markdown", "metadata": {} }, { "execution_count": null, "cell_type": "code", "source": [ "# edit here" ], "outputs": [], "metadata": {} } ], "metadata": { "kernelspec": { "display_name": "sagemath", "name": "sagemath" } } }