apart_expression
Decomposes a rational expression into partial fractions, optionally specifying the variable, and returns a key to the decomposed result.
Instructions
Computes the partial fraction decomposition of a rational expression using SymPy's apart.
Args:
expr_key: The key of the expression (previously introduced) to decompose.
var_name: The variable (previously introduced) to decompose with respect to.
Required when the expression has several variables.
Example:
intro("x", [Assumption.REAL], [])
expr_key = introduce_expression("1/(x**2 - 1)")
result_key = apart_expression(expr_key, "x")
# -1/(2(x + 1)) + 1/(2(x - 1))
Returns:
A key for the decomposed expression.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| expr_key | Yes | ||
| var_name | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |