1 | r""" |
---|

2 | |
---|

3 | sage: g = plot(x * sin(1/x), x, -2, 2, plot_points=500) |
---|

4 | sage: def p(x, n): return(taylor(sin(x), x, 0, n)) |
---|

5 | sage: xmax = 15 ; n = 15 |
---|

6 | sage: g = plot(sin(x), x, -xmax, xmax) |
---|

7 | sage: for d in range(n): |
---|

8 | ... g += plot(p(x, 2 * d + 1), x, -xmax, xmax,\ |
---|

9 | ... color=(1.7*d/(2*n), 1.5*d/(2*n), 1-3*d/(4*n))) |
---|

10 | sage: # g.show(ymin=-2, ymax=2) |
---|

11 | |
---|

12 | """ |
---|

13 | |
---|

14 | |
---|

15 | r""" |
---|

16 | |
---|

17 | sage: a = animate([[sin(x), taylor(sin(x), x, 0, 2*k+1)]\ |
---|

18 | ... for k in range(0, 14)], xmin=-14, xmax=14,\ |
---|

19 | ... ymin=-3, ymax=3, figsize=[8, 4]) |
---|

20 | sage: # a.show() |
---|

21 | |
---|

22 | """ |
---|

23 | |
---|

24 | |
---|

25 | r""" |
---|

26 | |
---|

27 | sage: f2(x) = 1; f1(x) = -1 |
---|

28 | sage: f = Piecewise([[(-pi,0),f1],[(0,pi),f2]]) |
---|

29 | sage: S = f.fourier_series_partial_sum(20,pi); S |
---|

30 | 4/3*sin(3*x)/pi + 4/5*sin(5*x)/pi + 4/7*sin(7*x)/pi + 4/9*sin(9*x)/pi + 4/11*sin(11*x)/pi + 4/13*sin(13*x)/pi + 4/15*sin(15*x)/pi + 4/17*sin(17*x)/pi + 4/19*sin(19*x)/pi + 4*sin(x)/pi |
---|

31 | sage: g = plot(S, x, -8, 8, color='blue') |
---|

32 | sage: scie(x) = x - 2 * pi * floor((x + pi) / (2 * pi)) |
---|

33 | sage: g += plot(scie(x) / abs(scie(x)), x, -8, 8, color='red') |
---|

34 | |
---|

35 | """ |
---|

36 | |
---|

37 | |
---|

38 | r""" |
---|

39 | |
---|

40 | sage: t = var('t') |
---|

41 | sage: x = cos(t) + cos(7*t)/2 + sin(17*t)/3 |
---|

42 | sage: y = sin(t) + sin(7*t)/2 + cos(17*t)/3 |
---|

43 | sage: g = parametric_plot( (x, y), (t, 0, 2*pi)) |
---|

44 | sage: # g.show(aspect_ratio=1) |
---|

45 | |
---|

46 | """ |
---|

47 | |
---|

48 | |
---|

49 | r""" |
---|

50 | |
---|

51 | sage: t = var('t'); e, n = 2, 20/19 |
---|

52 | sage: g1 = polar_plot(1+e*cos(n*t),(t,0,n*38*pi),plot_points=5000) |
---|

53 | sage: e, n = 1/3, 20/19 |
---|

54 | sage: g2 = polar_plot(1+e*cos(n*t),(t,0,n*38*pi),plot_points=5000) |
---|

55 | sage: # g1.show(aspect_ratio=1); g2.show(aspect_ratio=1) |
---|

56 | |
---|

57 | """ |
---|

58 | |
---|

59 | |
---|

60 | r""" |
---|

61 | |
---|

62 | sage: z = var('z'); g1 = complex_plot(abs(cos(z^4)) - 1,\ |
---|

63 | ... (-3, 3), (-3, 3), plot_points=400) |
---|

64 | sage: f = lambda x, y : (abs(cos((x + I * y) ** 4)) - 1) |
---|

65 | sage: g2 = implicit_plot(f, (-3, 3), (-3, 3), plot_points=400) # long time (~300 seconds) |
---|

66 | sage: # g1.show(aspect_ratio=1); g2.show(aspect_ratio=1) |
---|

67 | sage: f(z) = z^5 + z - 1 + 1/z |
---|

68 | sage: g = complex_plot(f, (-3, 3), (-3, 3)) # long time |
---|

69 | |
---|

70 | |
---|

71 | """ |
---|

72 | |
---|