AngouriMath

Navigation

← Back to list of members

Of​(AngouriMath.​Entity,​System.​Collections.​Generic.​IReadOnlyDictionary{AngouriMath.​Entity.​Variable,​AngouriMath.​Core.​Dimension})

 Method (no overloads)

Summary

The dimension of expr as written, or the subexpression where
it stops making physical sense.

Parameter "expr"

The formula, an expression or a statement.

Parameter "dimensions"

The dimension of each variable it mentions. The constants
pi and e and every number are pure numbers and need no entry.

Returns

Consistent with the dimension of the result — a
statement such as an equation is a pure number once its sides agree;
Inconsistent with the subexpression at fault and why;
or Undetermined where it could not be settled.

Remarks

A literal 0 or oo fits any dimension where it is added or compared,
since it is the same quantity in every unit: v = 0 is meaningful.
Nothing is simplified first. sin(x) - sin(x) with x a length is
inconsistent, although it simplifies to 0.

Example

using System;
using System.Collections.Generic;
using AngouriMath;
using AngouriMath.Core;
            
var acceleration = Dimension.Length / Dimension.Time.Pow(2);
var dims = new Dictionary<Entity.Variable, Dimension>
{
    ["g"] = acceleration, ["h"] = Dimension.Length, ["t"] = Dimension.Time,
};
Console.WriteLine(MathS.Dimensions.Of("sqrt(2 g h)", dims));
Console.WriteLine(MathS.Dimensions.Of("h - g t^2 / 2 = 0", dims));
Console.WriteLine(MathS.Dimensions.Of("h + g t", dims));

Prints
Consistent: L T^-1
Consistent: 1
Inconsistent at h + g * t: h has dimension L and g * t has dimension L T^-1, so they cannot be added

























Angouri © 2019-2026 · Project's repo · Site's repo · Octicons · Transparency · 6003 pages online