> For the complete documentation index, see [llms.txt](https://docs.openbrim.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.openbrim.org/developers/paramml-developer-guide/functions/custom-function/cubic-a-b-c-d.md).

# cubic (a, b, c, d)

The function calculates the value of x (root) in a cubic equation of the form ax^3 + bx^2 + cx + d = 0, where a, b, c, and d are the coefficients specified as input to the function.

The result of the calculation will be the values of x (root) that satisfies the equation.

**Example:**

```xml
...
    <!-- example1 -->
    <P N="x1" V="cubic(5,10,1,3)" />
    <P N="x2" V="cubic(1,3,3,1)" />
    <P N="x3" V="cubic(1,3,3,1)[0]" />
...
```

![](https://openbrim.atlassian.net/wiki/download/attachments/2167701552/image-20230213-143730.png?api=v2) The function solves a system of 3 linear equations with 3 unknowns and returns one of the solutions in the x3 parameter. The solution is selected by specifying which root you want to retrieve using square brackets, with the first root being represented by \[0], the second by \[1], and the third by \[2]. The function will return the requested root as the result.

```xml
...
     <!-- example2: 24x^3 + 34x^2 -5x -3 = 0 -->
     <O N="C1" T="Group">
        <P N="a1" V="24" />
        <P N="b1" V="34" />
        <P N="c1" V="-5" />
        <P N="d1" V="-3" />
        <P N="root_ex1" V="cubic(a1,b1,c1,d1)" D="Solution for a cubic equation with real roots" />
    </O>
...
```

![](https://openbrim.atlassian.net/wiki/download/attachments/2167701552/image-20230213-144548.png?api=v2)

```xml
...
    <!-- example3: x^3 - 3x^2 + 7x + 75 = 0 -->
    <O N="C2" T="Group">
        <P N="a2" V="1" />
        <P N="b2" V="-3" />
        <P N="c2" V="7" />
        <P N="d2" V="75" />
        <P N="root_ex2" V="cubic(a2,b2,c2,d2)" D="Solution for a cubic equation with complex roots" />
    </O>
...
```

To view this example in the library, see (<https://openbrim.org/platform/?application=inc&author=ParamML_Examples_OpenBrIM+Platform&folder=Functions&obj=objidvt2corziomsxfuebw6jg3>)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.openbrim.org/developers/paramml-developer-guide/functions/custom-function/cubic-a-b-c-d.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
