# Derivative use in reality

## Hospital Rule (某法则求 0:0 或 ∞:∞ 极限)

When you encounter some limitation formulas after giving `approaching x` seems like $$\frac{0}{0}$$ or $$\frac{\infty}{\infty}$$, you can get its molecular and denominator's first derivative partly, then do this process again and again until you get some limitation value that not seems like $$\frac{0}{0}$$ or $$\frac{\infty}{\infty}$$

```
formula = a fractional limitation formula
molecular, denominator = split_fraction(formula)

while True:
    i = 0

    molecular_limitation_value = get_limitation_value(molecular)
    denominator_limitation_value = get_limitation_value(denominator)

    if '{m}:{d}'.format(m=molecular_limitation, d=denominator) in ['0:0', '∞:∞']:
        molecular = take_first_derivative(molecular)
        denominator = take_first_derivative(denominator)
        i += 1
    else:
        return molecular_limitation_value / denominator_limitation_value

    if i > 999:
        print("You can't use hospital rule in this formula.")
```

$$
\begin{align\*}
&\lim\_{x \to 0}{\frac{\sin x - e^x + 1}{1 - \sqrt{1 - x^2}}}
\ \\
{\frac{0}{0}} \atop =& \lim\_{x \to 0}{\frac{\cos x - e^x}{-\frac{1}{2}(1 - x^2)^{-\frac{1}{2}} \cdot (-2x)}}
\ \\
{\frac{0}{0}} \atop =& \lim\_{x \to 0}{\frac{- \sin x - e^x}{-\frac{1}{4} (1 - x^2)^{-\frac{2}{3}} \cdot (-2x) + \[-\frac{1}{2}(1 - x^2)^{-\frac{1}{2}} \cdot (-2)]}}
\ \\
\=& \frac{0}{1} = 0
\end{align\*}
$$

## 耗费最小化，利益最大化


---

# 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://yingshaoxo.gitbook.io/university-notes/high-level-math/derivative-and-differential/use-derivative/derivative-use-in-reality.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.
