拉格朗日乘数法示例2

拉格朗日乘数法示例2
几何画板及绘图内容加载中,请稍等……
2020-07-13 00:18
①本范例演示了使用拉格朗日乘数法求解带约束条件的优化问题,通过图形化展示目标函数与约束条件的关系;②涉及核心数学概念包括拉格朗日乘数法、偏导数、梯度、目标函数与约束条件的几何意义;③作图要点提炼自构造摘要,使用了LeftSide, Simplify, Point, UnitVector, Angle, LaTeX, Textfield, Zip, CurveCartesian, Surface, RotateText, Sequence, RemoveUndefined, Text, TableText, Segment等GeoGebra命令与对象;④适合大学数学、工程学等需要应用微积分解决实际优化问题的学段或用途。

GeoGebra 命令及参数

  1. LeftSide(Cu_g) → g
  2. Simplify(Derivative[g, x, 1]) → gx'
  3. Simplify(Derivative[g, y, 1]) → gy'
  4. Simplify(Derivative[f, x, 1]) → fx'
  5. Simplify(Derivative[f, y, 1]) → fy'
  6. Point(Cu_g) → B
  7. UnitVector(Vector[B, Dg]) → u_g
  8. UnitVector(Vector[B, Df]) → u_f
  9. Angle(u_g, u_f) → α
  10. LaTeX(f, true) → text8a
  11. LaTeX(Cu_g, true) → text8b
  12. Textfield(Cu0_x) → InputBox1
  13. Textfield(Cu0_y) → InputBox2
  14. Textfield(f) → InputBox3
  15. Textfield(Cu_g) → InputBox4
  16. Zip((x(a), y(a), f(a)), a, Sequence[Point[Cu_g, t / n], t, 0, n]) → lg_1
  17. Textfield(n) → InputBox5
  18. Zip("(" + (LaTeX[ScientificText[x(a), 2]]) + "," + (LaTeX[ScientificText[y(a), 2]]) + ")", a, l1xy'_f) → l1xy'_fa
  19. CurveCartesian((sqrt(3) * cos(t)), (sqrt(3) * sin(t)), f((sqrt(3) * cos(t)), (sqrt(3) * sin(t))), t, (-π), π) → q1
  20. Surface((sqrt(3) * cos(t)), (sqrt(3) * sin(t)), u, t, (-π), π, u, -2.1, 2.1) → g1
  21. RotateText(text15, 90°) → text20
  22. Zip(Text["(" + (SurdText[x(a)]) + "," + (SurdText[y(a)]) + ")", (0, 0), true, true], a, l1) → l1surd
  23. Zip(Text["(" + (SurdText[x(a)]) + "," + (SurdText[y(a)]) + ")", (0, 0), true, true], a, l2) → l2surd
  24. Sequence(If[lα1(i) ≟ 180°, 1, lα1(i) ≟ 0°, 2, 3], i, 1, Length[l1]) → l1_α
  25. Sequence(If[lα2(i) ≟ 180°, 1, lα2(i) ≟ 0°, 2, 3], i, 1, Length[l2]) → l2_α
  26. RemoveUndefined(Sequence[If[l1_α(i) ≟ 1, l1(i), NaN], i, 1, Length[l1]]) → l1min
  27. RemoveUndefined(Sequence[If[l1_α(i) ≟ 2, l1(i), NaN], i, 1, Length[l1]]) → l1max
  28. RemoveUndefined(Sequence[If[l1_α(i) ≟ 3, l1(i), NaN], i, 1, Length[l1]]) → l1loc1
  29. RemoveUndefined(Sequence[If[l1_α(i) ≟ 1, l1f(i), NaN], i, 1, Length[l1f]]) → l1min_{3D}
  30. RemoveUndefined(Sequence[If[l1_α(i) ≟ 2, l1f(i), NaN], i, 1, Length[l1f]]) → l1max_{3D}
  31. RemoveUndefined(Sequence[If[l2_α(i) ≟ 2, l2(i), NaN], i, 1, Length[l2]]) → l2max
  32. RemoveUndefined(Sequence[If[l2_α(i) ≟ 2, l2f(i), NaN], i, 1, Length[l2f]]) → l2max_{3D}
  33. RemoveUndefined(Sequence[If[l2_α(i) ≟ 1, l2(i), NaN], i, 1, Length[l2]]) → l2min
  34. RemoveUndefined(Sequence[If[l2_α(i) ≟ 1, l2f(i), NaN], i, 1, Length[l2f]]) → l2min_{3D}
  35. Text("∇f", Point[u_f, 1]) → text25
  36. Text("∇g", Point[u_g, 1]) → text25g
  37. TableText(Append["N", 1…Length[l1]], Append["\fgcolor{red}{Cp}", l1surd], Append["\fgcolor{blue}{f}(\fgcolor{red}{C_p })", l1fa], Append["(\dot{f_x},\dot{f_y})", l1xy'_fa], Append["(\dot{g_x},\dot{g_y})", l1xy'_ga], Append["λ_x", lλ1ax], Append["λ_y", lλ1ay], Append["\widehat{\dot{g}\dot{f}} ", lα1], "c|_") → tTab1
  38. TableText(Append["N", 1…Length[l2]], Append["\fgcolor{red}{Cp}", l2surd], Append["\fgcolor{blue}{f}(\fgcolor{red}{C_p })", l2fa], Append["(\dot{f_x},\dot{f_y})", l2xy'_fa], Append["(\dot{g_x},\dot{g_y})", l2xy'_ga], Append["λ_x", lλ2ax], Append["λ_y", lλ2ay], Append["\widehat{\dot{g}\dot{f}} ", lα2], "c|_") → tTab2
  39. Segment(B, C) → f_1
  40. RemoveUndefined(Zip[Vector[c, c + UnitVector[a]], a, l1xy'_f, c, l1]) → lvec1_f
  41. RemoveUndefined(Zip[Vector[c, c + UnitVector[a]], a, l1xy'_g, c, l1]) → lvec1_g
  42. RemoveUndefined(Zip[Vector[c, c + UnitVector[a]], a, l2xy'_f, c, l2]) → lvec2_f
  43. RemoveUndefined(Zip[Vector[c, c + UnitVector[a]], a, l2xy'_g, c, l2]) → lvec2_g
  44. Zip(Segment[a, b], a, l1, b, l1f) → l1seg
  45. Sequence(Text[i, l1(i) + (0.2, 0.1)], i, 1, lä1) → l1txt
  46. Sequence(Text[i, l2(i) + (0.2, 0.1)], i, 1, lä2) → l2txt
  47. Zip(Segment[a, b], a, l2, b, l2f) → l2seg

AI 绘图提示语参考

绘制一个三维空间中的约束优化示例:一个圆柱面作为约束曲面,其上有一条空间曲线表示目标函数值。在曲面上放置多个采样点,每个点处画出目标函数和约束函数的梯度向量,并用角度标注两者夹角。同时显示目标函数在约束上的投影曲线,以及沿约束曲线分布的若干竖直线段,连接曲面上的点与下方平面上的对应点。用表格列出各点的坐标、函数值、梯度分量和夹角,并用不同颜色区分极大值、极小值和鞍点。
以上提示语为根据原始绘图命令整理而来,仅供参考。