laboratorio di matematica con sagemathuniversitÀ telematica internazionale uninettuno 3...
TRANSCRIPT
![Page 1: Laboratorio di Matematica con SageMathUNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO 3 Introduzione •Scopo della tesi: –presentare SageMath, un programma software CAS ... Laboratorio](https://reader034.vdocumenti.com/reader034/viewer/2022042804/5f59318a72946f3813639b4a/html5/thumbnails/1.jpg)
UNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNOUNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO
Facoltà di Ingegneria - Corso di Laurea triennale in Ingegneria Informatica
Tesi di Laurea in Calcolo e Algebra Lineare
Laboratorio di Matematica con SageMath
Relatore: Prof. Domenico Finco Laureando: Agatino Grillo
Anno Accademico: 2018/19
Roma, 20/11/2019
![Page 2: Laboratorio di Matematica con SageMathUNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO 3 Introduzione •Scopo della tesi: –presentare SageMath, un programma software CAS ... Laboratorio](https://reader034.vdocumenti.com/reader034/viewer/2022042804/5f59318a72946f3813639b4a/html5/thumbnails/2.jpg)
UNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO
2
Indice
• Introduzione
• Cos’è SageMath?
• Laboratorio SageMath
– Calcolo
– Algebra Lineare
– Metodi matematici
• ConclusioniSpirale di Archimede
![Page 3: Laboratorio di Matematica con SageMathUNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO 3 Introduzione •Scopo della tesi: –presentare SageMath, un programma software CAS ... Laboratorio](https://reader034.vdocumenti.com/reader034/viewer/2022042804/5f59318a72946f3813639b4a/html5/thumbnails/3.jpg)
UNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO
3
Introduzione
• Scopo della tesi:
– presentare SageMath , un programma software CAS (Computer Algebra System), capace di rappresentare e risolvere espressioni matematiche in forma simbolica e numerica
– usare SageMath per esercitazioni di:
• Calcolo
• Algebra Lineare
• Metodi Matematici
http://www.sagemath.org/
Laboratorio di
Matematica
![Page 4: Laboratorio di Matematica con SageMathUNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO 3 Introduzione •Scopo della tesi: –presentare SageMath, un programma software CAS ... Laboratorio](https://reader034.vdocumenti.com/reader034/viewer/2022042804/5f59318a72946f3813639b4a/html5/thumbnails/4.jpg)
UNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO
4
• Caratteristiche di SageMath:– gratuito ed open source
– facile da usare• https://sagecell.sagemath.org/
– creato e gestito in primis da docenti e ricercatori universitari• SageDays https://wiki.sagemath.org/Workshops
– interfaccia unica che integra anche altri programmi e pacchetti open source e commerciali
• R,
• Maxima,
• Scypy,
• Numpy,
• Mathematica
• …
Cos’è SageMath?
![Page 5: Laboratorio di Matematica con SageMathUNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO 3 Introduzione •Scopo della tesi: –presentare SageMath, un programma software CAS ... Laboratorio](https://reader034.vdocumenti.com/reader034/viewer/2022042804/5f59318a72946f3813639b4a/html5/thumbnails/5.jpg)
UNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO
5
var('t')
x(a,t) = 2*a*(1+cos(t))*cos(t)
y(a,t) = 2*a*(1+cos(t))*sin(t)
cardioides = parametric_plot((x(0.5,t), y(0.5,t)),
(t,0,2*pi), color='#8A4B08', legend_label='a=1/2')
cardioides += parametric_plot((x(1,t), y(1,t)),
(t,0,2*pi), color='#B45F04', legend_label='a=1')
cardioides += parametric_plot((x(2,t), y(2,t)),
(t,0,2*pi), color='#FF8000', legend_label='a=2')
cardioides += parametric_plot((x(4,t), y(4,t)),
(t,0,2*pi), color='#FE9A2E', legend_label='a=4')
cardioides.set_legend_options(loc=(1,0.8))
show(cardioides, aspect_ratio=1)
Type some Sage code below and press Evaluate.
Cos’è SageMathFacile da
usare
https://sagecell.sagemath.org/
Equazioni parametriche
![Page 6: Laboratorio di Matematica con SageMathUNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO 3 Introduzione •Scopo della tesi: –presentare SageMath, un programma software CAS ... Laboratorio](https://reader034.vdocumenti.com/reader034/viewer/2022042804/5f59318a72946f3813639b4a/html5/thumbnails/6.jpg)
UNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO
6
Cos’è SageMath
@interact
def tangent_line(f =
input_box(default=sin(x
)), xbegin =
slider(0,10,1/10,0),
xend =
slider(0,10,1/10,10),
x0 = slider(0, 1,
1/100, 1/2)):
(…)
prange[1])[0]
show(fplot +
tanplot, xmin =
prange[0], xmax =
prange[1], ymax = fmax,
ymin = fmin)
Interattivo
https://bit.ly/2KaA56O /
![Page 7: Laboratorio di Matematica con SageMathUNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO 3 Introduzione •Scopo della tesi: –presentare SageMath, un programma software CAS ... Laboratorio](https://reader034.vdocumenti.com/reader034/viewer/2022042804/5f59318a72946f3813639b4a/html5/thumbnails/7.jpg)
UNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO
7
print ("l'integrale della
funzione"), sin(log(x)), (" è: ")
show ((sin(log(x))).integral(x))
Cos’è SageMath?
l'integrale della funzione sin(log(x)) è:
f = sin(log(x))
f.integral(x,0,pi)
table([
["il risultato di", r'$\int_{0}^{\pi}
sin(x)$', "è", f.integral(x,0,pi)],])
Tipografico
Latexcompatibile
https://bit.ly/2Q66b7k
https://bit.ly/36UFHfg
![Page 8: Laboratorio di Matematica con SageMathUNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO 3 Introduzione •Scopo della tesi: –presentare SageMath, un programma software CAS ... Laboratorio](https://reader034.vdocumenti.com/reader034/viewer/2022042804/5f59318a72946f3813639b4a/html5/thumbnails/8.jpg)
UNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO
8
Cos’è SageMath?
8
• algebra, analisi matematica, analisi numerica, calcolo combinatorio, geometria, teoria dei numeri
Teoria dei grafi
Calcolo vettoriale matrici
traiettorie
Analisi
Aree di specializza
zione
![Page 9: Laboratorio di Matematica con SageMathUNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO 3 Introduzione •Scopo della tesi: –presentare SageMath, un programma software CAS ... Laboratorio](https://reader034.vdocumenti.com/reader034/viewer/2022042804/5f59318a72946f3813639b4a/html5/thumbnails/9.jpg)
UNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO
9
• Esempio tratto dalla classe interattiva di “Calcolo e Algebra Lineare” del 13 novembre 2018
Laboratorio di matematica
show(limit (f, x=1, dir='+'))
Testo esercitazione
Si studi la funzione
tracciandone il grafico
Calcolo
![Page 10: Laboratorio di Matematica con SageMathUNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO 3 Introduzione •Scopo della tesi: –presentare SageMath, un programma software CAS ... Laboratorio](https://reader034.vdocumenti.com/reader034/viewer/2022042804/5f59318a72946f3813639b4a/html5/thumbnails/10.jpg)
UNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO
10
• Studio di una funzione – approccio metodologico
• Campo di esistenza• Intersezione con gli assi• Studio del segno• Limiti ai bordi del campo di esistenza• Derivata prima• Derivata seconda• Grafico della funzione
Laboratorio di matematicaCalcolo
![Page 11: Laboratorio di Matematica con SageMathUNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO 3 Introduzione •Scopo della tesi: –presentare SageMath, un programma software CAS ... Laboratorio](https://reader034.vdocumenti.com/reader034/viewer/2022042804/5f59318a72946f3813639b4a/html5/thumbnails/11.jpg)
UNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO
11
Laboratorio di matematicaCalcolo
Testoesercitazione
Imponiamo che il denominatore siadiverso da zero:
CodiceSageMath
solve((abs(3*x-2)-1)== 0, x, to_poly_solve=True)
Risultato [x == (1/3), x == 1]
• Campo di esistenza: si tratta di una funzione fratta per cui il denominatore non può assumere valore zero
1
2
![Page 12: Laboratorio di Matematica con SageMathUNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO 3 Introduzione •Scopo della tesi: –presentare SageMath, un programma software CAS ... Laboratorio](https://reader034.vdocumenti.com/reader034/viewer/2022042804/5f59318a72946f3813639b4a/html5/thumbnails/12.jpg)
UNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO
12
Laboratorio di matematicaCalcolo
Testoesercitazione
Si deve risolvere:
CodiceSageMath
f=arctan(1)show(f)
Risultato
• Intersezione con gli assi
4,0
41
1arctan
1|2|
0|1|arctan
1|203|
0|102|arctan
1
2
![Page 13: Laboratorio di Matematica con SageMathUNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO 3 Introduzione •Scopo della tesi: –presentare SageMath, un programma software CAS ... Laboratorio](https://reader034.vdocumenti.com/reader034/viewer/2022042804/5f59318a72946f3813639b4a/html5/thumbnails/13.jpg)
UNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO
13
Laboratorio di matematicaCalcolo
Testoesercitazione
Si deve risolvere:
CodiceSageMath
eq1= (abs(2*x+1)-x) >= 0eq2= x >= -1/2show(solve([eq1,eq2],x))
Risultato
• Studio del segno
01|23|
|12|
x
xx
![Page 14: Laboratorio di Matematica con SageMathUNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO 3 Introduzione •Scopo della tesi: –presentare SageMath, un programma software CAS ... Laboratorio](https://reader034.vdocumenti.com/reader034/viewer/2022042804/5f59318a72946f3813639b4a/html5/thumbnails/14.jpg)
UNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO
14
Laboratorio di matematicaCalcolo
show(limit (f, x=1, dir='+'))
• Limiti ai bordi del campo di esistenza
Limite per x che tende a 1 di f(x) da destra
f=arctan((abs(2*x+1)-x)/ (abs(3*x-2)-1))show(limit (f, x=1, dir='+'))
Testo Codice SageMath Risultato
Limite per x che tende a 1 di f(x) da sinistra
f=arctan((abs(2*x+1)-x)/ (abs(3*x-2)-1))show(limit (f, x=1, dir=‘-'))
show(limit (f, x=1, dir='+'))
Limite per x che tende a 1/3 di f(x) da destra
f=arctan((abs(2*x+1)-x)/ (abs(3*x-2)-1))show(limit (f, x=1/3, dir='+'))
Limite per x che tende a ∞ di f(x) da destra
f=arctan((abs(2*x+1)-x)/ (abs(3*x-2)-1))show(limit (f, x=+oo))
![Page 15: Laboratorio di Matematica con SageMathUNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO 3 Introduzione •Scopo della tesi: –presentare SageMath, un programma software CAS ... Laboratorio](https://reader034.vdocumenti.com/reader034/viewer/2022042804/5f59318a72946f3813639b4a/html5/thumbnails/15.jpg)
UNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO
15
Laboratorio di matematicaCalcolo
show(limit (f, x=1, dir='+'))
• Limiti ai bordi del campo di esistenza:
Limite per x che tende a ∞ di f(x) da sinistra
f=arctan((abs(2*x+1)-x)/ (abs(3*x-2)-1))show(limit (f, x=-oo))
Testo Codice SageMath Risultato
abbiamo 2 asintoti orizzontali e nessun asintoto verticale
![Page 16: Laboratorio di Matematica con SageMathUNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO 3 Introduzione •Scopo della tesi: –presentare SageMath, un programma software CAS ... Laboratorio](https://reader034.vdocumenti.com/reader034/viewer/2022042804/5f59318a72946f3813639b4a/html5/thumbnails/16.jpg)
UNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO
16
Laboratorio di matematicaCalcolo
• Derivata prima
Testoesercitazione
Per calcolare la derivata primaapriamo il modulo
f1=arctan((x+1)/(3*x-3))show(simplify((derivative (f1))))
Codice SageMath Risultato
![Page 17: Laboratorio di Matematica con SageMathUNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO 3 Introduzione •Scopo della tesi: –presentare SageMath, un programma software CAS ... Laboratorio](https://reader034.vdocumenti.com/reader034/viewer/2022042804/5f59318a72946f3813639b4a/html5/thumbnails/17.jpg)
UNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO
17
Laboratorio di matematicaCalcolo
• Derivata prima
f3=arctan((3*x+1)/(-3*x+1))show(simplify((derivative (f3))))
Codice SageMath Risultato
f2=arctan((x+1)/(-3*x+1))show(simplify((derivative (f2))))
Codice SageMath Risultato
Nella 1° regione la funzione è sempre decrescente, nella 2° regione è sempre crescente, nella 3° sempre decrescente.
1
In x=2/3 e x=1/2 ci sono dei “punti angolosi” cioè la derivata prima ha limiti finiti a destra e sinistra ma diversi tra loro
2
![Page 18: Laboratorio di Matematica con SageMathUNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO 3 Introduzione •Scopo della tesi: –presentare SageMath, un programma software CAS ... Laboratorio](https://reader034.vdocumenti.com/reader034/viewer/2022042804/5f59318a72946f3813639b4a/html5/thumbnails/18.jpg)
UNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO
18
Laboratorio di matematicaCalcolo
• Derivata seconda
f1=arctan((x+1)/(3*x-3))fp=derivative (f1,x)fpp=derivative (fp,x)show(fpp)
Codice SageMath Risultato
f2=arctan((x+1)/(-3*x+1))fp=derivative (f2,x)fpp=derivative (fp,x)show(fpp)
f3=arctan((3*x+1)/(-3*x+1))fp=derivative (f3,x)fpp=derivative (fp,x)show(fpp)
![Page 19: Laboratorio di Matematica con SageMathUNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO 3 Introduzione •Scopo della tesi: –presentare SageMath, un programma software CAS ... Laboratorio](https://reader034.vdocumenti.com/reader034/viewer/2022042804/5f59318a72946f3813639b4a/html5/thumbnails/19.jpg)
UNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO
19
Laboratorio di matematicaCalcolo
• Derivata seconda
Fatte le opportune semplificazioni otteniamo:
La derivata seconda è positiva quindi la funzione è convessa per x> 2 e per x compreso tra -1/2 e 0 e ci sono dei flessi per x=-1/2 e x=2/3
![Page 20: Laboratorio di Matematica con SageMathUNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO 3 Introduzione •Scopo della tesi: –presentare SageMath, un programma software CAS ... Laboratorio](https://reader034.vdocumenti.com/reader034/viewer/2022042804/5f59318a72946f3813639b4a/html5/thumbnails/20.jpg)
UNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO
20
Laboratorio di matematicaCalcolo
• Grafico della funzione
pt1 = point((1/3, 0), rgbcolor='red', pointsize=50, faceted=True)tex1=text("(1/3, 0)", (1/3, 0.1))
(…)
g.show(xmin=-2, xmax=2, ymin=-1.5, ymax=1.5)
Codice SageMath Risultato
https://bit.ly/2q2Mbb3
![Page 21: Laboratorio di Matematica con SageMathUNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO 3 Introduzione •Scopo della tesi: –presentare SageMath, un programma software CAS ... Laboratorio](https://reader034.vdocumenti.com/reader034/viewer/2022042804/5f59318a72946f3813639b4a/html5/thumbnails/21.jpg)
UNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO
21
Laboratorio di matematicaAlgebraLineare
• Fonte: “aula virtuale n. 50.4 Diagonalizzazione di Matrici”
show(limit (f, x=1, dir='+'))
Data la matrice
Se ne discuta la diagonalizzabilità e se ne determino autovalori e autovettori
A=matrix(2,2,[3,4,4,3])show(A)
Testo Codice SageMath Risultato
![Page 22: Laboratorio di Matematica con SageMathUNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO 3 Introduzione •Scopo della tesi: –presentare SageMath, un programma software CAS ... Laboratorio](https://reader034.vdocumenti.com/reader034/viewer/2022042804/5f59318a72946f3813639b4a/html5/thumbnails/22.jpg)
UNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO
x^2 - 6*x – 7
22
Laboratorio di matematicaAlgebraLineare
show(limit (f, x=1, dir='+'))
Costruisco la matrice
Calcolo il determinante della nuova matrice
cioè il polinomio caratteristico è
Le radici del polinomio caratteristico sono:
A=matrix(2,2,[3,4,4,3])
A.characteristic_polynomial()
Testo Codice SageMath Risultato
x^2 - 6*x – 7
e
A.eigenvalues() x^2 - 6*x – 7[7, -1]
![Page 23: Laboratorio di Matematica con SageMathUNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO 3 Introduzione •Scopo della tesi: –presentare SageMath, un programma software CAS ... Laboratorio](https://reader034.vdocumenti.com/reader034/viewer/2022042804/5f59318a72946f3813639b4a/html5/thumbnails/23.jpg)
UNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO
23
Laboratorio di matematicaAlgebraLineare
e
x^2 - 6*x – 7## In SageMath posso calcolare ## immediatamente gli autovettori## (eigenvectors in inglese)
show(A.eigenvectors_right())
Codice SageMath Risultato
che indica che in corrispondenza dell’autovalore 7 abbiamo l’autovettore (1,1) di molteplicità 1 e che in corrispondenza dell’autovalore -1 abbiamo l’autovettore (1,-1) di molteplicità 1
1
Quindi abbiamo una base di auto vettori e la matrice è diagonalizzabile e con questa base la matrice diventa 2
![Page 24: Laboratorio di Matematica con SageMathUNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO 3 Introduzione •Scopo della tesi: –presentare SageMath, un programma software CAS ... Laboratorio](https://reader034.vdocumenti.com/reader034/viewer/2022042804/5f59318a72946f3813639b4a/html5/thumbnails/24.jpg)
UNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO
24
Laboratorio di matematicaMetodi
Matematici
• Fonte: aula virtuale di “Metodi matematici” di gennaio 2017
show(limit (f, x=1, dir='+'))
Data la funzione
Valutare massimi e minimi assoluti e relativi all’interno di un dominio scelto ecioè il dominio A formato da
mentre la è definita su tutto
Testo esercitazione
𝑓 𝑥, 𝑦
![Page 25: Laboratorio di Matematica con SageMathUNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO 3 Introduzione •Scopo della tesi: –presentare SageMath, un programma software CAS ... Laboratorio](https://reader034.vdocumenti.com/reader034/viewer/2022042804/5f59318a72946f3813639b4a/html5/thumbnails/25.jpg)
UNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO
25
• Massimi e minimi di 2 variabili – approccio metodologico
• Calcolo del gradiente• Calcolo dei punti stazionari• Calcolo della matrice Hessiana • Studio del segno delle matrici Hf
Laboratorio di matematicaMetodi
Matematici
![Page 26: Laboratorio di Matematica con SageMathUNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO 3 Introduzione •Scopo della tesi: –presentare SageMath, un programma software CAS ... Laboratorio](https://reader034.vdocumenti.com/reader034/viewer/2022042804/5f59318a72946f3813639b4a/html5/thumbnails/26.jpg)
UNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO
26
Laboratorio di matematica
1. Calcolo del gradiente
Calcoliamo il gradiente della funzione cioè le 2 derivate parziali prime rispetto a x
e y che poi poniamo uguale a 0 per calcolare le soluzioni del sistema.
SageMath permette di calcolare direttamente il gradiente di una funzione di 2 variabilicon il comando gradient
var('y')f(x,y)=x^2+y^2-(x+y)show(f.gradient());
Codice SageMath Risultato
Metodi Matematici
![Page 27: Laboratorio di Matematica con SageMathUNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO 3 Introduzione •Scopo della tesi: –presentare SageMath, un programma software CAS ... Laboratorio](https://reader034.vdocumenti.com/reader034/viewer/2022042804/5f59318a72946f3813639b4a/html5/thumbnails/27.jpg)
UNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO
27
Laboratorio di matematica
2. Calcolo dei punti stazionari
Calcoliamo i punti che annullano il gradiente per ottenere i punti stazionari imponendo lacondizione:
var ('x','y')eq1= 2*x - 1eq2= 2*y -1show(solve([eq1,eq2],x,y))
Codice SageMath Risultato
che equivale a risolvere il sistema di 2 equazioni in 2 incognite
Il risultato è che il punto in cui il gradiente si annulla è
Metodi Matematici
![Page 28: Laboratorio di Matematica con SageMathUNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO 3 Introduzione •Scopo della tesi: –presentare SageMath, un programma software CAS ... Laboratorio](https://reader034.vdocumenti.com/reader034/viewer/2022042804/5f59318a72946f3813639b4a/html5/thumbnails/28.jpg)
UNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO
28
Laboratorio di matematica3. Calcolo della matrice Hessiana
Calcoliamo la matrice Hessiana di f Hf definita come la matrice delle derivate parziali secondedi f
var('y')f(x,y)=x^2+y^2-(x+y)show(f.hessian())
Codice SageMath Risultato
Il risultato è che il punto in cui il gradiente si annulla è
Metodi Matematici
dove indica la derivata parziale rispetto a ydella derivata parziale rispetto a x
![Page 29: Laboratorio di Matematica con SageMathUNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO 3 Introduzione •Scopo della tesi: –presentare SageMath, un programma software CAS ... Laboratorio](https://reader034.vdocumenti.com/reader034/viewer/2022042804/5f59318a72946f3813639b4a/html5/thumbnails/29.jpg)
UNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO
4
29
Laboratorio di matematica4. Studio del segno delle matrici Hf
Calcoliamo il determinante della matrice Hessiana e il segno della stessa matrice
var('y')#f(x,y)=3*sin(x)-2*cos(y)-x*yf(x,y)=x^2+y^2-(x+y)#show(f.gradient()); show(det(f.hessian()))#f.diff(x,y)
Codice SageMath Risultato
Calcolo il determinante hessiano nel punto (1/2, 1/2)
Metodi Matematici
f(x,y)=x^2+y^2-(x+y)H = f.hessian()H(x,y)det(H)
Codice SageMath Risultato
![Page 30: Laboratorio di Matematica con SageMathUNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO 3 Introduzione •Scopo della tesi: –presentare SageMath, un programma software CAS ... Laboratorio](https://reader034.vdocumenti.com/reader034/viewer/2022042804/5f59318a72946f3813639b4a/html5/thumbnails/30.jpg)
UNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO
Laboratorio di matematica
Il determinate è positivo e il 1° elemento a sinistra della matrice è anch’esso positivo
quindi (1/2,1/2) è un punto di minimo relativo.
Nel dominio dato la funzione è sempre differenziabile. Il contorno si può
rappresentare con i seguenti segmenti
Metodi Matematici
Su ogni segmento studiamo il comportamento dei massimi e dei minimi. Ad esempio per il segmento S1 si procede come segue. Se “fisso” la x e studio la y, la funzione da studiare è
![Page 31: Laboratorio di Matematica con SageMathUNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO 3 Introduzione •Scopo della tesi: –presentare SageMath, un programma software CAS ... Laboratorio](https://reader034.vdocumenti.com/reader034/viewer/2022042804/5f59318a72946f3813639b4a/html5/thumbnails/31.jpg)
UNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO
31
Laboratorio di matematicaOttengo minimo in y=1/2 e massimo in y=-1
plot(x^2-x)
Codice SageMath Risultato
Metodi Matematici
I valori che assume questa funzione sono:minimo m1=-1/4massimo M1=2
Procedo analogamente per gli altri segmenti
![Page 32: Laboratorio di Matematica con SageMathUNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO 3 Introduzione •Scopo della tesi: –presentare SageMath, un programma software CAS ... Laboratorio](https://reader034.vdocumenti.com/reader034/viewer/2022042804/5f59318a72946f3813639b4a/html5/thumbnails/32.jpg)
UNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO
32
Laboratorio di matematica
var('x','y')f(x,y)=x^2+y^2-(x+y)plot3d(f(x,y),(x,-1,1),(y,-1,1))
Codice SageMath Risultato
Metodi Matematici
Il minimo assoluto sul contorno è assunto su (1,1/2),(1/2,1) e vale: -1/2
Disegno il grafico della funzione:
https://bit.ly/2Q62oaf
![Page 33: Laboratorio di Matematica con SageMathUNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO 3 Introduzione •Scopo della tesi: –presentare SageMath, un programma software CAS ... Laboratorio](https://reader034.vdocumenti.com/reader034/viewer/2022042804/5f59318a72946f3813639b4a/html5/thumbnails/33.jpg)
UNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO
33
Conclusioni
• Perché un laboratorio di matematica?
• Perché SageMath?
![Page 34: Laboratorio di Matematica con SageMathUNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO 3 Introduzione •Scopo della tesi: –presentare SageMath, un programma software CAS ... Laboratorio](https://reader034.vdocumenti.com/reader034/viewer/2022042804/5f59318a72946f3813639b4a/html5/thumbnails/34.jpg)
UNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO
34
Conclusioni
• Perché un laboratorio di matematica?
• facilita il “learning by doing”
• “manipolare” limiti, integrali e derivate rafforza l’efficacia dell’insegnamento
• evita lo studio puramente mnemonico
• limita il rischio che lo studente si trasformi in un semplice “risolutore meccanico di problemi”.
![Page 35: Laboratorio di Matematica con SageMathUNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO 3 Introduzione •Scopo della tesi: –presentare SageMath, un programma software CAS ... Laboratorio](https://reader034.vdocumenti.com/reader034/viewer/2022042804/5f59318a72946f3813639b4a/html5/thumbnails/35.jpg)
UNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO
35
Conclusioni
• Perché SageMath?
• gratuito, integrazione di terze parti, diffusione, completezza, gratuità, supporto accademico
• mette inoltre un ambiente di ricerca virtuale -basato anche su prodotti terzi open source e commerciali - che permette di gestire in maniera integrata l’intero ciclo di vita di un progetto di ricerca di matematica
![Page 36: Laboratorio di Matematica con SageMathUNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO 3 Introduzione •Scopo della tesi: –presentare SageMath, un programma software CAS ... Laboratorio](https://reader034.vdocumenti.com/reader034/viewer/2022042804/5f59318a72946f3813639b4a/html5/thumbnails/36.jpg)
UNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO
36
Conclusioni
• Perché SageMath?
• CoCal è la versione cloud di SageMath con funzionalità aggiuntive
• la versione “base” di CoCalc è gratuita ma è possibile avere una serie di servizi aggiuntivi –principalmente in termini di affidabilità e velocità del servizio – pagando un canone
https://cocalc.com/
![Page 37: Laboratorio di Matematica con SageMathUNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO 3 Introduzione •Scopo della tesi: –presentare SageMath, un programma software CAS ... Laboratorio](https://reader034.vdocumenti.com/reader034/viewer/2022042804/5f59318a72946f3813639b4a/html5/thumbnails/37.jpg)
UNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO
37
Conclusioni
• Perché SageMath?
• CoCalc può essere usato dai docenti per erogare corsi online e verificare come gli studenti rispondono alle esercitazioni e prove previste
• il principale vantaggio rispetto a SageMathCell è la possibilità di condividere in tempo reale il codice e la documentazione con altri utilizzatori nonché la gestione tecnica centralizzata dell’intero ambiente tecnologico in maniera trasparente
![Page 38: Laboratorio di Matematica con SageMathUNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO 3 Introduzione •Scopo della tesi: –presentare SageMath, un programma software CAS ... Laboratorio](https://reader034.vdocumenti.com/reader034/viewer/2022042804/5f59318a72946f3813639b4a/html5/thumbnails/38.jpg)
UNIVERSITÀ TELEMATICA INTERNAZIONALE UNINETTUNO
38
Corsi online basati su SageMath/CoCalc
• Math 241 - Calculus 1 Lab
• Math 242 - Calculus 2 Lab
• Introduction to Data Science, 2019 - A Computational, Mathematical and Statistical Approach
• Math 157 - Intro to Mathematical Software
• GCB 535 - Introduction to Bioinformatics