forked from chapman-cs510-2017f/cw-01-alicemaxkeith-team
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestsage.sagews
41 lines (30 loc) · 8.23 KB
/
testsage.sagews
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
︠9d17baba-e4ea-4843-b592-9093aa413ec7s︠
%md <div align='center'></div>CW01 Sage Math
%md <div align='center'></div>Alice, Max, Keith
%md <div align='center'></div>Date September 5, 2017
︡fdc77454-7140-482a-90a5-51e67899c900︡{"md":"<div align='center'></div>CW01 Sage Math"}︡{"md":"<div align='center'></div>Alice, Max, Keith"}︡{"md":"<div align='center'></div>Date September 5, 2017"}︡{"done":true}︡
︠e0bef1f7-333c-4cea-9b34-a54f00f43e6a︠
%md <div align='center'></div>Interactive Functions
@interact
def interactive_function(a = slider(0, 10, .05, default=4),
b = (-3, 3, .1)):
f(x) = b * x + sin(a * x)
plot(f, (x, -5, 5)).show()
%md This is a graph of a function that allows you to adjust the a and b. When you adjust a on the slide bar it adjust the fequency of the curve. When you adjust b slide bar it adjust the height of the curve. We choose this becasue this is an interactive way to adjust the values of a curve.
︡1dd30f4e-5a8f-4ed3-8d66-1551bb5a9080︡{"md":"Interactive Functions"}︡{"interact":{"controls":[{"animate":true,"control_type":"slider","default":80,"display_value":true,"label":"a","vals":["0.000000000000000","0.0500000000000000","0.100000000000000","0.150000000000000","0.200000000000000","0.250000000000000","0.300000000000000","0.350000000000000","0.400000000000000","0.450000000000000","0.500000000000000","0.550000000000000","0.600000000000000","0.650000000000000","0.700000000000000","0.750000000000000","0.800000000000000","0.850000000000000","0.900000000000000","0.950000000000000","1.00000000000000","1.05000000000000","1.10000000000000","1.15000000000000","1.20000000000000","1.25000000000000","1.30000000000000","1.35000000000000","1.40000000000000","1.45000000000000","1.50000000000000","1.55000000000000","1.60000000000000","1.65000000000000","1.70000000000000","1.75000000000000","1.80000000000000","1.85000000000000","1.90000000000000","1.95000000000000","2.00000000000000","2.05000000000000","2.10000000000000","2.15000000000000","2.20000000000000","2.25000000000000","2.30000000000000","2.35000000000000","2.40000000000000","2.45000000000000","2.50000000000000","2.55000000000000","2.60000000000000","2.65000000000000","2.70000000000000","2.75000000000000","2.80000000000000","2.85000000000000","2.90000000000000","2.95000000000000","3.00000000000000","3.05000000000000","3.10000000000000","3.15000000000000","3.20000000000000","3.25000000000000","3.30000000000000","3.35000000000000","3.40000000000000","3.45000000000000","3.50000000000000","3.55000000000000","3.60000000000000","3.65000000000000","3.69999999999999","3.74999999999999","3.79999999999999","3.84999999999999","3.89999999999999","3.94999999999999","3.99999999999999","4.04999999999999","4.09999999999999","4.14999999999999","4.19999999999999","4.24999999999999","4.29999999999999","4.34999999999999","4.39999999999999","4.44999999999999","4.49999999999999","4.54999999999999","4.59999999999999","4.64999999999999","4.69999999999999","4.74999999999999","4.79999999999999","4.84999999999999","4.89999999999999","4.94999999999999","4.99999999999999","5.04999999999999","5.09999999999999","5.14999999999999","5.19999999999999","5.24999999999999","5.29999999999999","5.34999999999999","5.39999999999999","5.44999999999999","5.49999999999999","5.54999999999999","5.59999999999999","5.64999999999999","5.69999999999999","5.74999999999999","5.79999999999999","5.84999999999999","5.89999999999999","5.94999999999999","5.99999999999999","6.04999999999999","6.09999999999999","6.14999999999999","6.19999999999999","6.24999999999999","6.29999999999999","6.34999999999999","6.39999999999999","6.44999999999999","6.49999999999998","6.54999999999998","6.59999999999998","6.64999999999998","6.69999999999998","6.74999999999998","6.79999999999998","6.84999999999998","6.89999999999998","6.94999999999998","6.99999999999998","7.04999999999998","7.09999999999998","7.14999999999998","7.19999999999998","7.24999999999998","7.29999999999998","7.34999999999998","7.39999999999998","7.44999999999998","7.49999999999998","7.54999999999998","7.59999999999998","7.64999999999998","7.69999999999998","7.74999999999998","7.79999999999998","7.84999999999998","7.89999999999998","7.94999999999998","7.99999999999998","8.04999999999998","8.09999999999998","8.14999999999998","8.19999999999998","8.24999999999998","8.29999999999998","8.34999999999998","8.39999999999998","8.44999999999999","8.49999999999999","8.54999999999999","8.59999999999999","8.64999999999999","8.69999999999999","8.74999999999999","8.79999999999999","8.84999999999999","8.89999999999999","8.94999999999999","8.99999999999999","9.04999999999999","9.09999999999999","9.15000000000000","9.20000000000000","9.25000000000000","9.30000000000000","9.35000000000000","9.40000000000000","9.45000000000000","9.50000000000000","9.55000000000000","9.60000000000000","9.65000000000000","9.70000000000000","9.75000000000000","9.80000000000000","9.85000000000000","9.90000000000001","9.95000000000001","10.0000000000000"],"var":"a","width":null},{"animate":true,"control_type":"slider","default":0,"display_value":true,"label":"b","vals":["-3.00000000000000","-2.90000000000000","-2.80000000000000","-2.70000000000000","-2.60000000000000","-2.50000000000000","-2.40000000000000","-2.30000000000000","-2.20000000000000","-2.10000000000000","-2.00000000000000","-1.90000000000000","-1.80000000000000","-1.70000000000000","-1.60000000000000","-1.50000000000000","-1.40000000000000","-1.30000000000000","-1.20000000000000","-1.10000000000000","-0.999999999999998","-0.899999999999998","-0.799999999999998","-0.699999999999998","-0.599999999999998","-0.499999999999998","-0.399999999999998","-0.299999999999998","-0.199999999999998","-0.0999999999999985","1.52655665885959e-15","0.100000000000002","0.200000000000002","0.300000000000002","0.400000000000002","0.500000000000002","0.600000000000002","0.700000000000002","0.800000000000001","0.900000000000001","1.00000000000000","1.10000000000000","1.20000000000000","1.30000000000000","1.40000000000000","1.50000000000000","1.60000000000000","1.70000000000000","1.80000000000000","1.90000000000000","2.00000000000000","2.10000000000000","2.20000000000000","2.30000000000000","2.40000000000000","2.50000000000000","2.60000000000000","2.70000000000000","2.80000000000000","2.90000000000000","3.00000000000000"],"var":"b","width":null}],"flicker":false,"id":"410b1f9b-2acd-422a-8586-f4cee3379692","layout":[[["a",12,null]],[["b",12,null]],[["",12,null]]],"style":"None"}}︡{"md":"This is a graph of a function that allows you to adjust the a and b. When you adjust a on the slide bar it adjust the fequency of the curve. When you adjust b slide bar it adjust the height of the curve. We choose this becasue this is an interactive way to adjust the values of a curve."}︡{"done":true}︡
︠d5ec77b5-cb3d-4408-8488-eba2bba89ec6︠
︡d3c3fa0f-243b-4865-b4b7-792e79ff0fbf︡
︠9203c6f2-41d4-4e85-8221-c754548d8b0cs︠
%md Torus
from sage.plot.plot3d.shapes import Torus
inner_radius = .3; outer_radius = 1
show(Torus(outer_radius, inner_radius, color='orange'), aspect_ratio=1, spin=3)
%md This is a 3D visualization of a Torus that rotates when you put the mouse over it. This tarus has an inner radius of 0.3 and an outer radius of 1. We choose this visualization becasue you can see curves and objects in 3D.
︡e4af0fec-081c-4b47-a414-044fbaa06755︡{"md":"Torus"}︡{"file":{"filename":"dc485748-f0ff-41ab-b961-15e5928f8c99.sage3d","uuid":"dc485748-f0ff-41ab-b961-15e5928f8c99"}}︡{"md":"This is a 3D visualization of a Torus that rotates when you put the mouse over it. This tarus has an inner radius of 0.3 and an outer radius of 1. We choose this visualization becasue you can see curves and objects in 3D."}︡{"done":true}︡
︠8729d6f5-f9bf-4992-b574-d0aa079e4ef7s︠
%md <div align='center'></div>Differentiation
1+x+x^2
diff(1 + x + x^2, x)
%md This function allows you to differentiate in the workbook. The first equation is the original function and the obe below that is the first derivative.
︡b4f6205a-0513-421d-96cc-ab0d046d905d︡{"md":"<div align='center'></div>Differentiation"}︡{"stdout":"x^2 + x + 1\n"}︡{"stdout":"2*x + 1\n"}︡{"md":"This function allows you to differentiate in the workbook. The first equation is the original function and the obe below that is the first derivative."}︡{"done":true}︡
︠10cd811c-de83-44d5-97de-b3fcdf69b3a7︠