Any defined item that has a name (such as a variable, constant, function, operator, etc) can be renamed with this function.
uc.DefineConstant("pi = Atan(1) * 4")
' Original Cos behavior with Radian
Console.WriteLine(uc.Eval("Cos(pi)")) ' Returns -1
Console.WriteLine(uc.Eval("Cos(180)")) ' Returns -0.59846
' Cos is renamed to CosR so that Cos can now be defined in Degree
uc.GetItemOf("Cos").Rename("CosR")
uc.DefineFunction("Cos(x) = CosR(x*pi/180)")
' Now Cos is in Degree
Console.WriteLine(uc.Eval("Cos(pi)")) ' Returns 0.998497
Console.WriteLine(uc.Eval("Cos(180)")) ' Returns -1
' This is the original function now named CosR
Console.WriteLine(uc.Eval("CosR(pi)")) ' Returns -1
Console.WriteLine(uc.Eval("CosR(180)")) ' Returns -0.59846
' 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.
uc.DefineConstant("pi = Atan(1) * 4");
// Original Cos behavior with Radian
Console.WriteLine(uc.Eval("Cos(pi)")); // Returns -1;
Console.WriteLine(uc.Eval("Cos(180)")); // Returns -0.59846;
// Cos is renamed to CosR so that Cos can now be defined in Degree
uc.GetItemOf("Cos").Rename("CosR");
uc.DefineFunction("Cos(x) = CosR(x*pi/180)");
// Now Cos is in Degree
Console.WriteLine(uc.Eval("Cos(pi)")); // Returns 0.998497;
Console.WriteLine(uc.Eval("Cos(180)")); // Returns -1;
// This is the original function now named CosR
Console.WriteLine(uc.Eval("CosR(pi)")); // Returns -1;
Console.WriteLine(uc.Eval("CosR(180)")); // Returns -0.59846;
// 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.
//+++E: Temp - Using Overwrite to ..
uc.Define("Overwrite ~~ Function: ");
uc.DefineConstant('pi = Atan(1) * 4');
// Original Cos behavior with Radian
WriteLn(uc.Eval('Cos(pi)')); // Returns -1;
WriteLn(uc.Eval('Cos(180)')); // Returns -0.59846;
// Cos is renamed to CosR so that Cos can now be defined in Degree
uc.GetItemOf('Cos').Rename('CosR');
uc.DefineFunction('Cos(x) = CosR(x*pi/180)');
// Now Cos is in Degree
WriteLn(uc.Eval('Cos(pi)')); // Returns 0.998497;
WriteLn(uc.Eval('Cos(180)')); // Returns -1;
// This is the original Function_ now named CosR
WriteLn(uc.Eval('CosR(pi)')); // Returns -1;
WriteLn(uc.Eval('CosR(180)')); // Returns -0.59846;
// 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.
uc.DefineConstant("pi = Atan(1) * 4");
// Original Cos behavior with Radian
cout << uc.Eval("Cos(pi)") << endl; // Returns -1;
cout << uc.Eval("Cos(180)") << endl; // Returns -0.59846;
// Cos is renamed to CosR so that Cos can now be defined in Degree
uc.GetItemOf("Cos").Rename("CosR");
uc.DefineFunction("Cos(x) = CosR(x*pi/180)");
// Now Cos is in Degree
cout << uc.Eval("Cos(pi)") << endl; // Returns 0.998497;
cout << uc.Eval("Cos(180)") << endl; // Returns -1;
// This is the original function now named CosR
cout << uc.Eval("CosR(pi)") << endl; // Returns -1;
cout << uc.Eval("CosR(180)") << endl; // Returns -0.59846;
// 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.
//+++E: Temp - Using Overwrite to ..
uc.Define("Overwrite ~~ Function: ");
uc.DefineConstant("pi = Atan(1) * 4");
// Original Cos behavior with Radian
Console::WriteLine(uc.Eval("Cos(pi)")); // Returns -1;
Console::WriteLine(uc.Eval("Cos(180)")); // Returns -0.59846;
// Cos is renamed to CosR so that Cos can now be defined in Degree
uc.GetItemOf("Cos").Rename("CosR");
uc.DefineFunction("Cos(x) = CosR(x*pi/180)");
// Now Cos is in Degree
Console::WriteLine(uc.Eval("Cos(pi)")); // Returns 0.998497;
Console::WriteLine(uc.Eval("Cos(180)")); // Returns -1;
// This is the original function now named CosR
Console::WriteLine(uc.Eval("CosR(pi)")); // Returns -1;
Console::WriteLine(uc.Eval("CosR(180)")); // Returns -0.59846;
// 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.
//+++E: Temp - Using Overwrite to ..
uc.Define("Overwrite ~~ Function: ");
<DllImport(uCalcDLL, CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.Cdecl, EntryPoint:="Rename")> _
Private Sub Rename__(ByVal ItemHandle As IntPtr,ByVal NewName As String)
End Sub
[DllImport(uCalcDLL, CharSet=CharSet.Ansi, CallingConvention=CallingConvention.Cdecl, EntryPoint="Rename")]
protected static extern void Rename_(IntPtr ItemHandle, string NewName);
{DLLImport}procedure Rename__(ItemHandle: System.Pointer;NewName: AnsiString); cdecl; external uCalcDLL name 'Rename';
typedef void (* __Rename)(void *ItemHandle, CONSTCHAR NewName );
[DllImport(uCalcLib, CharSet=CharSet::Ansi, CallingConvention=CallingConvention::Cdecl, EntryPoint = "Rename")]
static void Rename_(void * ItemHandle, MARSHALSTR NewName);