Expresions
24.jul.2009
linmath++ can handle all mathematical functions with real numbers.
Try to type something like:
Try to type something like:
- "5+6"
- "45*7-3*(-7/6)"
Operations
- + : 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
Other operations like trigonometric and exponential functions are defined in the standart plugin package, check out "the documentation folder for more (doc/)
Variables
24.jul.2009
calc++ can handle variables, when you are on a physics class, for example
it can be very usefull. Lets take a pratical example:
Suposse you need to calculate the cinetic energy of a car:
E = 1/2*m*v^2
"1/2 * mass * speed ^ 2
Suposse you need to calculate the cinetic energy of a car:
E = 1/2*m*v^2
Setting Variables
Ok, 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 Variable
Simply type the variable name:"1/2 * mass * speed ^ 2
Mathematical Functions
24.jul.2009
libmath++ works with symbols. Similary to variables there are the genSymbols.
The difference between symbols and genSymbols is the parameters, or arguments.
Lets use the same example of the car's cinetic energy:
"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"
"test1a" is a valid name!
"test1" is not!
only numbers and letters suported... no special characters like "_" or " " (empty space)
Setting the function
use 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 Function
To use a function is as easy as usinga variable, try out "cineticEnery(1200, 400)"Unsetting a function
Use "undef symbol_name()" for functions or "undef symbol_name" for variables.Function names
functions 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)
Functions
24.jul.2009
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 types
Library 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 Rules
comma (",") is the default argument separator... which can be changed at compile time on math_global.cpp.External Libraries
Ok... 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!Plugins
24.jul.2009
For a little tutorial on plugin writing, check out the documentation folder.