{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Programmare in Python\n", "\n", "## Esercizi: Plots\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "__1 - Fate il grafico della funzione $f = x^3 + x^2 -2\\,x$ in $ -4 \\le x \\le 4$. Il titolo del grafico sia \"Funzione\", il titolo dell'asse x sia \"x\" e quello dell'asse y sia \"f(x)\".__" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "__2 - Fare un unico grafico delle funzioni $f_1 = \\sin(x)$, in blu, e $f_2 = \\sin(2 x)$, in rosso.__" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "__3 - Fare il grafico delle cinque funzioni $f_n = \\frac{(x +n)^n}{n!}$ per $n = 1,2,3,4,5$ e $x$ fra zero e 2, in un unico plot. Inserire delle legende opportune.__ " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "__4 - Create due plot affiancati. Nel primo fate il grafico di $f_1 = \\frac{x^2}{1+x^4}$ in $ -4 \\le x \\le 4$. Nel secondo fate il grafico di $f_2 = \\log (f_1)$ in $ 1 \\le x \\le 10$. Inserite la griglia nei due plot.__" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "__5 - Fate un unico grafico delle funzioni $f_1 = x^2 \\,\\sin(x)$ e $f_2 = x^4\\,\\sin(2 x)$ per $ 0 \\le x \\le 10$ usando una scala logaritmica sull'asse y. Inserire i titoli degli assi e le legende.__" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "__6 - Costruite un array x0 che contenga 101 punti equidistanti fra 0 e 4. Costruite l'array y0 = x\\*\\*2 + 3\\*x. Fate lo scatter plot di y0 in funzione di x0.__" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "__7 - Create quattro plot disposti su due righe. Nei quattro plot il grafico di $f_n = \\frac{x^n -3}{1+x^4}$ per $n$ = 1,2,3,4 in $\\, -4 \\le x \\le 4\\,$. Inserite i titoli e i titoli degli assi in ciascuno dei quattro grafici.____" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "__8 - In un unico grafico, disegnate le funzioni $f_n = x^n$ con $n$ in `range(1,5)` e $0 < x 4$ . Inserite gli elementi grafici opportuni per rendere la figura comprensibile.__" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "__9 - Fate il plot di $\\tan (x)$.__ (D.J.Pine, Introduction to Python for Science and Engineering, 6.2.3)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "__10 -Fate, in un unico plot, il grafico di un cerchio di raggio 2 centrato nell'origine e di un esagono inscritto nel cerchio.__ " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "hide_input": false, "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.12" }, "toc": { "base_numbering": 1, "nav_menu": {}, "number_sections": true, "sideBar": true, "skip_h1_title": true, "title_cell": "Table of Contents", "title_sidebar": "Contents", "toc_cell": false, "toc_position": {}, "toc_section_display": true, "toc_window_display": false }, "varInspector": { "cols": { "lenName": 16, "lenType": 16, "lenVar": 40 }, "kernels_config": { "python": { "delete_cmd_postfix": "", "delete_cmd_prefix": "del ", "library": "var_list.py", "varRefreshCmd": "print(var_dic_list())" }, "r": { "delete_cmd_postfix": ") ", "delete_cmd_prefix": "rm(", "library": "var_list.r", "varRefreshCmd": "cat(var_dic_list()) " } }, "types_to_exclude": [ "module", "function", "builtin_function_or_method", "instance", "_Feature" ], "window_display": false } }, "nbformat": 4, "nbformat_minor": 4 }