Hi all,
Here is calcula32 in a window version (GUI)
Try it and say something
Good luck !
RuiLoureiro
We can solve:
0. We can define a set of 10 variables: t=10;x=2.3;...
1. any expression
2. mean(x1,...,xn): mean(12,13,12,13,14)
3. factorial and k-combination of n: 12!, comb(12,5)
4. equation: aX^2+bX+c=0
5. System of 2 equations: type aX+bY=c;fX+gY=h;
6. System of 3 equations: type aX+bY+cZ=d;fX+gY+hZ=i;
jX+kY+mZ=l;
(note: a,b,c, ... real numbers)
EDIT: Please, dont use calcula32 to solve systems of equations
because, in some cases -impossible/infinite-the result is not correct.
Use the last calcula35 where you can type and press ENTER or
press DELETE to delete the input.
EDIT: i decided to remove calcula32 and to replace it by calcula36
EDIT: calcula45 was replaced by the new
calcula46 v1.06. Please, see the last post
EDIT: calcula46 was replaced by the new
calcula47 v1.07. Please, see the last post
Here is calcula33 in a window version (GUI)
The procedures to solve systems of equations are now correct;
It solves also equations like this: piX+Y=12;eX+piY=5; where pi and e
are system constants;
If you know some more problems, please tell me here, no problems !
Remember that, we can type an expression with spaces like this:
pi X + Y = 1 2 ; e X + p i Y = 5 ;
. The prog removes all spaces before starting to work
. We can type an expression and press ENTER or press DELETE to delete the input
Do you want to say something about it ? Please, write something
Thanks
Good luck !
RuiLoureiro
EDIT: With systems of equations we must write first X next Y next Z
It is wrong to write 3Y+2X=5;Y-X=1;
EDIT: Please, use the last calcula35.
Hey,
what about calculating the determinant of linear equation systems (3x3)? Would be helpfull, if the system has no or none unique solution.
qWord,
Thank you for reply and for that particular question.
First, i solved the system (2x2) and (3x3) using matrices
and it compute the determinant (2x2) and (3x3) to get the
solutions. But ok, i can show the determinant value in the next calcula??;
Second, if the system has no or none unique solution, it
gives the result: impossible or infinite.
Try to solve this in calcula33:
a) X+Y=10 ; 2X+2Y= 20; (infinite solutions)
b) X+Y=1 ; X+Y= 3; (impossible)
In any way thank you for your reply :U
ok :P
I've misinterpreted the output: your program maybe better returns a sentence instead of Infinite for all variables.
Quote from: qWord on April 10, 2012, 04:15:53 PM
ok :P
I've misinterpreted the output: your program maybe better returns a sentence instead of Infinite for all variables.
Thanks, no problem ! :wink
What is your suggestion ? I accept all suggestions. :U
When i write "infinite" i want to say infinite solutions
In the next calcula?? it gives "Infinite solutions" and
it shows the determinant in all cases
Quote from: RuiLoureiro on April 10, 2012, 04:51:36 PM What is your suggestion ? I accept all suggestions. :U
"The System of linear equations has no unique solution" and "The System of linear equations has no solution"?
qWord
Quote from: qWord on April 10, 2012, 05:03:18 PM
["The System of linear equations has no unique solution" and "The System of linear equations has no solution"?
qWord
Ok, i accept the suggestion, it works.
It will go in the next calcula34 ! :wink
"Undefined"
how about interpolate/extrapolate :P
i.e., when they enter a linear equation, it waits for them to enter an X or Y to plot the point
...then add a BSL function with interpolate/extrapolate :bg
Hi Dave,
It is a good idea. I will go to think about it :wink
Hi all,
Here is calcula34 in a window version (GUI)
Now, it is not possible to define a name of a constant with symbols.
Only letters or digits 0 to 9, starting with a letter;
Remember that when we define a set of constants i.e. tt=10;sx=5.45;
we can type the name to get the value: to get the value of sx
type sx [ENTER] and we get 5.45;
Now, when a system of equations has no solution or not unique
the output is:
"The System of linear equations has no solution"
or "The System of linear equations has no unique solution"
following qWord suggestion; The determinant is shown also.
Now, we can use constants (variables ) in a system of 2 equations;
Now, we can use 6 memories to save what is in the input box
and we can recall each one: Save1 - Recall1; Save2-Recall2; etc.
For instance, we can define one set of constants (or variables)
and save it with Save1; another set and Save2, etc. and
then we can use one or another. To use one set, first Recall it
ant press ENTER to set it into a table, then type an expression
with that constants
Thank you all
Hi all,
Here is calcula35, a new version
I decided to rewrite all procedures to solve a system of
2 equations, a system of 3 equations and a quadratic equation.
Now, any coefficient can be:
. pi or +pi or -pi ;
. e or +e or -e ;
. a number (in scientific notation or not) ;
. a variable name
Systems of 2 equations
. We must use X and Y
. But it is not importante to write first X or first Y.
examples:
3Y - t X = m; pi X + 2 Y= k; (t,m, k are variables)
-yyY - e X = 2e3; pi X - Y= xxx; (yy,xxx are variables)
Note that, when we type: x=12 ; y= 10;
it is a definition of variables x and y
But x=12 ; -y= 10 ; is a system of 2 equations
Systems of 3 equations
. We must use X, Y and Z
. But it is not importante to write first X or first Y or first Z.
Z+X=10 ; y-X= t ; 2z-xxx x= 2.5; (t,xxx are variables)
Note that, when we type: z=1.3; x=12 ; y= 10;
it is a definition of variables z, x and y
But -z=1.3; x=12 ; y= 10 ; is a system of 3 equations
Quadratic equation
. a X^2 + b X + c = c0 where a,b,c,c0 can be any coefficient
. We must use X^2 and X or only X: sX+2.3=5; (s is a variable name)
. We must use X^2 first and then X: 2 x-3 X^2+1=0 is error
-tX^2+piX-e=1e2 (t is a variable name)
Any bug, pelase answer this post
Good luck !
Thank you all
EDIT: there is a little problem with scientific notation
in the case like this "e2". It doesnt give ERROR
but gives a wrong result. I corrected it and
i uploaded the calcula35 again.
Now we can type "e2" in equations and calcula35 takes
it as "1e2" - replace "e2" by "1e2".
If we type e2 [ENTER] it gives ERROR
I am thinking that scientific notation sometimes is a problem.
Why we cannot type e2 instead of 1e2 ?
Why we need to write 1e2 and not e2 to stands for 100 ? (1eN=10^N)
In this way, when we want 10^5 we type e5 and it is = 1e5.
Taking this into account, now, when we write equations, calcula35
replaces eN by 1eN, +eN by +1eN and -eN by -1eN before converting it
and we dont need to type the "1". Is it better, no ?
I think that many programming and scripting languages do distinguish between identifier and numbers by the first character: if it is a digit between 0-9, it is a number, otherwise it is a identifier.
So most people with corresponding background would think that e1 is a identifier rather than a number...
(furthermore this would prohibit identifier begingin with 'e')
qWord:
Quote
I think that many programming and scripting languages do distinguish between identifier
and numbers by the first character: if it is a digit between 0-9, it is a number,
otherwise it is a identifier
It is a good general rule, but in calculaXX i dont need to follow this
rule when the expression is a system of equations or a quadratic
equation because to distinguish between the constant
e and
scientific notation we need only to know what is behind
X, Y or Z. We have the cases (we can use X or Y or Z):
eX - is a constant
e +eX - is a constant
e -eX - is a constant
e edX - is
scientific notation (d is a digit)
e+dX - is
scientific notation (d is a digit)
e-dX - is
scientific notation (d is a digit)
But if we write
an expression we have problems.
What is this: e+d * exp(x) ?
e+d is a scientific notation
or
e is the constant
e and we want to add
e plus d ?
In calculaXX that
e is taken as the constant
e but
1e+d is a scientific notation.
Hi all,
Here is calcula36, a new version of calcula35
We have the functions point(x1,y1; ... ;x6,y6)
to put that set of points into a table;
and the function f(x=a) or f(y=b)
to execute a linear interpolation.
When we execute a linear interpolation, the output is
X, Y, m and b (linear equation: y=mx+b)
Note that when we try f(x=a) the program sort the table by X
and use the nearest x point; when we try f(y=a) the program
sort the table by Y and use the nearest y point.
Example:
point(1,2 ; 3,5 ; 5,-1)
Sorting by X we have: (1,2), (3,5), (5,-1)
. To calculate f(x=0) it uses the points (1,2) and (3,5)
. To calculate f(x=2) it uses the points (1,2) and (3,5)
. To calculate f(x=4) it uses the points (3,5) and (5,-1)
. To calculate f(x=6) it uses the points (3,5) and (5,-1)
Sorting by Y we have: (5,-1), (1,2), (3,5)
. To calculate f(y=-2) it uses the points (5,-1) and (1,2)
. To calculate f(y=0) it uses the points (5,-1) and (1,2)
. To calculate f(y=3) it uses the points (1,2) and (3,5)
. To calculate f(y=6) it uses the points (1,2) and (3,5)
Note that, now, the point (5,-1) is near the point (1,2) !
Try it and say something.
If you have any idea or suggestion, please answer thsi post
Thanks
RuiLoureiro
cool :U
Dave,
one word to you: thanks ! :wink
Hi all,
Here is calcula37, a new version of calcula36
. The functions to do a linear interpolation are now
g(x=a) or g(y=b)or G(x=a) or G(y=b)
we can use x or X, y or Y;
. When the output is 1.000000000000, now it is only 1.0
if the result is 1.000000000000E+0045, now it is only 1.0E+0045
. sin(pi)=sin(0)= 0 not -0.0000000000000
error control
. division by 0: 1/0 is division by 0
. indeterminate form: 0/0 is an indeterminate form
functions
. Now we can define a function f(x) [ we must use F(x), F(X), f(X),f(x) ]
. To define a function we must write f(x)=...
To do it, we write something like this
f(x)=x/2-sin(x)/x [ENTER/COMPUTE]
To calculate f(0) or f(1.5) we must write
f(x=0) or f(x=1.5)
. With calcula37 we can define
. a set of 10 variables; [type: t=12;s=5;f=1e3; ]
. a set of 6 points (x,y); [type: point(1,2; 3,5; 4,8) ]
. a function f(x); [type: f(x)=x+1 ]
* we can solve
. a quadratic equation; [type: 2x^2+x-1=5 ]
. a system of 2 equations; [type: y+x=3; x-y=1; ]
. a system of 3 equations; [type: y+x+z=10; x-y=1; -z+y=5; ]
. any expression [type: (3*15.5+2e3)/(1-5.14) ]
* we can do
. linear interpolation [type point(1,2; 3,5) and g(x=2)]
* we can calculate
. the values of a function f(x) [type: f(x=2) or f(x=-1) ]
. mean, variance, standard deviation, etc.
. factorial [type: 6! ]
. k-combination of n [type: comb(10,6)]
* we have the system constants
. pi
. e
* we have 6 memories to save expressions
* we can enter an expression with 200 characters
What next ?
. surprise
Try it and say something.
Is there a bug ? please answer this post
If you have any idea or suggestion, please answer this post
Thanks
RuiLoureiro
Hi all,
Here is calcula38
Now, we have 2 more functions:
. error()
The system error is 1e-3 if we dont use the function error
If we want the error equal 1e-5 (ERROR=1e-5) we do
error(1e-5) [ENTER/COMPUTE]
. root(x=a, x=b)
or
. root(x=a, x=b; n=...)
The root function try to find the value X where f(X)<= ERROR
starting at x=a and end at x=b.
The number of sampled points used by the system is n=200.
If we want n=1000 we use
root(x=a, x=b; n=1000)
Example:
f(x)=3*x^3-x^2+2*x-1
root(x=-1, x=2; n=200)
Xc= 0.455; f(Xc)= -0.014435875 (f(Xc) is the closest value)
Xmin= -1.0
f(Xmin)= -5.0
Xmax= 2.0
f(Xmax)= 23.0
root(x=0, x=1; n=200)
X= 0.46
f(X)= 0.000408
error(1e-5)
root(x=0.4454, x=1; n=1000)
Xc= 0.4598196; f(Xc)= -0.00013028358895
Try it and say something.
Is there a bug ? please answer this post
If you have any idea or suggestion, please answer this post
Thanks
RuiLoureiro
you write code faster than i do, Rui :P
i can't keep up with you - lol
Quote from: dedndave on April 20, 2012, 03:52:29 PM
i can't keep up with you - lol
Same for me - just incredible ::)
:U
Dave,
Quote
you write code faster than i do, Rui
i can't keep up with you
Thanks for reply
The calculator is faster than me !
Jochen,
Quote
Same for me - just incredible
Thanks for reply
It is not fast. It is normal
Here is calcula39 Now, we have
2 more functions:
.
df(x)=expression to define the derivative of the
function f(x) (used to solve the equation f(x)=0)
.
root(x=a, x=b; x=X0 ) to solve f(X)=0 (<= ERROR)
using the
Newton method Examples 1:
f(x) =3*x^3-x^2+2*x-1 df(x)=9*x^2-2*x+2 error(1e-5) root(x=0,x=1;x=0.46) X=0.459863289103337
f(X)=0.000000058678523
error(1e-9) root(x=0,x=1; x=0.46)
X= 0.459863269435932
f(X)= 0.000000000000003
error(1e-15) root( x=-20, x=20;
x=-10 )
X= 0.459863269435931
f(X)= 0 Now, we can start to find the roots of f(x)
using, for instance, root(x=-20, x=20; n=200)
root(x=-20, x=20; n=1000), root(x=-20, x=20; n=10000)
If we find one closest value X0, we define the derivative
and then we use something like this
root(x=-20, x=20;
x=X0).
note:
I corrected a bug in the previous calcula38 EDIT: In
root(x=a, x=b; x=X0 ) a, b, X0 can be
-9pi,...,-1pi, -pi, pi, 2pi, 3pi,...,9pi.
The same for
e Try it and say something.
Is there a bug ? please answer this post
If you have any idea or suggestion, please answer this post
Thanks
RuiLoureiro
Rui - you are a math monster !
i bet you would like this site...
http://projecteuler.net/index.php
i have solved about 20 problems so far :P
Hi all
Here is calcula40
Now, we have 2 more functions:
. df(x=a)=expression
. root(x=a, x=b) n is = 200
root(x=a, x=b; n=integer) n from 200 to 1000000
root(x=a, x=b; d=delta ) d = increment (delta=0.1, 0.01, ...)
root(x=a, x=b; x= X0 ) X0 =starting point
. Calcula40 doest accept some typing errors
when we want to save f(x) or df(x),
and show the error
Example:
f(x)=2x^2+sen(x)+1 [ENTER/COMPUTE]
Error= x^2+sen
f(x)=2x^2+sin(x)+1 [ENTER/COMPUTE]
Error= 2x^2+sin(x)+1
f(x)=2*x^2+sin(x)+1 [ENTER/COMPUTE]
The function is defined
. With calcula40
* we can define
. a set of 10 variables; [type: t=12;s=5;f=1e3; ]
. a set of 6 points (x,y); [type: point(1,2; 3,5; 4,8) ]
. a function f(x); [type: f(x)=x+1 ]
* we can define the error to use with root(...)
. error()
The system error is 1e-3.
If we want the error equal 1e-5 (ERROR=1e-5) we do
error(1e-5)
* we can solve
. a quadratic equation; [type: 2x^2+x-1=5 ]
. a system of 2 equations; [type: y+x=3; x-y=1; ]
. a system of 3 equations; [type: y+x+z=10; x-y=1; -z+y=5; ]
. any expression [type: (3*15.5+2e3)/(1-5.14) ]
* we can solve
. the equation f(x)=0 using root(...)
* we can do
. linear interpolation [type: point(1,2; 3,5) and g(x=2)]
* we can calculate
. the values of a function f(x) [type: f(x=2) or f(x=-1) ]
. the values of a derivative df(x) [type: df(x=2) or df(x=-1) ]
. mean, variance, standard deviation, etc.
. factorial [type: 6! ]
. k-combination of n [type: comb(10,6)]
* we have the system constants
. pi
. e
* we have 6 memories to save expressions
* we can enter an expression with 200 characters
What next ?
. May be to solve a system of 4 linear equations
showing the determinant (solved by determinants)
Try it and say something.
Is there a bug ? please answer this post
If you have any idea or suggestion, please answer this post
Thanks
RuiLoureiro
Hi all,
***Here is calcula41 v1.01***
1. Detailed questions about pi
Now, when we use pi we dont need to use *
In this way, we can type any expression with pi like
n pi OR +n pi OR -n pi ( n integer )
r pi OR +r pi OR -r pi ( r real )
It is the same as
n*pi, +n*pi, -n*pi ( we dont need to type * )
r*pi, +r*pi, -r*pi ( we dont need to type * )
If we type 120pi [ENTER/COMPUTE] we get 376.9911184307752
r may be a scientific notation
-2e3pi [ENTER/COMPUTE] we get -6283.185307179586
the same as -2e3*pi [ENTER/COMPUTE]
2. System of 4 linear equations
. Now we can solve a system of 4 linear equations
. We must use x,y,z,t or X,Y,Z,T in any order.
Examples:
x+y-Z=4; z-T+y=-2; 2x+2t+z=-3; Y-z=5; [ENTER/COMPUTE]
X=-1.0 Y=2.0 Z=-3.0 T=1.0 Determinant=5.0
Bugs
If i find a bug, i will post the next calcula42
What next ?
I am waiting for suggestions
Try it and say something.
Is there a bug ? please answer this post
If you have any idea or suggestion, please answer this post
Thanks
RuiLoureiro
EDIT: qWord, and Dave,
Thanks for reply
I am thinking about your suggestions :bg
generalize the parser thus working with vectors/matrices is possible. Even scalar values could be represented as a 1x1 array:
a = [1,2,3;4,5,6;7,8,9];
b = [10;11;12];
c = a * b;
x = 123 % = [123]
(like matlab :bg)
i was trying to think of ideas :P
base conversion
prime numbers
fibonacci sequences
taylor and other series (perhaps overdoing it a bit)
if you look at the problems on Project Euler, you may get some ideas
http://projecteuler.net/problems
:U Hey, that was cool, how do you create the parser ??
Hi all :bg
Farabi,
Hello !
Thanks for reply
Quote
how do you create the parser ??
It's just the problem !
But the basic answer is this: thinking and doing
If you want i can tell you my basic ideas.
Is simple but i wrote too many procedures to do
that.
Dave,
Quote
prime numbers
Thank you for reply
My problem is how to show a lot of output !
Give me one suggestion.
qWord,
Quote
generalize the parser thus working with vectors/matrices is possible.
a = [1,2,3;4,5,6;7,8,9];
b = [10;11;12];
c = a * b;
Thank you for reply
For now, i decided to follow your suggestion
just as you type. It is easy to integrate it in the calculator.
Just now, it is possible to define a vector line,
vector column or matrix.
The max number of lines or columns is 20 (very big !)
We can define a max number of 20 vectors/matrices
(i think it is enough).
But ...! There is a problem !
How to show 400 numbers ? Opening a new window ?
Quote
Even scalar values could be represented as a 1x1 array:
I decided to reject the case 1x1.
We can define 10 constants, so it is not needed
Hi all,
**** Here is calcula42 v1.02 ****
1. expressions
. The lenght of each expression can be 1200 characters
2. round(a,n)
. n must be one digit 0,1,2,...,9
. new function to round
a) a real number a
round(23.51982,2) [ENTER/COMPUTE]
b) each element of a matrix
array1=[2.456, 1.382, 0.89459]; [ENTER/COMPUTE]
round(array1,2) [ENTER/COMPUTE]
3. matrix names
. Any name starting with a letter with up to 8 characters;
. We can define up to 20 matrices names;
4. matrix definitions
. We can define up to 20x20 matrix
. Now we can define a matrix a
column 1 column 2 column 3
line 1: 1 , 2 , 3 -> 1 2 3
line 2: 4 , 5 , 6 -> 4 5 6
line 3: 7 , 8 , 9 -> 7 8 9
TYPE:
a=[1,2,3 ; 4,5,6 ; 7,8,9 ]; [ENTER/COMPUTE]
Now, press DELETE KEY and
type: a press ENTER/COMPUTE to see the matrix a
. vector column
column 1
line 1: 1 ; -> 1
line 2: 4 ; -> 4
line 3: 7 -> 7
b=[1 ; 4 ; 7 ]; [ENTER/COMPUTE]
. vector line
column 1 column 2 column 3
line 1: 1 , 2 , 3 -> 1 2 3
b=[1 , 2 , 3 ]; [ENTER/COMPUTE]
5. matrix operations
. Addiction
array1=[1, 2; 3, 4]; [ENTER/COMPUTE]
array2=[5, 6; 7, 8]; [ENTER/COMPUTE]
a=array1+array2; [ENTER/COMPUTE]
. Subtraction
array1=[1, 2; 3, 4]; [ENTER/COMPUTE]
array2=[5, 6; 7, 8]; [ENTER/COMPUTE]
b=array1-array2; [ENTER/COMPUTE]
. Multiplication
array1=[1, 2; 3, 4]; [ENTER/COMPUTE]
array2=[5, 6; 7, 8]; [ENTER/COMPUTE]
c=array1*array2; [ENTER/COMPUTE]
. Scalar multiplication
array1=[1, 2; 3, 4]; [ENTER/COMPUTE]
d=10 * array1; [ENTER/COMPUTE]
f=+ array1; [ENTER/COMPUTE]
g=- array1; [ENTER/COMPUTE]
note: f=+array1 is <=> f=array1 and
f=-array1 is <=> f=-1*array1
6. matrix output
We show the matrix in the input edit box
and
in one messagebox
Have you any suggestion to show a big 20x20 matrix ?
Please, let me know
What next ?
. transpose of a matrix
. matrix inverse
Suggestions ?
How to write to do a transpose of a matrix ?
b=a^T; ?????????? (a=matrix m*n)
How to write to do a matrix inverse ?
b=a^-1; ?????????? (a=matrix m*n)
Try it and say something.
Is there a bug ? please answer this post
If you have any idea or suggestion, please answer this post
Thanks to you
Rui Loureiro
EDIT: Copy this 20*20 matrix 'a' and paste it into the edit box and PRESS ENTER
Then, try b=a*a; c=b*b; d=c*c; .... etc
a=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20;
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20;
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20;
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20;
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20;
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20;
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20;
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20;
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20;
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20;
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20;
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20;
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20;
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20;
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20;
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20;
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20;
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20;
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20;
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20];
Hi all,
News
The previous calcula42 doest solve systems of
linear equations because when it tries to solve
a matrix operation if it is not a matrix operation
calcula42 exits and doesnt go on.
Sorry.
**** Here is calcula43 v1.03 ****
1. Expressions
. We can type an expression with 2200 characters;
. We can use a text editor/text processor to write an expression,
or matrix, etc. and then we can copy it and paste it into
the calculator input edit box.
2. Matrix definitions
. We can define up to a 20x20 matrix;
. Now we can define a matrix a
column 1 column 2 column 3
line 1: 1 , 2 , 3 -> 1 2 3
line 2: 4 , 5 , 6 -> 4 5 6
line 3: 7 , 8 , 9 -> 7 8 9
. type
a=[1,2,3 ; 4,5,6 ; 7,8,9 ]; [ENTER/COMPUTE]
3. How to see a matrix definition or result
. press DELETE key to clear the input edit box;
. type the matrix name and press ENTER key.
4. Matrix operations
. Addiction
array1=[1, 2; 3, 4]; [ENTER/COMPUTE]
array2=[5, 6; 7, 8]; [ENTER/COMPUTE]
a=array1+array2; [ENTER/COMPUTE]
. Subtraction
array1=[1, 2; 3, 4]; [ENTER/COMPUTE]
array2=[5, 6; 7, 8]; [ENTER/COMPUTE]
b=array1-array2; [ENTER/COMPUTE]
. Multiplication
array1=[1, 2; 3, 4]; [ENTER/COMPUTE]
array2=[5, 6; 7, 8]; [ENTER/COMPUTE]
c=array1*array2; [ENTER/COMPUTE]
. Scalar multiplication
array1=[1, 2; 3, 4]; [ENTER/COMPUTE]
d=10 * array1; [ENTER/COMPUTE]
f=+ array1; [ENTER/COMPUTE]
g=- array1; [ENTER/COMPUTE]
. Transpose matrix
array1=[1, 2; 3, 4]; [ENTER/COMPUTE]
b=array1^t; [ENTER/COMPUTE]
or
b=array1^T; [ENTER/COMPUTE]
we get b=[ 1.0, 3.0; 2.0, 4.0];
. Inverse matrix
array1=[1, 2; 3, 4]; [ENTER/COMPUTE]
b=array1^-1; [ENTER/COMPUTE]
we get b=[-2.0, 1.0; 1.5,-0.5];
5. About matrix inversion
. The calculator uses the Gauss-Jordan
elimination method.
. At the end we test the matrix to find
the identity matrix at the left.
6. Examples
example I: 2*2 matrix
c=[1,2; 2,1];
1. copy this matrix 'c' and paste it into input edit box
2. press ENTER/COMPUTE key
3. press DELETE key
4. type d=c^-1; [ENTER/COMPUTE]
example II: 3*3 matrix
f=[2,1,0; 0,2,1; 1,0,2];
1. copy this matrix 'f' and paste it into input edit box
2. press ENTER/COMPUTE key
3. press DELETE key
4. type g=f^-1; [ENTER/COMPUTE]
example III: 20*20 matrix
a=[1,2,3,4,5,6,7,1,0,10,11,12,13,14,15,16,7,8,19,4;
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,1,20;
1,2,3,4,5,6,7,8,9,10,11,0,13,14,0,16,17,18,19,20;
1,2,1,0,0,6,7,8,9,10,0,12,13,14,15,16,17,18,19,2;
1,2,3,4,5,6,7,8,9,0,11,12,13,4,15,0,17,18,19,1;
1,2,3,4,5,6,7,8,9,10,11,2,13,14,15,16,17,3,19,20;
20,9,18,17,16,5,14,13,12,11,10,9,8,7,6,5,4,3,2,1;
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20;
1,0,3,4,5,6,7,8,9,1,1,12,13,14,5,16,17,18,19,20;
1,2,0,4,5,0,1,8,9,10,11,12,13,14,15,16,17,18,19,20;
20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1;
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,1,19,1;
1,2,3,4,5,6,7,8,9,10,11,0,13,14,15,16,17,18,19,20;
1,2,3,4,5,6,7,8,9,10,1,12,13,14,15,6,17,18,19,20;
1,0,0,4,5,6,7,8,9,10,11,12,13,14,15,16,0,18,19,20;
1,2,3,4,5,6,7,0,9,0,11,0,13,14,15,16,17,18,19,0;
1,2,3,4,5,6,1,8,9,10,11,12,13,14,15,16,17,2,19,0;
1,2,1,0,5,6,7,8,9,10,11,12,13,14,15,16,17,18,0,20;
1,1,3,4,0,6,7,0,9,10,11,0,13,14,15,16,7,18,9,20;
1,2,3,4,5,6,7,8,9,10,0,12,13,14,15,16,17,0,19,2];
1. copy this matrix 'a' and paste it into input edit box
2. press ENTER/COMPUTE key
3. press DELETE key
4. type b=a^-1; [ENTER/COMPUTE]
5. press DELETE key
6. round(b,3) [ENTER/COMPUTE]
7. b [ENTER/COMPUTE]
Try it and say something.
Good luck !
7. What else ?
. Determinant of any matrix up to 20x20 ?
. Linear transformations ?
. Printing on the paper ?
8. Bugs, Ideas, Suggestions
Please, answer this post and say what you want
Thanks
Rui Loureiro
Hi all,
News
In the previous calcula43, if a number is very small
it shows something like +/-0.0000000000 instead of
the number in scientific notation
Sorry.
**** Here is calcula44 v1.04 ****
1. Expressions
. We can type an expression with 2200 characters;
. We can use a text editor/text processor to write an expression,
or matrix, etc. and then we can copy it and paste it into
the calculator input edit box.
2. Printing on the paper
. Printing an expression and results;
a) turn on the printer
b) type print() [press ENTER/COMPUTE]
. Printing a matrix;
a) turn on the printer
b) type print(a) [press ENTER/COMPUTE]
where a is a matrix name
3. Matrix definitions
. We can define up to a 20x20 matrix;
. Now we can define a matrix a
column 1 column 2 column 3
line 1: 1 , 2 , 3 -> 1 2 3
line 2: 4 , 5 , 6 -> 4 5 6
line 3: 7 , 8 , 9 -> 7 8 9
. type
a=[1,2,3 ; 4,5,6 ; 7,8,9 ]; [press ENTER/COMPUTE]
4. How to see a matrix definition or result
. press DELETE key to clear the input edit box;
. type the matrix name and press ENTER key.
5. Matrix operations
. Copy
a=[1, 2; 3, 4]; [press ENTER/COMPUTE]
b=a; [press ENTER/COMPUTE]
Now we have a, b and a equal b
. Addiction
array1=[1, 2; 3, 4]; [press ENTER/COMPUTE]
array2=[5, 6; 7, 8]; [press ENTER/COMPUTE]
a=array1+array2; [press ENTER/COMPUTE]
. Subtraction
array1=[1, 2; 3, 4]; [press ENTER/COMPUTE]
array2=[5, 6; 7, 8]; [press ENTER/COMPUTE]
b=array1-array2; [press ENTER/COMPUTE]
. Multiplication
array1=[1, 2; 3, 4]; [press ENTER/COMPUTE]
array2=[5, 6; 7, 8]; [press ENTER/COMPUTE]
c=array1*array2; [press ENTER/COMPUTE]
. Scalar multiplication
array1=[1, 2; 3, 4]; [press ENTER/COMPUTE]
d=10 * array1; [press ENTER/COMPUTE]
f=+ array1; [press ENTER/COMPUTE]
g=- array1; [press ENTER/COMPUTE]
. Transpose matrix
array1=[1, 2; 3, 4]; [press ENTER/COMPUTE]
b=array1^t; [press ENTER/COMPUTE]
or
b=array1^T; [press ENTER/COMPUTE]
we get b=[ 1.0, 3.0; 2.0, 4.0];
. Inverse matrix
array1=[1, 2; 3, 4]; [press ENTER/COMPUTE]
b=array1^-1; [press ENTER/COMPUTE]
we get b=[-2.0, 1.0; 1.5,-0.5];
. Determinant of a squared matrix
. type
delta(a) [press ENTER/COMPUTE]
where a is a matrix name
6. About matrix inversion
. The calculator uses the Gauss-Jordan
elimination method.
. When we want to invert a matrix A,
we start with a matrix
W = AI where I is the identity matrix
and we finish with
W = IB where I is the identity matrix
and B=A^-1
. At the end we test the matrix to find
the identity matrix I at the left.
If all elements of main diagonal is 1.0
(we use fld1 and fcomip to test )
and all other elements are +0.0 (we use ftst to test)
we give the message "The identity matrix is correct"
So, it means that we get the correct identity matrix and
B is the correct inverted matrix.
If that test fails, we start to test against an error of 1e-15
If it doesnt fail, we get a message
"Errors in the identity matrix are below 1e-15"
7. How we get the determinant
. I tried some methods without success (error problems)
. The calculator uses the Gauss-Jordan
elimination method to get a triangular matrix
. When we get the triangular matrix, the determinant
is the product of the main diagonal elements
. At the end, we test the triangular matrix.
If all elements below the main diagonal are
0.0 (we use ftst to test), we get the message
"The triangular matrix is correct"
If that test fails, we start to test against an error of 1e-15
If it doesnt fail, we get a message
"Errors in the triangular matrix are below 1e-15"
8. Examples
example I: 4*4 matrix
a=[2,1,3,4;-1,0,2,5;-5,2,0,1;3,-2,1,0];
1. copy this matrix 'a' and paste it into input edit box
2. press ENTER/COMPUTE key
3. press DELETE key
4. type:
b=a^-1; [press ENTER/COMPUTE]
we get "The identity matrix is correct"
5. press DELETE key
6. type:
delta(a) [press ENTER/COMPUTE]
we get "The triangular matrix is correct"
60.0
7. type:
delta(b) [press ENTER/COMPUTE]
we get "The triangular matrix is correct"
0.016666666666667 = 1 / 60
We have: delta(a) = 1/delta(b)
example II: 6*6 matrix
d=[-1,0,2,5,0,3 ; 2,1,3,4,4,-1;-5,2,0,1,2,-3;3,-2,1,0,0,-5;
2,0,-1,2,0,0 ; 0,1,-2,4,-2,5];
1. copy this matrix 'd' and paste it into input edit box
2. press ENTER/COMPUTE key
3. press DELETE key
4. type:
f=d^-1; [press ENTER/COMPUTE]
we get "The identity matrix is correct"
5. press DELETE key
6. type:
delta(d) [press ENTER/COMPUTE]
we get "The triangular matrix is correct"
1068.0
7. type:
delta(f) [press ENTER/COMPUTE]
we get "Errors in the triangular matrix are below 1e-15"
0.000936329588015 1 / 1068 = 0.000936329588015
We have: delta(d) = 1/delta(f)
example III: 20*20 matrix
g=[1.23,2,3,-4.45,5,6,7,-1.24,0,10,11,1.12,-13,14.11,15,-1.16,7,8,19,-4;
1,2.24,3,-4,5.23,6,7,8,9,-1.08,11,12,-13.23,14,15,16,-17,18.45,1,20;
1,0,3,4,5.23,-6,7,8,9,10,-2.11,0,-13.34,14,0,-16,17,18.58,19,-20;
1,2,1,0,0,6,7.25,8,9,10.12,0,12,13.45,14,15,16,17.21,18.29,-19.23,2;
-1,2.45,0,4,5,6,7.45,8,9,0,11,12,13,4,15,0,17.22,18.21,19,1;
1,2,3,4,5.24,6,0.27,8,9.89,10,11,2,-13,14,15,16,17,3,19,20;
20,9,18,17,16,5,14,13,12,11.38,10,9,8,7,6.34,5,4,3.25,2,-1;
1,2.23,-3,4,5,6,7,-1,9,10,11.45,12,13,14.89,15,-16,17,18,19,20;
1,0,3,-4,5,6,7.34,8.34,9,1,1,12.29,-13.59,14,5,16,17,18.34,19,20;
1,2,0,4,5,0,1,8,9,10,-11,12.24,13,14.22,15,16,17.45,18,19,20;
20,19.34,1.84,17,16,15,14.35,13,12.68,11,10,9,8.34,7,6.34,5,4,3,2,1;
1,2,3,4,5.24,6,7,8.24,9,10,11.23,12,13.34,14,15,-1,-17.23,1,19,1;
1,-2.81,1,4.23,5,6.21,7,8.89,9,10,11,0,13,14,15,16,17,18,19.23,20;
-1,2,3,4,5,-6.23,-7,8,9,10,1,12,13,-14,15.33,6,17,18,19,20;
1,0,0,4,5,6.34,7,8,9,10,-11.89,1.23,13,14.34,15.21,16.34,0,18,19,20;
1.34,2,3,4,5,6.23,7,0,9,0,11,0,1.35,14,15,16.62,17,18,1.92,0;
1,-2,3,4,5.45,6,1,-8,9,10,1.12,12,13,14,15,-16,17.43,2,19,0;
1,2,1,0,-1,6,7,8,9,10,11,-12.23,13,14,15,16,17,18,0,20.23;
-1.45,1,3,4.56,0,6,7,0,9,10,11,0,13.34,14,-15,16,7,18,9.34,20;
1,2,3,-4,5,6,7,8,9.45,10,0,12.48,13,14,-1.54,16.21,-17,0,19,-2];
1. copy this matrix 'g' and paste it into input edit box
2. press ENTER/COMPUTE key
3. press DELETE key
4. type:
h=g^-1; [press ENTER/COMPUTE]
we get "Errors in the identity matrix are below 1e-15"
5. press DELETE key
6. type:
delta(g) [press ENTER/COMPUTE]
we get "Errors in the triangular matrix are below 1e-15"
-7.447376674710765E+0024
note: ( 1 / -7.447376674710765E+0024 = -1.342 754 695 617 484E-0025 )
7. type:
delta(h) [press ENTER/COMPUTE]
we get "Errors in the triangular matrix are below 1e-15"
-1.342 754 695 617 483E-0025
We have: delta(g) = 1/delta(h)
Try it and say something.
Good luck !
9. Bugs, Ideas, Suggestions
Please, answer this post and say what you want
Thanks
Rui Loureiro
;-----------------------------
qWord,
Could you use matlab to test the 'g' matrix ?
Could you get the determinant ?
Thank you !
using Matlabl I get:
det(g) = -7.447376674710763e+24
The inverse matrix seems also to be OK, however Matlab does not throw any error or warning message. Also I must kill the process, because there are 10 or more MessageBoxes.
Furthermore I've notice that symbols can't be redefined/reassigned. A list of current used symbols ( and there types) may also be useful.
inv(g):
Quote-0,0194764047178232 -0,137529343707484 0,00664184403258896 -0,0466770285189683 -0,387830600915522 -0,369719656238606 -0,162003612438317 -0,239363754278609 0,461162916604339 0,0389888496340502 0,184416147133701 0,513492048598551 0,162594954508341 0,128183160627410 -0,187626213055776 0,130555890841760 0,120133761613197 0,0996834400087986 -0,00207882458072814 -0,283683164963308
0,0338757503050639 0,0307908169723230 -0,0131049060577130 -0,0189557979134671 0,123657211757843 0,0888491003658484 0,0396143933774663 0,0571098151078363 -0,119211249856332 0,0602372157946917 -0,0291528503378685 -0,116523190466297 -0,150885814633673 -0,0339061391738057 0,0213408630569653 -0,0277757894797561 -0,0447675134548215 0,0352510712394123 0,0155095174149840 0,0684309869166798
0,0407504417527469 0,0828043104939397 -0,0108989895895887 -0,0107508828337988 0,154485747905220 0,0612269934425821 0,0726555166182222 -0,0503788918289131 -0,112416943568594 0,0427736945682356 -0,0557073362393930 -0,124116319235111 -0,0736068284844610 -0,0441196264972331 0,0202621202785261 -0,108430919701350 0,0504706672158689 0,0348887292486163 0,0433017596859201 0,0191067947126154
-0,0160014456368300 -0,0583122633931931 -0,000245150377743491 0,0130417065207897 -0,0553767520888153 -0,0136397669952168 -0,0176342749602453 -0,0216486513118198 0,0603978249688051 -0,00729962719037065 0,0168857892974362 0,135670024353597 0,000477729357240619 0,0140460742453566 0,0214631885087231 0,0542987505570746 -0,0227825572769282 -0,0449167603256594 0,0295836222136839 -0,0987489568288384
0,0271020281719590 0,282880536237942 0,0135328429126729 0,00415221983983574 0,430719139931245 0,359939215120402 0,183827696098050 0,225590048367140 -0,606986470413938 0,0178947365594021 -0,155719591665051 -0,742847347145614 -0,000849408830059323 -0,164462041445187 0,129738412774925 -0,213216382509666 -0,0454910440457674 -0,116375588107095 -0,0367019745515544 0,382073451367929
0,0406672965812575 0,112459184955187 -0,00133940014474780 0,00230220364147551 0,128204035670201 -0,000782707944518249 -0,0291863468475866 -0,163122142367185 -0,0650807651529163 0,0189359859629477 0,0471145679059864 -0,0799515662363367 0,0489126036353878 -0,0382824895472141 0,00135284190669496 -0,159831355328483 0,140264654031926 0,0197283756702217 0,0610193169513212 -0,0496908920785074
-0,0353423915960246 -0,204162105999212 -0,0291269907867771 0,0471518597169099 -0,122576184747335 0,0347182955089128 0,0506427164414412 0,245225233008244 0,132367747010380 -0,158887345502103 -0,0699317362060476 0,100130063191450 -0,109458372473712 0,0414431042978009 0,122258803028231 0,200121481106603 -0,204845977430587 -0,0593263476409546 -0,0711874895766235 0,0606889503059700
0,00821004173819552 0,102872491976725 0,0198098793325462 0,000525225083319057 0,152071134928447 0,0606574303557477 0,0240225650407532 -0,0532260252132116 -0,127640028233868 0,0560347543465495 -0,0103062501369982 -0,133226595015913 0,0349022805811845 -0,0606803384303529 -0,0162079619837753 -0,151935096356134 0,0335546713471251 0,0179784558370869 0,0102084529073373 0,0293268545043555
-0,0858355045186968 -0,0897321939886219 0,0172834810751707 -0,00205747208794176 -0,150189197917182 -0,0434665134591687 -0,0418527717331502 0,0307397620679878 0,158875432364889 -0,102026923232176 0,0260250575638027 0,145865657590129 -0,0379516294716412 0,0741501406716714 0,0101683565335999 0,136611724720022 -0,00281380062517075 0,0316486579931679 -0,0362276012087261 -0,00602965093826850
0,0219199362610581 -0,0355421461541348 0,00447795555243166 0,0363006616168828 -0,0585763191032851 0,00540109426146538 -0,00881468033836793 0,0211626558986845 0,0128657833325574 -0,0437222836217285 0,00538955564598836 0,0275391187431766 0,00896959192904168 0,0335244477826635 0,0221701146692356 0,00826313399619753 -0,0205778302472412 -0,0246107574665545 0,00612433009016645 -0,000137178512111534
0,00237985198572083 0,00132718456273684 -0,000467914909551473 -0,00595938589105535 -0,0198256745669206 -0,0172632963226056 -0,0110805348965221 -0,00753675457553826 0,0112788026507257 0,00357220643963796 0,0101088339676132 0,0325007101357146 0,0337857277337978 0,00870117770287843 -0,0442872582514429 0,0118496339040749 -0,00121035784858669 0,00298059392878592 0,00514206646158695 -0,0117604669430790
-0,00218476357141255 -0,0414521771260898 -0,0102256917009856 0,0200552869446157 -0,0599771472102697 -0,0428425548458869 -0,0194757141709679 -0,00814612829040217 0,0856899324628138 0,00219107172878477 0,0154447423247160 0,100540088029310 0,00624771203890054 0,0240669337095780 -0,0263096584320902 0,0322998161624877 -0,00774763687089975 -0,0241211598832975 0,00413408595479445 -0,0437699304608693
0,00163650732928936 0,0302923882689646 -0,00516914985774161 -0,00877639553171385 0,0546628475003090 0,0100392640450640 0,0168636839925183 0,00248003373301407 -0,0620212708317323 0,0289618380824108 -0,0124693334681926 -0,0634522618629034 0,00650336884849640 -0,0212134126868809 -0,00778253189803472 -0,0330541185074735 0,0120026552506788 0,0123474580353687 0,00167771423553053 0,0348493284715499
0,00885172528268708 0,0701926527137210 0,0104120426901771 -0,0163217348716093 0,0654407623177042 0,0250886554526726 0,0123720539081882 -0,0246701977708787 -0,0854766821275699 0,0829741124572558 -0,00892413114144867 -0,0717003220935649 0,0120858610107890 -0,0579354421056124 -0,0360206261504336 -0,0605714096763533 0,0328976355657030 0,0152635872500416 0,0151168318757311 0,0160193538394152
-0,000106838695318115 -0,0398821822574248 -0,00953732411510184 0,00472252276702084 -0,0490599643454039 -0,0215277319228146 -0,00893127910279693 0,00818657334555172 0,0527236643816077 -0,0148287336385422 0,00176077842794454 0,0764343745058907 -0,0144116187067952 0,0224537393919841 0,00952921234752537 0,0505597592271974 -0,0154526717457820 0,00730486452486700 -0,0245305773036044 -0,0296451638018044
-0,00301617294291907 -0,0508478548421629 -0,0103510287316471 0,00522624689779239 -0,0677868573982759 -0,0274675124225435 -0,0168363055181322 -0,00183172183383561 0,0639283269714506 -0,0101187853656825 0,0106151079712938 0,0732236834364465 0,00867126176131774 0,0264172717123994 -0,00565722594544586 0,0671329056156512 -0,0265630991751720 -0,0128751385105936 -0,00473094292145426 -0,0153908550303233
-1,41771345723608e-06 -0,00777055427056557 -0,00276878867253268 0,00691827592778792 0,0276526110457986 0,0287599385249704 0,0147713522029517 0,0239237788264728 -0,0178175909016705 0,00128109772746900 -0,0136798754624504 -0,0445040079494080 -0,00815800649663193 -0,0110152529106634 0,00139188031853718 -0,00556122115307750 -0,00986894150119833 -0,00226206188711953 -0,00723897709646967 0,0226400670217924
0,0234932485903318 0,0476237786415082 0,0151286447275387 -0,0107669125486579 0,00145284995413316 -0,0679484338395709 -0,0319610821854304 -0,0919730220617370 0,0120935388306771 0,0370485943403460 0,0365978182829969 0,0264952383417367 0,0419875334814127 0,00989649010318327 -0,0316948810521638 -0,0369853266571003 0,0577971861639099 0,0170521075590771 0,0356027131815505 -0,0619411784104348
0,00401844418179543 -0,0472658910462619 -0,00197409073165974 -0,0217206372516133 -0,0613302964555191 -0,0621687812569254 -0,0316764444399514 -0,0412921385240117 0,0980537205971524 0,00681683251542359 0,0274345812855831 0,115305931692271 0,00804300263074198 0,0275318850786049 -0,0221161385335807 0,0357229116275633 0,00956321871506687 0,0172514063802433 0,00499197968057683 -0,0530306008641024
-0,00701831483819808 0,00786195332936113 -0,0107729833979132 -0,000885462353389252 0,0201914610973340 0,0388066895013467 0,0250126109474898 0,0520282579996586 -0,0292851120148883 -0,00660011606973864 -0,0238598162853767 -0,0484629962957876 -0,0213206700245884 -0,0110299994151064 0,0233424206394418 -0,0122674387592062 -0,0239930871001743 -0,00401101555033400 -0,00529862599817829 0,0267855772679325
Will you ever share the source code?
regards, qWord
qWord,
First of all, many thanks to you
Quote
The inverse matrix seems also to be OK,
I read it and all numbers seems to be 'equal' with 15 digits
Very good !
Quote
however Matlab does not throw any error or warning message.
It was my particular decision to show what happened inside
the Gauss-Jordan elimination method. I want to show it.
I can tell you that after testing i tried to eliminate that
errors using linear transformations, but without any success!
Simply, i couldnt remove that errors. Well, i can remove
moving a 0.0 to it or 1.0 to it but it is not correct !
Quote
Also I must kill the process, because there are 10 or more MessageBoxes.
The problem is solved: the messages are in the output edit boxes
Quote
det(g) and inv(g)
Ok, i decided to use this names too:
determinant of a: det(a) or delta(a)
inverse of a: b=inv(a) or b=a^-1;
Quote
Furthermore I've notice that symbols can't be redefined/reassigned.
Names of variables or constants can be redefined.
In the case of matrix names we can't.
We need to use a new name. But i can change it.
Whenever we define a matrix by operation or not
the calculator allocate a space for a 20*20 matrix.
It may be a 2*1 matrix but the space is for 20*20.
So, there isnt any problem in redefine it.
Do you think we should redefine it ? I dont know
if it is better !
Quote
A list of current used symbols ( and there types) may also be useful.
This seems to be a good suggestion and may be useful.
How to ask for that list ?
Typing: symb; or symb() ?
or list; or list() ?
Quote
Will you ever share the source code?
I didnt decide anything about it till now.
I wrote 8 files with procedures, the first
has 10020 lines.
For matrices i have one with 3700 lines.
It is not easy to read it because the
procedures are not documented. More: i
use the registers as variables instead of
global/local variables in many cases.
I dont like local variables because i
use OPTION PROLOGUE:NONE,OPTION EPILOGUE:NONE.
Ok, in some cases it is easy to understand.
For instance, a matrix 10*20 is defined as
dd 20 <- number of columns
dd 10 <- number of lines
_matrixX db 200*10 dup(?)
The address of _matrixX gives me 3 things:
number of lines, number of columns, and the
elements. We dont need to pass more than
the address.
All strings have the lenght behind.
My procedures exits with clc or stc.
Generally, stc means error or errors. If
errors i put the code in eax.
As you are 'seeing' i have my own rules!
Ok, do you want to see some code ?
regards,
Rui Loureiro
Hi all,
News
In the previous calcula44, the log function
doesnt work. We have problems when we try
to close a MessageBox with ENTER.
This problems are corrected.
Now, i tested
. all functions
. systems of 2,3,4 linear equations
. quadratic equation
. linear interpolation
. constant definition
. function definition
. derivative definition
. function root and Newton method
. matrix definitions
. matrix operations
. print function
**** Here is calcula45 v1.05 ****
1. List of symbols used in the calculator
Type list
and press ENTER/COMPUTE
Define the constants: t=12;s=25.3;
and press ENTER/COMPUTE
Define the matrix: a=[1, 2; 3, 4];
and press ENTER/COMPUTE
Now, type list
and press ENTER/COMPUTE
The new symbols are in the list
2. Inverse matrix
Given a matrix a
to get the inverse matrix b
we can use:
a) b=a^-1;
b) b=inv(a);
3. Determinant
Given a squared matrix a
to get the determinant
we can use:
a) delta(a)
b) det(a)
4. Conversion: conv() function
To convert from decimal:
type conv(decimal_number)
and press ENTER/COMPUTE
To convert from hexadecimal:
type conv(hexadecimal_number)
and press ENTER/COMPUTE
or
type hexadecimal_number
and press ENTER/COMPUTE
To convert from binary:
type conv(binary_number)
and press ENTER/COMPUTE
type binary_number
and press ENTER/COMPUTE
5. Examples
example I
type:
conv(1010b)
or
1010b
and press ENTER/COMPUTE
we get:
10
0000000AH
00000000000000000000000000001010B
example II
type:
conv(000000000ABCDEFFFFFFFFFF1h)
or
000000000ABCDEFFFFFFFFFF1h
and press ENTER/COMPUTE
we get:
12379814833502027761
ABCDEFFFFFFFFFF1h
10101011110011011110111111111111
11111111111111111111111111110001B
example III
type:
conv(11111111111111111111111111111111 11111111111111111111111111111111b)
or
11111111111111111111111111111111 11111111111111111111111111111111b
and press ENTER/COMPUTE
we get:
18446744073709551615
FFFFFFFFFFFFFFFFH
11111111111111111111111111111111
11111111111111111111111111111111B
example IV
type:
conv(0000018446744073709551615)
and press ENTER/COMPUTE
we get:
18446744073709551615
FFFFFFFFFFFFFFFFH
11111111111111111111111111111111
11111111111111111111111111111111B
Try it and say something.
Good luck !
6. Suggestions
I am waiting for suggestions
Thanks
Rui Loureiro
:U
Hi Dave :U
Hi all,
4 things:
1. calcula45 doesnt solve expressions
like e^-(...) and xEy^n; The 2nd
is because it is scientific notation!
2. i found a bug: one variable used
inside and out a proc, when it
should be used only inside one.
All my procs and variables are
independent, but that fails
the rule. And it has something to
do with functions.
3. now, we can round an expression;
4. expressions with 3800 characters
200 operations inside brackets.
What else ?
improvement and ... improvement.
**** Here is calcula46 v1.06 ****
Examples:
1) round(e^-(-3+sin(3*5+12)),6)+34*5-sin(pi/3)
2)
1. copy this expression and paste it into input edit box
2. press ENTER/COMPUTE key
round(e^-(3*4*5*120+90*456*5*2)+34-456*sin(5*2+34*456*5*2+34*456*5*2+34*456*5*2+34-456*5*2+345
*456*5*2+3409*456*5*2+34*456*5*2+34*456*5*2+34*456*5*2+34*456*5*2+34*456*5*2+348
*456*5*2+34/456*5*2+34+3+12-24+12*12*30/3*4*5*120+90*456*5*2+34*456*5*2+34*456
*5*2+34*456^2*5*2+34*456*5*2+34+456*5*2-34*456*5*2+3409*456*5*2+34*456*5*2+34*456
*5*2-34*456*5*2^4+34*456*5*2+34*456*5*2+34*456*5*2+34*456*5*2+34+3+12+24+12*12*30
+12*12-23-23-45-24*56*20*10+12+12*12-23-23-45-24*56*20*10+12+12*12-23-23-45-24
*56*20*10+12+12*12-23-23-45-24*56*20*10+12+12*12-23-23-45-24*56*20*10+12+12*12
-23-23-45-24*56*20*10)*(2^10+56.3*5)+(2^10+56.3*5)*(2^10+56.3*5)-(2^10+56.3*5)*
(2^10+56.3*5+2.45)-(2^10+56.3*5)*(2^10+56.3*5)*(2^10+56.3*5)+(2^10+56.3*5)*(2^10+56.3*5)
*(2^10+56.3*5)-2*(3*4*5*120+90*456*5*2+34-456*5*2+34*456*5*2+34*456*5*2+34*456*5*2
+34-456*5*2+345*456*5*2+3409*456*5*2+34*456*5*2+34*456*5*2+34*456*5*2+34*456*5*2+
34*456*5*2+348*456*5*2+34/456*5*2+34+3+12-24+12*12*30/3*4*5*120+90*456*5*2+34*456*5*2+34*456
*5*2+34*456^2*5*2+34*456*5*2+34+456*5*2-34*456*5*2+3409*456*5*2+34*456*5*2+34*456
*5*2-34*456*5*2^4+34*456*5*2+34*456*5*2+34*456*5*2+34*456*5*2+34+3+12+24+12*12*30
+12*12-23-23-45-24*56*20*10+12+12*12-23-23-45-24*56*20*10+12+12*12-23-23-45-24
*56*20*10+12+12*12-23-23-45-24*56*20*10+12+12*12-23-23-45-24*56*20*10+12+12*12
-23-23-45-24*56*20*10)
-sin(3*4*5*120+90*456^-1*5*2+34-456*5*2+34*456*5*2+34*456*5*2+34*
456*5*2+34-456*5*2+345*456*5*2+3409*456*5*2+34*456*5*2+34*456*5*2+34*456*5*2+34*
456*5*2+34*456*5*2+348*456*5*2+34/456*5*2+34+3+12-24+12*12*30/3*4*5*120+90*456*5*
2+34*456*5*2+34*456*5*2+34*456^2*5*2+34*456*5*2+34+456*5*2-34*456*5*2+3409*456*5*2+
34*456*5*2+34*456*5*2-34*456*5*2^4+34*456*5*2+34*456*5*2+34*456*5*2+34*456*5*2+34+3+
12+24+12*12*30+12*12-23-23-45-24*56*20*10+12+12*12-23-23-45-24*56*20*10+12+12*12-23-
23-45-24*56*20*10+12+12*12-23-23/45-24*56*20*10+12+12*12-23-23-45-24*56*20*10+12+12*12
-23-23-45-24*56*20*10)
+cos(3*4*5*120+90*456^-1*5*2+34-456*5*2+34*456*5*2+34*456*5*2+34*
456*5*2+34-456*5*2+345*456*5*2+3409*456*5*2+34*456*5*2+34*456*5*2+34*456*5*2+34*
456*5*2+34*456*5*2+348*456*5*2+34/456*5*2+34+3+12-24+12*12*30/3*4*5*120+90*456*5*
2+34*456*5*2+34*456*5*2+34*456^2*5*2+34*456*5*2+34+456*5*2-34*456*5*2+3409*456*5*2+
34*456*5*2+34*456*5*2-34*456*5*2^4+34*456*5*2+34*456*5*2+34*456*5*2+34*456*5*2+34+3+
12+24+12*12*30+12*12-23-23-45-24*56*20*10+12+12*12-23-23-45-24*56*20*10+12+12*12-23-
23-45-24*56*20*10+12+12*12-23-23/45-24*56*20*10+12+12*12-23-23-45-24*56*20*10+12+12*12
-23-23-45-24*56*20*10)
+(3*4*5*120+90*456^-1*5*2+34-456*5*2+34*456*5*2+34*456*5*2+34*
456*5*2+34-456*5*2+345*456*5*2+3409*456*5*2+34*456*5*2+34*456*5*2+34*456*5*2+34*
456*5*2+34*456*5*2+348*456*5*2+34/456*5*2+34+3+12-24+12*12*30/3*4*5*120+90*456*5*
2+34*456*5*2+34*456*5*2+34*456^2*5*2+34*456*5*2+34+456*5*2-34*456*5*2+3409*456*5*2+
34*456*5*2+34*456*5*2-34*456*5*2^4+34*456*5*2+34*456*5*2+34*456*5*2+34*456*5*2+34+3+
12+24+12*12*30+12*12-23-23-45-24*56*20*10+12+12*12-23-23-45-24*56*20*10+12+12*12-23-
23-45-24*56*20*10+12+12*12-23-23/45-24*56*20*10+12+12*12-23-23-45-24*56*20*10+12+12*12
-23-23-45-24*56*20*10)
-log(3*4*5*120+90*456*5*2+34-456*5*2+34*456*5*2+34*456*5*2+34*
456*5*2+34-456*5*2+345*456*5*2+3409*456*5*2+34*456*5*2+34*456*5*2+34*456*5*2+34*
456*5*2+34*456^-1*5*2+348*456*5*2+34/456*5*2+34+3+12-24+12*12*30/3*4*5*120+90*456*5*
2+34*456*5*2+34*456*5*2+34*456^2*5*2+34*456*5*2+34+456*5*2-34*456*5*2+3409*456*5*2+
34*456*5*2+34*456*5*2-34*456*5*2^4+34*456*5*2+34*456*5*2+34*456*5*2+34*456*5*2+34+3+
12+24+12*12*30+12*12-23-23-45-24*56*20*10+12+12*12-23-23-45-24*56*20*10+12+12*12-23-
23-45-24*56*20*10+12+12*12-23-23/45-24*56*20*10+12+12*12-23-23-45-24*56*20*10+12+12*12
-23-23-45-24*56*20*10),3)
= -109648054.196
qWord and Dave,
Do you Know how to test the result of that expression ?
Thanks
here is what i come up with, Rui
7.71853 + 170 - 0.86602540378443864676372317075294 = 176.85250459621556135323627682925
i may have made a mistake - lol
Dave,
i want to test the second not the first
The first give me 176.8525055962156 too
oh, sure - you give ME the hard one :eek
:lol
:bg
Dave,
may be hutch could help us :green2
if i remember, i'll try it out later today, Rui :U
:bg
Dave,
I did my homework as ever :green2
Solving by parts (using the calculator) i get this:
A
e^-(3*4*5*120+90*456*5*2)+34-456*
sin(5*2+34*456*5*2+34*456*5*2+34*456*5*2+34-456*5*2+345
*456*5*2+3409*456*5*2+34*456*5*2+34*456*5*2+34*456*5*2+34*456*5*2+34*456*5*2+348
*456*5*2+34/456*5*2+34+3+12-24+12*12*30/3*4*5*120+90*456*5*2+34*456*5*2+34*456
*5*2+34*456^2*5*2+34*456*5*2+34+456*5*2-34*456*5*2+3409*456*5*2+34*456*5*2+34*456
*5*2-34*456*5*2^4+34*456*5*2+34*456*5*2+34*456*5*2+34*456*5*2+34+3+12+24+12*12*30
+12*12-23-23-45-24*56*20*10+12+12*12-23-23-45-24*56*20*10+12+12*12-23-23-45-24
*56*20*10+12+12*12-23-23-45-24*56*20*10+12+12*12-23-23-45-24*56*20*10+12+12*12
-23-23-45-24*56*20*10)*(2^10+56.3*5)
= -374 258.1604136189
------------------------------------------------------------------------------------
B
+(2^10+56.3*5)*(2^10+56.3*5)-(2^10+56.3*5)*
(2^10+56.3*5+2.45)-(2^10+56.3*5)*(2^10+56.3*5)*(2^10+56.3*5)+(2^10+56.3*5)*(2^10+56.3*5)
*(2^10+56.3*5)-2*(3*4*5*120+90*456*5*2+34-456*5*2+34*456*5*2+34*456*5*2+34*456*5*2
+34-456*5*2+345*456*5*2+3409*456*5*2+34*456*5*2+34*456*5*2+34*456*5*2+34*456*5*2+
34*456*5*2+348*456*5*2+34/456*5*2+34+3+12-24+12*12*30/3*4*5*120+90*456*5*2+34*456*5*2+34*456
*5*2+34*456^2*5*2+34*456*5*2+34+456*5*2-34*456*5*2+3409*456*5*2+34*456*5*2+34*456
*5*2-34*456*5*2^4+34*456*5*2+34*456*5*2+34*456*5*2+34*456*5*2+34+3+12+24+12*12*30
+12*12-23-23-45-24*56*20*10+12+12*12-23-23-45-24*56*20*10+12+12*12-23-23-45-24
*56*20*10+12+12*12-23-23-45-24*56*20*10+12+12*12-23-23-45-24*56*20*10+12+12*12
-23-23-45-24*56*20*10)
= -217 723 715.9662281
--------------------------------------------------------------------------------------
Total A + B
= -374 258.1604136189 -217 723 715.9662281
= -218 097 974.1266417
--------------------------------------------------------------------------------------
C
-sin(3*4*5*120+90*456^-1*5*2+34-456*5*2+34*456*5*2+34*456*5*2+34*
456*5*2+34-456*5*2+345*456*5*2+3409*456*5*2+34*456*5*2+34*456*5*2+34*456*5*2+34*
456*5*2+34*456*5*2+348*456*5*2+34/456*5*2+34+3+12-24+12*12*30/3*4*5*120+90*456*5*
2+34*456*5*2+34*456*5*2+34*456^2*5*2+34*456*5*2+34+456*5*2-34*456*5*2+3409*456*5*2+
34*456*5*2+34*456*5*2-34*456*5*2^4+34*456*5*2+34*456*5*2+34*456*5*2+34*456*5*2+34+3+
12+24+12*12*30+12*12-23-23-45-24*56*20*10+12+12*12-23-23-45-24*56*20*10+12+12*12-23-
23-45-24*56*20*10+12+12*12-23-23/45-24*56*20*10+12+12*12-23-23-45-24*56*20*10+12+12*12
-23-23-45-24*56*20*10)
= -0.817405354401868
--------------------------------------------------------------------------------------
D
+cos(3*4*5*120+90*456^-1*5*2+34-456*5*2+34*456*5*2+34*456*5*2+34*
456*5*2+34-456*5*2+345*456*5*2+3409*456*5*2+34*456*5*2+34*456*5*2+34*456*5*2+34*
456*5*2+34*456*5*2+348*456*5*2+34/456*5*2+34+3+12-24+12*12*30/3*4*5*120+90*456*5*
2+34*456*5*2+34*456*5*2+34*456^2*5*2+34*456*5*2+34+456*5*2-34*456*5*2+3409*456*5*2+
34*456*5*2+34*456*5*2-34*456*5*2^4+34*456*5*2+34*456*5*2+34*456*5*2+34*456*5*2+34+3+
12+24+12*12*30+12*12-23-23-45-24*56*20*10+12+12*12-23-23-45-24*56*20*10+12+12*12-23-
23-45-24*56*20*10+12+12*12-23-23/45-24*56*20*10+12+12*12-23-23-45-24*56*20*10+12+12*12
-23-23-45-24*56*20*10)
= 0.576062918955175
--------------------------------------------------------------------------------------
Total A + B + C + D
= -218 097 974.1266417 -0.817405354401868 + 0.576062918955175
= -218 097 974.3679841
--------------------------------------------------------------------------------------
E
+(3*4*5*120+90*456^-1*5*2+34-456*5*2+34*456*5*2+34*456*5*2+34*
456*5*2+34-456*5*2+345*456*5*2+3409*456*5*2+34*456*5*2+34*456*5*2+34*456*5*2+34*
456*5*2+34*456*5*2+348*456*5*2+34/456*5*2+34+3+12-24+12*12*30/3*4*5*120+90*456*5*
2+34*456*5*2+34*456*5*2+34*456^2*5*2+34*456*5*2+34+456*5*2-34*456*5*2+3409*456*5*2+
34*456*5*2+34*456*5*2-34*456*5*2^4+34*456*5*2+34*456*5*2+34*456*5*2+34*456*5*2+34+3+
12+24+12*12*30+12*12-23-23-45-24*56*20*10+12+12*12-23-23-45-24*56*20*10+12+12*12-23-
23-45-24*56*20*10+12+12*12-23-23/45-24*56*20*10+12+12*12-23-23-45-24*56*20*10+12+12*12
-23-23-45-24*56*20*10)
= 108 449 928.2081871
--------------------------------------------------------------------------------------
Total A + B + C + D + E
= -218 097 974.3679841 + 108 449 928.2081871
= -109 648 046.159797
--------------------------------------------------------------------------------------
F
-log(3*4*5*120+90*456*5*2+34-456*5*2+34*456*5*2+34*456*5*2+34*
456*5*2+34-456*5*2+345*456*5*2+3409*456*5*2+34*456*5*2+34*456*5*2+34*456*5*2+34*
456*5*2+34*456^-1*5*2+348*456*5*2+34/456*5*2+34+3+12-24+12*12*30/3*4*5*120+90*456*5*
2+34*456*5*2+34*456*5*2+34*456^2*5*2+34*456*5*2+34+456*5*2-34*456*5*2+3409*456*5*2+
34*456*5*2+34*456*5*2-34*456*5*2^4+34*456*5*2+34*456*5*2+34*456*5*2+34*456*5*2+34+3+
12+24+12*12*30+12*12-23-23-45-24*56*20*10+12+12*12-23-23-45-24*56*20*10+12+12*12-23-
23-45-24*56*20*10+12+12*12-23-23/45-24*56*20*10+12+12*12-23-23-45-24*56*20*10+12+12*12
-23-23-45-24*56*20*10)
= -8.036250666905551
;************************************************************************************
Total A + B + C + D + E + F
= -109 648 046.159797 -8.036250666905551
= -109 648 054.1960477
; ««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
Total result computing all expression = -109 648 054.1960477
; ««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««
Conclusion: we get the same result exactly
Quote from: dedndave on May 15, 2012, 07:00:23 PM
if i remember, i'll try it out later today, Rui :U
Did yoy try, Dave ?
i will give it a shot, Rui...
man - that is monotonous - lol
i just got through replacing 34*456*5*2 about 50 times
being careful not to hit the odd ones like 34*456*5*2^4
so - i forget what we decided
is 34*456*5*2^4 = 34*456*5*16 ???
or is 34*456*5*2^4 = (34*456*5*2)^4
also...
is 34*456^2*5*2 = 34*456^20 ?
or is 34*456^2*5*2 = 10*34*456^2 ?
Quote
man - that is monotonous - lol
Dave, In the next version we will go
to test more complex expressions
but not too large :green
Quote
so - i forget what we decided
is 34*456*5*2^4 = 34*456*5*16 ???
or is 34*456*5*2^4 = (34*456*5*2)^4
34*456*5*2^4:
first powers so 2^4=16
= 34*456*5* 16
Quote
also...
is 34*456^2*5*2 = 34*456^20 ?
or is 34*456^2*5*2 = 10*34*456^2 ?
34* 456^2 * 5*2:
first powers so 456^2=207936
= 34* 207936 *5*2
=340* 207936
=70698240
Quote from: RuiLoureiro on May 17, 2012, 10:25:27 AM
Dave, In the next version we will go
to test more complex expressions
but not too large :green
yah - this one is more of a test on my bad eye-sight - lol
it would make a great eye-chart for a driver's license exam :eek
"Look into the machine and read the first 50 lines (snicker)."
Hi all,
3 things:
1. calcula46 doesnt solve some expressions
and i want it should solve any expression
and i need to lose some time testing all
that cases and cleaning some code to
get the best code to do each task.
To do this work i have a separated file
with a lot of procedures to test and to
follow each calculation step. I lose
some time writing these particular procedures.
2. Now, calcula47 solves chains of powers
or exponentials and powers of rational
numbers
3. The bigest problem i had to solve till now
was exponentials or powers and chains of
powers. I remember that the arguments or
factors can be pi,+pi,-pi,e,+e,-e, scientific
notation, integers, any real number, expressions
inside brackets or functions or functions
inside functions
**** Here is calcula47 v1.07 ****
1. exponential or power of rational number
How to calculate (expression)^(N/K)
where N and K are integers ?
Now, when we type any expression inside
brackets followed by "^" and
followed by brackets, the calculator
try to decode the last as integers N
or N and K.
So, now we can solve (log(3)-1)^(1/3)
(=-0.805626350626199)
or (log(3)-1)^(-1/3) = -1.241270223128524
or (log(3)-1)^(1/-3) = -1.241270223128524
2. chains of exponentials or powers
How to calculate
real1^real2^real3^...^realN ?
where real1,real2,...,realN are any real number ?
Now, we can solve expressions like this:
Examples:
1) (-3.573718205179228E-0017)^(-3/5)= -7381214348.06242
2+(log(3)^2)^(6/3) = 2.051822105661585
2+(log(3)^2)^(1/3) = 2.610593967460875
(cos(pi/3)^2+sin(3*pi/2)^2)^(1/3) = 1.077217345015942
2*(log(2)-log(3)^2^3)^(1/3)+1 = 2.33639853443889
When the value is infinity it gives ERROR
2)
2^-2.21E-3^log(2)^+2e2^-pi = 0.998469317422371
2^-2.21E-3^log(2)^2e-2^-pi = 0.5
2^e^log(2)^-e^-pi = 7.295225269786005
2*(3-2^3^log(5*log(3)+1)^2^3^log(3)^2^3)^(1/2) / (log(2)+2^3^log(3)^2^3)
= 0.571196983587843
Try it and say something.
Good luck !
Thanks
Rui Loureiro
EDIT: note that, to solve 2^3^4^5, the calculator
starts by 4^5 = x, next 3^x=y, next 2^y.