# 推导4

根据对偶函数的限制条件可知：

$$
\begin{aligned}
0 \le a\_1 \le C  \\
0 \le a\_2 \le C  && {1}
\end{aligned}
$$

把$$a\_2$$用$$a\_1$$表示得：

$$
\begin{aligned}
0 \le \frac {-\xi - a\_2y\_2}{y\_1} \le C  &&{2}
\end{aligned}
$$

由于$y\_1$和$y\_2$的取值只能是1或者-1，而1或-1会对不等号的化简影响不同，所以把公式（2）分成4种情况：

1. $$y\_1 = y\_2 = 1$$

   $$
   \begin{aligned}
   -C - \xi \le a\_2 \le -\xi \\
   a\_1+a\_2=-\xi
   \end{aligned}
   $$

   得：

   $$
   -C+a\_1+a\_2 \le a\_2^{new} \le a\_1 + a\_2
   $$
2. $$y\_1 = 1, y\_2 = -1$$

   $$
   \begin{aligned}
   \xi \le a\_2 \le C+\xi  \\
   a\_2 - a\_1 = \xi
   \end{aligned}
   $$

   得：

   $$
   a\_2 - a\_1 \le a\_2^{new} \le C + a\_2 - a\_1
   $$
3. $$y\_1 = -1, y\_2 = 1$$

   $$
   \begin{aligned}
   -\xi \le a\_2 \le C-\xi \\
   a\_2 - a\_1 = -\xi
   \end{aligned}
   $$

   得：

   $$
   a\_2 - a\_1 \le a\_2^{new} \le C + a\_2 - a\_1
   $$
4. $$y\_1 = y\_2 = -1$$

   $$
   \begin{aligned}
   \xi-C \le a\_2 \le \xi \\
   a\_1 + a\_2 = \xi
   \end{aligned}
   $$

   得：

   $$
   -C+a\_1+a\_2 \le a\_2^{new} \le a\_1 + a\_2
   $$

综合以上结果得：\
当y1y2<0时，

$$
\max (0, a\_2 - a\_1) \le a\_2^{new} \le \min(C, C + a\_2 - a\_1)
$$

当y1y2>0时，

$$
\max (0, -C+a\_1+a\_2) \le a\_2^{new} \le \min(C, a\_1 + a\_2)
$$


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://windmising.gitbook.io/lihang-tongjixuexifangfa/smo/20.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
