author | anand |
Sun, 07 Nov 2010 01:18:26 +0530 | |
changeset 390 | 69f285b3a5ed |
parent 262 | 0038edaf660c |
permissions | -rw-r--r-- |
255
75fd106303dc
Added the script to plotting_using_sage
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
1 |
Objective Questions |
75fd106303dc
Added the script to plotting_using_sage
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
2 |
------------------- |
75fd106303dc
Added the script to plotting_using_sage
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
3 |
|
262 | 4 |
1. Plot the curve ``sin(x) - cos(x)`` in the range (0, 2pi) |
255
75fd106303dc
Added the script to plotting_using_sage
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
5 |
|
262 | 6 |
Answer:: |
255
75fd106303dc
Added the script to plotting_using_sage
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
7 |
|
262 | 8 |
x = var('x') |
9 |
plot(sin(x) - cos(x), (x, 0, 2*pi)) |
|
255
75fd106303dc
Added the script to plotting_using_sage
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
10 |
|
262 | 11 |
2. plot ``sin(3x)`` and ``cos(x/3)`` and show them in same figure |
255
75fd106303dc
Added the script to plotting_using_sage
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
12 |
|
262 | 13 |
Answer:: |
255
75fd106303dc
Added the script to plotting_using_sage
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
14 |
|
262 | 15 |
x = var('x') |
16 |
p1 = plot(sin(3*x), (x, 0, 2*pi)) |
|
17 |
p2 = plot(cos(x/3), (x, 0, 2*pi)) |
|
18 |
show(p1+p2) |
|
255
75fd106303dc
Added the script to plotting_using_sage
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
19 |
|
262 | 20 |
3. plot ``cos(x)`` vs ``sin(x)^15`` in the range (-2pi, 2pi) |
255
75fd106303dc
Added the script to plotting_using_sage
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
21 |
|
262 | 22 |
Answer:: |
255
75fd106303dc
Added the script to plotting_using_sage
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
23 |
|
262 | 24 |
x = var('x') |
25 |
parametric_plot((cos(x), sin(x)^15), (x, -2*pi, 2*pi)) |
|
255
75fd106303dc
Added the script to plotting_using_sage
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
26 |
|
262 | 27 |
4. plot tan curve in the range (-2pi, 2pi) in red colour. |
28 |
[hint: see the documentation] |
|
255
75fd106303dc
Added the script to plotting_using_sage
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
29 |
|
75fd106303dc
Added the script to plotting_using_sage
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
30 |
Answer:: |
75fd106303dc
Added the script to plotting_using_sage
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
31 |
|
262 | 32 |
x = var('x') |
33 |
p1 = plot(tan(x), (x, -2*pi, 2*pi), color=(1, 0, 0)) |
|
34 |
show(p1) |
|
35 |
||
36 |
5. plot ``e^(1/x^2)`` in the range (0.5, 2.5) and set the y-axis limits to (0, |
|
37 |
20) |
|
255
75fd106303dc
Added the script to plotting_using_sage
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
38 |
|
262 | 39 |
Answer:: |
40 |
||
41 |
x = var('x') |
|
42 |
p2 = plot(e^(1/x^2), (x, 0.5, 2.5)) |
|
43 |
show(p2, ymin=0, ymax=20) |
|
44 |
||
45 |
6. plot the function ``y = 5x + 3`` using dotted line in the range (-2, 2) |
|
46 |
[hint: read the documentation of the function ``line``] |
|
255
75fd106303dc
Added the script to plotting_using_sage
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
47 |
|
75fd106303dc
Added the script to plotting_using_sage
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
48 |
Answer:: |
75fd106303dc
Added the script to plotting_using_sage
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
49 |
|
262 | 50 |
points = [ (i, 5*i+3) for i in srange(-2,2,0.1) ] |
51 |
l1 = line(points, linestyle=":") |
|
52 |
show(l1) |
|
53 |
||
54 |
7. plot the function ``z = cos(x) + sin(y)`` for x in the range (0, 2pi) and y |
|
55 |
in range (-2pi, 2pi) |
|
56 |
||
57 |
Answer:: |
|
255
75fd106303dc
Added the script to plotting_using_sage
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
58 |
|
262 | 59 |
x, y = var('x y') |
60 |
plot3d(cos(x) + sin(y), (x, 0, 2*pi), (y, -2*pi, 2*pi)) |
|
61 |
||
62 |
8. Read the sage documentation and find out which function plots closed surfaces |
|
63 |
||
64 |
a. parametric_plot3d |
|
65 |
#. plot3d |
|
66 |
#. implicit_plot3d |
|
67 |
#. contour_plot |
|
68 |
||
69 |
Answer: implicit_plot3d |
|
70 |