Advertisement
mrbearp

wolfram k2

Jun 21st, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.76 KB | None | 0 0
  1. limit exists, value:
  2. f[x_, y_] = (x^2 - y^2)/(x^2 + y^2)
  3. Limit[f[x, y] /. x -> 0, y -> 0]
  4. Limit[f[x, y] /. x -> y, y -> 0]
  5.  
  6. f[x_, y_] = (x^2 - y^2)/(x^2 + y^2)
  7. Limit[f[x, y] /. x -> 1, y -> -1]
  8. Limit[f[x, y] /. x -> 1, y -> 0]
  9.  
  10. (*Since in both exercises we have found different values of the \
  11. limits along different curves, we can conclude that these limits do \
  12. not exist*)
  13. ************
  14. Find the local maximum, local minimum and saddle points of the given function
  15. and show them on the same graph with the function (if they exist).
  16. f[x_, y_] = x^3 - y^3 - 2*x*y + 6;
  17. fx[x_, y_] = D[f[x, y], x];
  18. fy[x_, y_] = D[f[x, y], y];
  19. Solve[fx[x, y] == 0 && fy[x, y] == 0] // N
  20. (* critical points are (-2/3,2/3) and (0,0)*)
  21. d[x_, y_] =
  22. D[fx[x, y], x]*D[fy[x, y], y] - D[fx[x, y], y]*D[fy[x, y], x];
  23. d[0, 0]
  24. d[-2/3, 2/3]
  25. (* (0,0) is a saddle point*)
  26. fxx[x_, y_] = D[fx[x, y], x];
  27. fxx[-2/3, 2/3]
  28. fyy[x_, y_] = D[fy[x, y], y];
  29. fyy[-2/3, 2/3]
  30. (* (-2/3,2/3) is a local maximum since d>0 and fxx<0*)
  31. l = ListPointPlot3D[{{0, 0, f[0, 0]}, {-2/3, 2/3, f[-2/3, 2/3]}},
  32. PlotStyle -> PointSize[0.03]];
  33. p = Plot3D[f[x, y], {x, -2, 2}, {y, -2, 2}];
  34. Show[p, l]
  35. c = ContourPlot[f[x, y], {x, -2, 2}, {y, -2, 2}]
  36.  
  37. ******************
  38. Find the global extreme value of the function f(x,y) in the given domain. Then show the graph of the
  39. function together with the global extreme.
  40.  
  41. [x_, y_] = x + y;
  42. NMinimize[{f[x, y], x^2 + y^2 == 4}, {x, y}]
  43. NMaximize[{f[x, y], x^2 + y^2 == 4}, {x, y}]
  44. l = ListPointPlot3D[{{-1.4142135686219075, -1.414213566660994, \
  45. -2.828427135282902}, {1.4142135636943396, 1.414213568044784,
  46. 2.8284271317391236}}, PlotStyle -> PointSize[Large]];
  47. p = Plot3D[f[x, y], {x, -2, 2}, {y, -2, 2}];
  48. Show[p, l]
  49.  
  50. ************************************
  51. r=sin+cos; r=nsin:
  52. PolarPlot[Sin[3*t] + Cos[2*t], {t, 0, 2*Pi}]
  53. ParametricPlot[{Cos[t]*(Sin[3*t] + Cos[2*t]),
  54. Sin[t]*(Sin[3*t] + Cos[2*t])}, {t, 0, 2*Pi}]
  55. ;;;;;;;;;;;;;;;;;;;;;;;;
  56. tabela = Table[n*Sin[t], {n, 0, 10, 1}];
  57. PolarPlot[Evaluate[tabela], {t, 0, 2*Pi}]
  58. (*you may use Table directly together with ListPlot or \
  59. ListPointPlot3D but not with Plot od PolarPlot, ParametricPlot etc.*)
  60. \
  61. (*first make the table, then use evaluate in the plotting step!*)
  62.  
  63. ***********************************
  64. Recursive Sequence, general term, convergence, partial sums:
  65. RSolve[{a[n] == a[n - 1] + 1/2^n, a[1] == 1/2*Sum[1/2^k,{k,0,Infinity}], a[n], n]
  66. Limit[2^(-1 - n) (-2 + 3 2^n),
  67. n -> Infinity] (*finding general term*)
  68. Graphics[Point[Table[{n, 2^(-1 - n) (-2 + 3 2^n)}, {n, -3, 5, 1}]],
  69. Axes -> True] (*sequence converges to 1.5*)
  70. Sn = Sum[2^-n (-1 + 2^n), {n, 1, Infinity}]
  71. Limit[Sn, n -> Infinity] (*series diverges*)//Unneccessery
  72. *****************************************
  73. Maclaurin,graphs, error:
  74.  
  75. f[x_] = (2 x - 1)^2*Sin[x + 1];
  76. table = Table[Normal[Series[f[x], {x, 0, n}]], {n, 1, 10, 1}];
  77. a = Plot[Evaluate[table], {x, 0, 6},
  78. PlotStyle -> Blue]; (*you may use Evaluate[table] in this case*)
  79. b = Plot[f[x], {x, 0, 6}, PlotStyle -> Red];
  80. Show[a, b]
  81. g2[x_] = Normal[Series[f[x], {x, 0, 2}]];
  82. c = ListPlot[Table[{x, g2[x]}, {x, 0.1, 4.6, 0.5}],
  83. PlotStyle -> {PointSize[Large],
  84. Green}]; (*you may use listplot with table together*)
  85.  
  86. Table[Abs[g2[x] - f[x]], {x, 0.1, 4.6,
  87. 0.5}](*table of error in approximation values*)
  88.  
  89. d = Plot[g2[x], {x, 0, 6}, PlotStyle -> Blue];
  90. Show[b, c, d]
  91. *************************************
  92. region A, between two curves, area, perimeter, volume of solid, area of solid
  93.  
  94. f[x_] = -(x - 2)^2 + 4;
  95. g[x_] = x/(x + 1);
  96. Plot[{f[x], g[x]}, {x, 0, 5}]
  97. FindRoot[f[x] == g[x], {x, 4}]
  98. {x -> 3.79128784747792`}
  99. Integrate[f[x] - g[x], {x, 0, 3.79129}] (*calculating area of region A*)
  100. o1 = Integrate[Sqrt[1 + (f'[x])^2], {x, 0, 3.79129}] (*arc length of f*)
  101. o2 = Integrate[Sqrt[1 + (g'[x])^2], {x, 0, 3.79129}] (*arc length of g*)
  102. perimeter = o1 + o2
  103. Integrate[2*Pi*x*(f[x] - g[x]), {x, 0, 3.79129}](*volume of revolving region around y-axis*)
  104. Solve[y == -(x - 2)^2 + 4, x]
  105. Solve[y1 == x/(x + 1), x]
  106.  
  107. h[y_] = 2 - Sqrt[4 - y]
  108. h1[y_] = D[h[y], y]
  109.  
  110. k[y_] = 2 + Sqrt[4 - y]
  111. k1[y_] = D[k[y], y]
  112.  
  113. p[y_] = -y/(y - 1)
  114. p1[y_] = D[p[y], y]
  115.  
  116. A1 = Integrate[2*Pi*h[y]*Sqrt[1 + (h1[y])^2], {y, 0, 3.79129}]
  117. A2 = Integrate[2*Pi*k[y]*Sqrt[1 + (k1[y])^2], {y, 0, 3.79129}]
  118. A3 =Integrate[2*Pi*p[y]*Sqrt[1 + (p1[y])^2], {y, 0, 3.79129}]
  119. A = A2 - A1 (*area of revolving region around y-axis*)
  120. *************************************
  121. Integral convergent,divergent?
  122.  
  123. L1 = Limit[Integrate[x*E^(-x^2),{x, a, 0}],a -> -Infinity]
  124. L2 = Limit[Integrate[x*E^(-x^2),{x, 0, b}],b -> Infinity]
  125. (*both integrals converge, so does the whole integral *)
  126. L = L1 + L2 (*the integral converges to zero*)
  127. Plot[x*E^(-x^2), {x, -10, 10}, PlotRange -> All]
  128. ******************************************
  129. approximate area, Riemann, rectangles,graph, correct area with integral and error
  130. f[x_] = x*Log[x + 1];
  131. deltax = (5 - 1)/15; (b-a/n)
  132. priblizna = Sum[f[1 + (i - 1/2)*deltax]*deltax, {i, 1, 15}] // N
  133. tabela = Table[
  134. Rectangle[{1 + (i - 1)*deltax, 0}, {1 + i*deltax,
  135. f[1 + (i - 1/2)*deltax]}], {i, 1, 15}];
  136. grafik = Plot[f[x], {x, 0, 5}]
  137. Show[Graphics[tabela], grafik]
  138. tocna=Integrate[f[x], {x, 1, 5}] // N
  139. error=priblizna-tocna
  140. *******************************
  141. find value of integral using definite integral, limit value of rieman sum
  142. f[x_] = x^2 + x - 1;
  143. Integrate[f[x], {x, -1, 3}]
  144. a[n_]=Sum[f[-1 + i*4/n]*4/n,{i,1,n}]
  145. Limit[a[n], n -> Infinity] // N
  146.  
  147. L=koren od dy/dt ^2 + dx/dt^2
  148. L(plane curve)=Integrate[sqrt[1+(dx/dy)^2],{y,c,d}]
  149. S=Integrate[2*Pi*f[x]*sqrt[1+(dx/dy)^2],{x,a,b}] (*area of solid*)
  150. V=Integrate[Pi*(f[x]^2 - g[x]^2), {x,a,b} (* Volume discs around x-axis *)
  151. V=Integrate[2*Pi*x*(f[x] - g[x]), {x,a,b} (* Volume shells around y-axis *)
  152.  
  153. x=rcost; y=rsint; r^2=x^2+y^2; tgt=y/x
  154. D>0: fxx>0 = min, fxx<0 = max ; D<0: saddle
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement