1 | r""" |
---|

2 | |
---|

3 | sage: g = bar_chart([randrange(15) for i in range(20)], color='red') |
---|

4 | sage: g = bar_chart([x^2 for x in range(1,20)], width=0.2) |
---|

5 | sage: liste = [10 + floor(10*sin(i)) for i in range(100)] |
---|

6 | sage: g = bar_chart(liste) |
---|

7 | sage: g = finance.TimeSeries(liste).plot_histogram(bins=20) |
---|

8 | |
---|

9 | """ |
---|

10 | |
---|

11 | |
---|

12 | r""" |
---|

13 | |
---|

14 | sage: from random import * |
---|

15 | sage: n, l, x, y = 10000, 1, 0, 0; p = [[0, 0]] |
---|

16 | sage: for k in range(n): |
---|

17 | ... theta = (2 * pi * random()).n(digits=5) |
---|

18 | ... x, y = x + l * cos(theta), y + l * sin(theta) |
---|

19 | ... p.append([x, y]) |
---|

20 | sage: g1 = line([p[n], [0, 0]], color='red', thickness=2) |
---|

21 | sage: g1 += line(p, thickness=.4); # g1.show(aspect_ratio=1) |
---|

22 | |
---|

23 | """ |
---|

24 | |
---|

25 | |
---|

26 | r""" |
---|

27 | |
---|

28 | sage: length = 200; n = var('n') |
---|

29 | sage: u(n) = n * sqrt(2) |
---|

30 | sage: z(n) = exp(2 * I * pi * u(n)) |
---|

31 | sage: vertices = [CC(0, 0)] |
---|

32 | sage: for n in range(1, length): |
---|

33 | ... vertices.append(vertices[n - 1] + CC(z(n))) |
---|

34 | sage: g = line(vertices); # g.show(aspect_ratio=1) |
---|

35 | |
---|

36 | """ |
---|

37 | |
---|

38 | |
---|

39 | r""" |
---|

40 | |
---|

41 | sage: x = var('x'); y = function('y',x) |
---|

42 | sage: DE = x*diff(y, x) == 2*y + x^3 |
---|

43 | sage: desolve(DE, [y,x]) |
---|

44 | (c + x)*x^2 |
---|

45 | sage: sol = [] |
---|

46 | sage: for i in srange(-2, 2, 0.2): |
---|

47 | ... sol.append(desolve(DE, [y, x], ics=[1, i])) |
---|

48 | ... sol.append(desolve(DE, [y, x], ics=[-1, i])) |
---|

49 | sage: g = plot(sol, x, -2, 2) |
---|

50 | sage: y = var('y') |
---|

51 | sage: g += plot_vector_field((x, 2*y+x^3), (x, -2, 2), (y, -1, 1)) |
---|

52 | sage: # g.show(ymin=-1, ymax=1) |
---|

53 | |
---|

54 | """ |
---|

55 | |
---|

56 | |
---|

57 | r""" |
---|

58 | |
---|

59 | sage: x = var('x'); y = function('y',x) |
---|

60 | sage: DE = x*diff(y, x) == 2*y + x^3 |
---|

61 | sage: g = Graphics() |
---|

62 | sage: for i in srange(-1, 1, 0.1): |
---|

63 | ... g += line(desolve_rk4(DE, y, ics=[1, i],\ |
---|

64 | ... step=0.05, end_points=[0,2])) |
---|

65 | ... g += line(desolve_rk4(DE, y, ics=[-1, i],\ |
---|

66 | ... step=0.05, end_points=[-2,0])) |
---|

67 | sage: y = var('y') |
---|

68 | sage: g = plot_vector_field((x, 2*y + x^3), (x,-2,2), (y,-1,1)) |
---|

69 | sage: # g.show(ymin=-1, ymax=1) |
---|

70 | |
---|

71 | """ |
---|

72 | |
---|