Description

MathPro is a numerical computing environment and programming language mostly compatible with Matlab. You can implement any numerical method using this program. MathPro is designed in order the user interact more efficiently. Is caracterised by:

  • Programs can be viewed or edited using the present famous mobile text editor
  • Writing programs more efficiently and solve any mathematical problem.

This Mathematical tool for Mobile Phones and Tablets is a Must-have tool for students, professionals and scientists. MathPro's interface integrate standard mathematical notation, programming statements, and text in a single worksheet. Is very flexible, fast, and more professional. It runs on Android Mobile Phones and Tablets. MathPro is part of MobileMaths. You can get the tool MathPro by downloading MobileMaths.

 

Vectors and Matrices
linspace(var1,var2,COUNT) vector with COUNT numbers ranging from var1 to var2
length(vector) number of elements in vector
zeros(ROWS[,COLUMNS]) create array of all zeros
ones(ROWS[,COLUMNS]) matrix of ones
eye(ROWS[,COLUMNS]) matrix with diagonal one
size(matrix) number of rows and columns
sum(var) if var is a vector: sum of elements, if var is a matrix: sum of columns.
max(var) largest element in var
min(var) smallest element in var
det(matrix) determinante
eig(matrix) eigenvalues
inv(matrix) inverse

lu(matrix) LU-decomposition
diag(matrix) extracts diagonal elements

Polynomials
ploy(x) creation of a polynomial with specified roots x, poly(x) is a vector whose elements are the coefficients of the polynomial whose roots are the elements of x. Example: y=poly([2,1]).
polyval(v,var) generates a new value (estimate) of y at var based on the coefficients vector v found with polyfit.see example 10
polyfit(x,y,n) finds the coefficients of a polynomial p(x) of degree n that fits the data, p(x(i)) is approximately equal to y(i), in a least-squares sense. see example 10
 
interp1(x,y,xi) 1-D cubic spline interpolation of x/y-values at xi. yi = interp1(x,y,xi) interpolates to find yi, the values of the underlying function y at the points in the array xi. Example: x=[1,5,15]; y=[15,35,55];xi=6;yi=interp1(x,y,xi)
interp2(x,y,z,xi,yi) 2-D cubic spline interpolation of x/y/z-values at xi and yi. zi = interp1(x,y,z,xi,yi) interpolates to find zi, the values of the underlying function z at the points in the arrays xi and yi. Example: x=[1,5,15]; y=[15,35,55];z=[25,66,88]; xi=6;yi=8;z=interp1(x,y,z,xi,yi)
sparse(x) create sparse matrix, converts a sparse or full matrix to a sparse form by squeezing out any zero elements. s=sparse(x)
fit(x,y,FUNCTION) fit data with arbitrary fitting function, x and y must be vectors of equal length. FIT computes the coefficients of the arbitrary function. Example: x=[1,2,3,4];y=[5,25,30,55];fit(x,y,'y=a*x/(x+b)'); or x=[1,2,3,4];y=[5,25,30,55];fit(x,y,'a*x/(x+b)');
ezfit(x,y,FUNCTION) the same as fit
fmin(FUN,x0) starts at x0 and attempts to find a local minimizer x of the function FUN. Example: fmin('sin(x)',3).
eval('expression') execute string containing expression. Example: x=3;eval('x^2+3')
fzero('expression',x0) single-variuable nonlinear zero finding. Tries to find a zero of the function near x0. Example: fzero('x^2-4',0).
roots(p) or roots([coeff]) computes the roots of the polynomial roots. The polynomial is c(1)*x^n+.....+c(n)*x+ c(n+1).
solve(expression,x) serach roots for a non linear equation. Example: syms x;y=x^2-1;solve(y,x). syms x;y=x^2+3*x-17*sqrt(3*x^2+6);solve(y,x).
syms arg1, arg2, ..... constucting symbolic variables. Example: syms x, y, z.
integrate(Function,x) integartes function with respect to the symbolic variable x. Example: syms x;integrate(3*x^2+2*x-5,x).
quad('expression',x1,x2) numerically evaluate integral, adaptive Simpson quadrature. Example: quad('sqrt(x)',0,2).

Plotting
plot(x,y) 2-D line plot; x and y being equalsized vectors, which denote the coordinates of the data points to be plotted. see example 13
plot(x,y,option) 2-D line plot; a third optional argument option specifies plot options like colors and symbols. see example 13
loglog(x,y,option) log-log scale plot
semilogx(x,y,option) Semilogarithmic plot
semilogy(x,y,option) Semilogarithmic plot

Comparison and Logical Operators
Less x < y
Less or equal x <= y
Larger x > y
Larger or equal x >= y
Equal x == y
Not equal x ˜= y
And x & y
Or x | y
Not ˜x

Arithmetic Operators
Addition x + y
Subtraction x - y
Multiplication x * y
Division x \ y
Exponentiation x ˆ y
Range x:y:z
Assignment x += z
Assignment x -= z
Assignment x /= z
Assignment x *= z
Postincrement x++
Postdecrement x--

Scalar Functions
rat(var) var as exact number
real(var) real part of var
imag(var) imaginary part of var
abs(var) absolute value of var
sign(var) sign of var
conj(var) var conjugate complex
sqrt(var) squareroot
exp(var) exponential
ln(var) natural logarithm
log(var) decimal logarithm
sinh(var) hyperbolic sine
cosh(var) hyperbolic cosine
asinh(var) hyperbolic areasine
acosh(var) hyperbolic areacosine
sin(var) sine (radian)
cos(var) cosine (radian)
tan(var) tangens (radian)
asin(var) arcsine (radian)
acos(var) arccosine (radian)
atan(var) arctangens (radian)
fact(n) factorial n!

Comment statements

MathPro comment statements begin with the percent character, %. All characters from the % to the end of the line are treated as a comment.

Flow Control

MathPro supports the basic flow control constructs found in most high level programming languages, the same as in MathLab language.

Branches if constructs

MathPro supports these variants of the ``if'' construct

  • if ... end
  • if ... else ... end
  • if ... else if ... else ... end end

Jumps
return, continue, break
A function may be prematurely left using return.
continue and break are used in loops: continue jumps back to the start of the loop, and begins another cycle. break permanently leaves the loop.

Loops:
For Loops

The for loop allows us to repeat certain commands. If you want to repeat some action in a predetermined way, you can use the for loop. All of the loop structures in MathPro are started with a keyword such as "for", or "while" and they all end with the word "end".

The for loop is written around some set of statements, and you must tell MathPro where to start and where to end. Basically, you give a vector in the "for" statement, and MathPro will loop through for each value in the vector:

While Loops

If you don't like the for loop, you can also use a while loop.

The while loop repeats a sequence of commands as long as some condition is met.

Programming in MathPro
break Terminate execution of for or while loop
continue Pass control to next iteration of for or while loop
else Conditionally execute statements
end Terminate conditional block of code
error Display error message and exit the program
disp Display error message and exit the program
for Execute block of code specified number of times
if Conditionally execute statements
return Return to invoking function
while Repeatedly execute statements while condition is true>
write display text and variables
( ) Pass function arguments
% Insert comment line into code
eval eval(expression) executes expression, a string containing a valid MathPro expression. see examples 7 and 8
function declare a function. see below examples

Examples included in MathPro
Example 1 Gauss Elimination
Example 2 TDMA Solver
Example 3 Bisection
Example 4 Falsposition
Example 5 Secant
Example 6 Newton Raphson
Example 7 Integral Trapezoid
Example 8 Integral Simpson
Example 9 Runge Kutta 4
Example 10 Interpolation
Example 11 Finite Difference
Example 12 Heat Explicit Solver
Example 13 Plotting Data

 

 

Create an account



News Briefs