Skip to main content
Glama

apart_expression

Decomposes rational expressions into partial fractions, enabling easier integration and inverse Laplace transforms.

Instructions

    Partial fraction decomposition.

    ═══════════════════════════════════════════════════════════════════════
    🆕 PHASE 1 - NOT IN SYMPY-MCP OR NSFORGE v0.2.3!
    ═══════════════════════════════════════════════════════════════════════

    Decomposes rational functions into sum of simpler fractions.

    CRITICAL FOR:
    - Inverse Laplace transform
    - Integration of rational functions
    - Compartment model analysis
    - Transfer function decomposition

    Args:
        expression: Rational function to decompose
        variable: Variable for decomposition (auto-detect if None)
        full: Return full decomposition (default: False)

    Returns:
        Partial fraction decomposition with LaTeX

    Examples:
        # Simple decomposition
        apart_expression("(x**2 + 3*x + 2)/(x**2 + 5*x + 6)", "x")
        → {"result": "1 - 2/(x + 3)", ...}

        # Compartment model transfer function
        apart_expression("dose*k12 / ((s + λ1)*(s + λ2))", "s")
        → {"result": "A/(s + λ1) + B/(s + λ2)", ...}
        # Prepare for inverse Laplace!

        # Integration preparation
        apart_expression("1/(x**2 - 1)", "x")
        → {"result": "1/(2*(x - 1)) - 1/(2*(x + 1))", ...}

        # Complex poles
        apart_expression("1/(x**2 + 1)", "x")
        → {"result": "-I/(2*(x - I)) + I/(2*(x + I))", ...}
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fullNo
variableNo
expressionYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It explicitly describes the transformation performed and the return format ('Partial fraction decomposition with LaTeX'), with multiple examples showing the expected output structure. While it doesn't explicitly state that the operation is non-mutating or read-only, the nature of a computational math tool makes this implicit, and the description provides sufficient behavioral clarity.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with sections for Args, Returns, and Examples, but it is longer than necessary and includes an unusual 'PHASE 1' header that may distract or confuse. Most content is valuable, especially the examples, but the header and repetitive formatting could be trimmed without losing meaning.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description provides a thorough context for a relatively simple tool: it explains the mathematical operation, lists practical use cases, documents all parameters, clarifies the return format (with LaTeX), and gives multiple examples covering simple, complex, and compartment-model scenarios. The presence of an output schema reduces the need to detail return values, but the description still covers the essentials comprehensively.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has 0% description coverage, so the description must compensate. It defines all three parameters clearly ('expression: Rational function to decompose', 'variable: Variable for decomposition (auto-detect if None)', 'full: Return full decomposition'), and the examples illustrate parameter usage. The explanations are brief but adequate, helping the agent understand each parameter's role beyond the schema's type/default info.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it performs 'partial fraction decomposition' with a specific verb ('decomposes') and resource ('rational functions'). It distinguishes itself from sibling tools like factor_expression or expand_expression by its unique mathematical focus, reinforced by examples and the 'CRITICAL FOR' use cases.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context by listing critical use cases (inverse Laplace, integration, compartment models, transfer function decomposition) but does not explicitly mention when not to use the tool or name alternatives. It implies appropriate usage but lacks explicit exclusions, so it stops short of a 5.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/u9401066/nsforge-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server