SlideShare a Scribd company logo
Maple Code for Steepest Descent
func:= (x,y) -> x^2 – y;
initx := 1;
inity := 1;
funcx := diff(func(x,y),x);
funcy := diff(func(x,y),y);
a1 := initx;
b1 := inity;
for I from 1 to 20 do
a := a1;
b:= b1;
currentval := evalf(func(a,b));
print(`current a ` = a, `current b` = b, `current val` = currentval);
fxpoint := evalf(subs({x = a, y = b}, funcx);
fypoint := evalf(subs({x = a, y = b},funcy);
print(`current gradient` = [fxpoint,fypoint]);
pathdiff := diff(func(a+fxpoint*t, b+ fypoint*t),t);
tmin := fsolve(pathdiff, t=0);
a1 := a + tmin*fxpoint;
b1 := b + tmin* fypoint;
func(a1,b1);
od:

More Related Content

PDF
17. soal soal program linear.
PDF
09 a analis_vektor
PPSX
Fungsi Kompleks (pada bilangan kompleks)
PDF
Eliminasi gauss-jordan
PPTX
Integral Lipat Tiga dalam koordinat Tabung dan Bola
PPT
Kalkulus 2 integral
DOCX
kekontinuan fungsi
PDF
Fungsi Pembangkit
17. soal soal program linear.
09 a analis_vektor
Fungsi Kompleks (pada bilangan kompleks)
Eliminasi gauss-jordan
Integral Lipat Tiga dalam koordinat Tabung dan Bola
Kalkulus 2 integral
kekontinuan fungsi
Fungsi Pembangkit

What's hot (20)

PDF
Basis dan Dimensi
PPT
Transformasi laplace1
PPTX
Matematika (Pangkat tak sebenarnya)
DOCX
Aljabar boolean MK matematika diskrit
PPTX
Representasi kurva segitiga - Case Base Reasoning
PDF
Deret Geometri Tak Hingga
PDF
deret kuasa
PDF
Bab iv-persamaan-diferensial-linier
PPTX
MEDIA PEMBELAJARAN MATEMATIKA TURUNAN FUNGSI TRIGONOMETRI
PPTX
Matematika 2 - Slide week 13 - Eigen
PPT
Volume benda-putar
PPTX
PPT MATEMATIKA KELAS X BAB FUNGSI KUADRAT
PDF
Persamaan differensial -_dr-_st-_budi_waluya
PDF
Modul 7 persamaan diophantine
PPTX
Modul 8 nilai eigen
PPTX
Teorema isomorfisma ring makalah
PPTX
Presentasi chapter 1,2,3,4 & 7
PDF
Akar-akar Persamaan Kuadrat Kelas 9
PDF
FUNGSI KOMPLEKS - TURUNAN DAN ATURAN RANTAI
PPTX
integral fungsi kompleks
Basis dan Dimensi
Transformasi laplace1
Matematika (Pangkat tak sebenarnya)
Aljabar boolean MK matematika diskrit
Representasi kurva segitiga - Case Base Reasoning
Deret Geometri Tak Hingga
deret kuasa
Bab iv-persamaan-diferensial-linier
MEDIA PEMBELAJARAN MATEMATIKA TURUNAN FUNGSI TRIGONOMETRI
Matematika 2 - Slide week 13 - Eigen
Volume benda-putar
PPT MATEMATIKA KELAS X BAB FUNGSI KUADRAT
Persamaan differensial -_dr-_st-_budi_waluya
Modul 7 persamaan diophantine
Modul 8 nilai eigen
Teorema isomorfisma ring makalah
Presentasi chapter 1,2,3,4 & 7
Akar-akar Persamaan Kuadrat Kelas 9
FUNGSI KOMPLEKS - TURUNAN DAN ATURAN RANTAI
integral fungsi kompleks
Ad

More from Jeremy Lane (6)

DOCX
DurbinWatsonVBA
DOCX
SAS example
DOCX
Mahalanobis Distance R
PPTX
Hypothesis Testing
PDF
torsionbinormalnotes
PDF
shrinkingcircle
DurbinWatsonVBA
SAS example
Mahalanobis Distance R
Hypothesis Testing
torsionbinormalnotes
shrinkingcircle
Ad

Maple Code for Steepest Descent

  • 1. Maple Code for Steepest Descent func:= (x,y) -> x^2 – y; initx := 1; inity := 1; funcx := diff(func(x,y),x); funcy := diff(func(x,y),y); a1 := initx; b1 := inity; for I from 1 to 20 do a := a1; b:= b1; currentval := evalf(func(a,b)); print(`current a ` = a, `current b` = b, `current val` = currentval); fxpoint := evalf(subs({x = a, y = b}, funcx); fypoint := evalf(subs({x = a, y = b},funcy); print(`current gradient` = [fxpoint,fypoint]); pathdiff := diff(func(a+fxpoint*t, b+ fypoint*t),t); tmin := fsolve(pathdiff, t=0); a1 := a + tmin*fxpoint; b1 := b + tmin* fypoint; func(a1,b1); od: