AngouriMath

Navigation

← Back to list of members

TryPolynomial​(AngouriMath.​Entity,​AngouriMath.​Entity.​Variable,​AngouriMath.​Entity@)

 Method (no overloads)

Summary

Returns an Entity in polynomial order if possible

Parameter "expr"

The unordered Entity

Parameter "variable"

The variable of the polynomial

Parameter "dst"

The ordered result

Returns

true if success,
false otherwise (dst will be null)

Example

using System;
using AngouriMath;
using static AngouriMath.MathS;

Entity expr = "a x + b (x + 3) + (x + 2) * (x + 3)";
if (TryPolynomial(expr, "x", out var res))
    Console.WriteLine(res);
else
    Console.WriteLine("Cannot get polynomial :((");

Entity expr2 = "sin(x) + cos(x)";
if (TryPolynomial(expr2, "x", out var res2))
    Console.WriteLine(res2);
else
    Console.WriteLine("Cannot get polynomial :((");

Prints
x ^ 2 + (a + b + 3 + 2) * x + b * 3 + 6
Cannot get polynomial :((

























Angouri © 2019-2023 · Project's repo · Site's repo · Octicons · Transparency · 1534 pages online