You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何求解不被y轴分割的高次多项式内接最大矩形?

求解高次多项式的内接最大矩形:从二次推广到通用方法

Great question! You already have the right intuition from quadratic functions—let's expand that to handle higher-degree polynomials like $2x4+4x3+3x+1$. The key is to move beyond relying on symmetry and formalize the problem for any function.

1. 先明确内接矩形的核心定义

First, let's align on what we mean by an "inscribed rectangle" here: we're talking about a rectangle with its base on the x-axis, left corner at $(x_1, 0)$, right corner at $(x_2, 0)$, top-left at $(x_1, h)$, and top-right at $(x_2, h)$. For this to be valid, $f(x_1) = f(x_2) = h$ (the height of the rectangle).

For quadratics like $9-x^2$, symmetry gives us $x_2 = -x_1$, so the base length is $2x_1$, and area becomes $S = 2x_1 \cdot f(x_1)$. But for asymmetric high-degree polynomials, we can't rely on this shortcut—we need to work with the general case.

2. 通用面积表达式

The area of the rectangle is always:
$$S = (x_2 - x_1) \cdot h = (x_2 - x_1) \cdot f(x_1)$$
(Since $h = f(x_1) = f(x_2)$.)

Our goal is to maximize $S$ subject to the constraint $f(x_1) = f(x_2)$, where $x_1 < x_2$.

3. 用微积分建立极值条件(拉格朗日乘数法)

To find the maximum, we can use the method of Lagrange multipliers to handle the constraint $f(x_1) = f(x_2)$. Here's how it works:

  1. Define the Lagrangian function:
    $$\mathcal{L} = (x_2 - x_1)f(x_1) + \lambda\left[f(x_2) - f(x_1)\right]$$
    where $\lambda$ is the Lagrange multiplier.

  2. Take partial derivatives with respect to $x_1$, $x_2$, and $\lambda$, then set them to 0:

    • $\frac{\partial \mathcal{L}}{\partial x_1} = -f(x_1) + (x_2 - x_1)f'(x_1) - \lambda f'(x_1) = 0$
    • $\frac{\partial \mathcal{L}}{\partial x_2} = f(x_1) + \lambda f'(x_2) = 0$
    • $\frac{\partial \mathcal{L}}{\partial \lambda} = f(x_2) - f(x_1) = 0$
  3. Simplify these equations:
    From the third equation, we know $f(x_1) = f(x_2) = h$. From the second equation, solve for $\lambda$:
    $$\lambda = -\frac{h}{f'(x_2)}$$
    Substitute this into the first equation and rearrange:
    $$(x_2 - x_1)f'(x_1) = h\left(1 - \frac{f'(x_1)}{f'(x_2)}\right)$$

    This equation, paired with $f(x_1) = f(x_2)$, gives us a system to solve for $x_1$ and $x_2$. For quadratics, this simplifies to the symmetric case you already know—let's verify with $f(x)=9-x^2$:

    • $f'(x) = -2x$, $x_2=-x_1$, $h=9-x_1^2$
    • Left side: $(-x_1 - x_1)(-2x_1) = 4x_1^2$
    • Right side: $(9-x_1^2)\left(1 - \frac{-2x_1}{-2(-x_1)}\right) = (9-x_1^2)(1 + 1) = 2(9-x_1^2)$
    • Solving $4x_1^2 = 2(9-x_1^2)$ gives $x_1=\sqrt{3}$, which matches your existing method.

4. 实操:高次多项式的数值求解

For polynomials like $2x4+4x3+3x+1$, we can't get a nice analytical solution (since it leads to high-degree equations), so we use numerical methods. Here's a step-by-step approach:

Step 1: Analyze the function's shape

First, find critical points by solving $f'(x)=0$:
$$f'(x)=8x3+12x2+3$$
This cubic equation has one real root (approx $x \approx -1.65$) and two complex roots. This means $f(x)$ decreases to a minimum at $x \approx -1.65$, then increases to infinity as $x \to \pm\infty$. So for any $h > f(-1.65)$, there will be two points $x_1 < -1.65$ and $x_2 > -1.65$ where $f(x_1)=f(x_2)=h$.

Step 2: Set up the system to solve

We need to find $x_1$ and $x_2$ such that:

  1. $2x_14+4x_13+3x_1+1 = 2x_24+4x_23+3x_2+1$ (simplifies to $2(x_14-x_24)+4(x_13-x_23)+3(x_1-x_2)=0$, factor out $(x_1-x_2)$ to get a cubic in $x_1$ and $x_2$)
  2. The Lagrange multiplier condition we derived earlier: $(x_2-x_1)(8x_13+12x_12+3) = h\left(1 - \frac{8x_13+12x_12+3}{8x_23+12x_22+3}\right)$ where $h=f(x_1)$

Step 3: Use numerical iteration

Use methods like Newton-Raphson to solve this system of equations. Alternatively, you can:

  • Pick a value for $x_1$, compute $h=f(x_1)$
  • Solve $f(x_2)=h$ for $x_2$ (use binary search since $f(x)$ is increasing for $x > -1.65$)
  • Compute $S=(x_2-x_1)h$
  • Use a one-dimensional optimizer (like golden-section search) to find the $x_1$ that maximizes $S$

Key Takeaways

  • Forget symmetry—focus on the general constraint $f(x_1)=f(x_2)$
  • Use calculus (Lagrange multipliers) to derive the necessary conditions for maximum area
  • For high-degree polynomials, analytical solutions are rare, so numerical methods (Newton-Raphson, binary search) are your go-to tools

内容的提问来源于stack exchange,提问作者Ace999

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 10:19:13