Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

Sage examples from in-class

Project: MATH 202
Views: 136
var('x y') plot_slope_field(x - y, (x, -3, 3), (y, -3, 3), plot_points = 13)
(x, y)
var('x y') eulers_method(x - y, 0, 0, 0.1, 2.5)
(x, y) x y h*f(x,y) 0 0 0.000000000000000 0.100000000000000 0.000000000000000 0.0100000000000000 0.200000000000000 0.0100000000000000 0.0190000000000000 0.300000000000000 0.0290000000000000 0.0271000000000000 0.400000000000000 0.0561000000000000 0.0343900000000000 0.500000000000000 0.0904900000000000 0.0409510000000000 0.600000000000000 0.131441000000000 0.0468559000000000 0.700000000000000 0.178296900000000 0.0521703100000000 0.800000000000000 0.230467210000000 0.0569532790000000 0.900000000000000 0.287420489000000 0.0612579511000000 1.00000000000000 0.348678440100000 0.0651321559900000 1.10000000000000 0.413810596090000 0.0686189403910000 1.20000000000000 0.482429536481000 0.0717570463519000 1.30000000000000 0.554186582832900 0.0745813417167100 1.40000000000000 0.628767924549610 0.0771232075450390 1.50000000000000 0.705891132094649 0.0794108867905351 1.60000000000000 0.785302018885184 0.0814697981114816 1.70000000000000 0.866771816996666 0.0833228183003335 1.80000000000000 0.950094635296999 0.0849905364703001 1.90000000000000 1.03508517176730 0.0864914828232701 2.00000000000000 1.12157665459057 0.0878423345409431 2.10000000000000 1.20941898913151 0.0890581010868488 2.20000000000000 1.29847709021836 0.0901522909781639 2.30000000000000 1.38862938119653 0.0911370618803475 2.40000000000000 1.47976644307687 0.0920233556923128 2.50000000000000 1.57178979876919 0.0928210201230815
# ics = initial condition, end_points = interval var('x y') desolve_rk4(x + y, y, ics=[0, 0], end_points=[-3, 3], output='slope_field')
(x, y)
desolve_rk4(x*(y^2-4), y, ics=[0, 1], end_points=[-5, 5], output='slope_field')
var('y') plot_slope_field(.08*y*(1 - y/1000) - 20, (x, 0, 150), (y, 0, 1200), plot_points = 21)
y