< Back

Invoke-MathEvaluator

Sat Jan 18, 2020 11:29 am

NAME Invoke-MathEvaluator



SYNOPSIS

Evaluates mathematical expressions, with support for basic functions (sqrt, cos, etc.) and conversions ([in->ft]

and [ft->m] etc.) and variables.





SYNTAX

Invoke-MathEvaluator [[-Expression] <String[]>] [<CommonParameters>]





DESCRIPTION

This is currently using the old LoreSoft.Calculator engine https://github.com/loresoft/Calculator



It supports:

- Math expressions as strings, including grouping

- Trigonometry and various other functions

- Common unit conversions in Length, Mass, Speed, Temperature, Time, and Volume

- Variables including the last "answer"





PARAMETERS

-Expression <String[]>

A mathematical expression



Required? false

Position? 1

Default value

Accept pipeline input? true (ByValue, ByPropertyName)

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>math 2^5



32









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>math "(2 ^ 3) * sqrt(pi)"



14.179630807244127









-------------------------- EXAMPLE 3 --------------------------



math "120 [in->ft]"



10



C:\\PS> math answer [ft->m]



3.048











RELATED LINKS