AngouriMath

Navigation

← Back to list of members

Expand​(System.​Int32)

 Method (no overloads)

Summary

Expands an equation trying to eliminate all the parentheses ( e. g. 2 * (x + 3) = 2 * x + 2 * 3 )

Parameter "level"

The number of iterations (increase this argument in case if some parentheses remain)

Returns

An expanded Entity if it wasn't too complicated,
current entity otherwise
To change the limit use MaxExpansionTermCount

Example

using System;
using static AngouriMath.MathS;

var (x, y) = Var("x", "y");

var expr = (x + 3) * (Sin(y) + 5);
Console.WriteLine(expr);
Console.WriteLine(expr.Expand());
Console.WriteLine("-----------------------------------");
var expr2 = Pow(x + y, 8);
Console.WriteLine(expr2);
Console.WriteLine(expr2.Expand());

Prints
(x + 3) * (sin(y) + 5)
x * sin(y) + x * 5 + 3 * sin(y) + 15
-----------------------------------
(x + y) ^ 8
y ^ 8 + 8 * x * y ^ 7 + 28 * x ^ 2 * y ^ 6 + 56 * x ^ 3 * y ^ 5 + 70 * x ^ 4 * y ^ 4 + 56 * x ^ 5 * y ^ 3 + 28 * x ^ 6 * y ^ 2 + 8 * x ^ 7 * y + x ^ 8

























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