using uCalcSoftware;

var uc = new uCalc();
uc.DefineConstant("pi = Atan(1) * 4");

// Original Cosine behavior with Radian
Console.WriteLine(uc.EvalStr("Cos(pi)"));
Console.WriteLine(uc.EvalStr("Cos(180)"));

// Cos is renamed to CosR so that Cos can now be defined in Degree
uc.ItemOf("Cos").Rename("CosR");
uc.DefineFunction("Cos(x) = CosR(x*pi/180)");

// Now Cos is in Degree
Console.WriteLine(uc.EvalStr("Cos(pi)"));
Console.WriteLine(uc.EvalStr("Cos(180)"));

// This is the original function now named CosR
Console.WriteLine(uc.EvalStr("CosR(pi)"));
Console.WriteLine(uc.EvalStr("CosR(180)"));
// Note: Some functions may be overloaded, such as the Cos function in
// this example, which has a definition for Double and another for Complex.
// This example renames only the Double precision version.
// You can use NextOverload() and DataType() to pinpoint the one you want