Try to type something like:
- + : adition
- - : subtration
- / : division
- * : multiplication
- ^ : power (note: "3²" will lead to one error, use "3^2")
- % : floating point modulus
- | : Integer Division
- ! : Boolean NOT equal
- = : Boolean equal
- < : Boolean less than
- > : Boolean greater than
Other operations like trigonometric and exponential functions are defined in the standart plugin package, check out "the documentation folder for more (doc/)
Suposse you need to calculate the cinetic energy of a car:
E = 1/2*m*v^2
Setting VariablesOk, imagine that our car weight is 1200 kg and its speed is 40 m/s Set up two variables for this:
- "def mass: 1200"
- "def speed: 40"
Using a VariableSimply type the variable name:
"1/2 * mass * speed ^ 2
Setting the functionuse the same keyword, def.
"def cineticEnergy(mass, speed): 1/2*mass*speed^2"
This command cna be read as "Define the symbol cineticEnergy, in function of mass and speed, as the following expresion: 1/2*mass*speed^2"
Using a FunctionTo use a function is as easy as usinga variable, try out "cineticEnery(1200, 400)"
Unsetting a functionUse "undef symbol_name()" for functions or "undef symbol_name" for variables.
Function namesfunctions names should always start and end with a letter.
"test1a" is a valid name!
"test1" is not!
only numbers and letters suported... no special characters like "_" or " " (empty space)
What is it?Some times genSymbols cant do the work. We need more horsepower! If tou are a programmer, you can write a library, kind of a plugin, just check out "doc" folder for more info. If you're not a programmer, just email-me with what you'd like to see in calc++ standart libraries package.
Return typesLibrary functions can return some value, like genSymbols, or not! You cannot use a function that does not return into one expresion, but don't worry, libmath++ will tell you when you type something wrong.
Syntax Rulescomma (",") is the default argument separator... which can be changed at compile time on math_global.cpp.
External LibrariesOk... libmath++ can handle "plugins" but we don't know how to tell it to use plugins.. That's for what keyword "import" is for! just type "import full_library_path_without_spaces" and you're ready to rock!