The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: RuiLoureiro on March 24, 2012, 06:30:21 PM

Title: Solving real expressions
Post by: RuiLoureiro on March 24, 2012, 06:30:21 PM
Hi
        Now calcula23 use constants pi and e
        and it work with scientific format;

        It also solves equations ax^2+bx+c=c0
        where a,b,c are real constants in scientific format or not.
        It also gives the complex solutions if it is the case.

        If you want pi, type pi; if you want e, type e;

        I dont know any bug.
        If you know, please reply here and tell me

        Good luck ! :wink
        Thanks

EDIT: this calcula23 has some bugs. Please try the last calcula30
Title: Re: Solving real expressions
Post by: Adamanteus on March 25, 2012, 07:05:39 AM
Seem math mistakes there not much, but is  :naughty:
So 80-bit REAL format giving exactness more then 17 digital digits and 4096 exponent size, I seen only 15 and not seen exponent :
e^22 = 3584912846.131592 - I got - e^22 = 3584912846.131591
e^100 = unxpected value     - I got - e^100 = 2.688117141816135E43
Title: Re: Solving real expressions
Post by: jj2007 on March 25, 2012, 09:06:50 AM
It seems to be a printing problem, as e^100 yields various one-character outputs (@, d, ...).
Title: Re: Solving real expressions
Post by: RuiLoureiro on March 26, 2012, 02:39:35 PM
Adamanteus
            Thank you for help me  :wink
           
            The same for jj !  :thumbu

            Try calcula24 now
jj,
Quote
It seems to be a printing problem           

            Not only, but a converting problem also
            That is the problem of calcula23

            Now we have calcula24.
            The problem is solved
            Good luck !
            Thanks
Title: Re: Solving real expressions
Post by: Adamanteus on March 27, 2012, 07:10:37 AM
Very exact program, I found only small mistakes :
sin(pi) = - 0
differ results (but I don't know what exact) e^10000 = 8.806818225662921E4342 - I got - e^10000 = 8.8068182256629479E4342
Title: Re: Solving real expressions
Post by: RuiLoureiro on March 27, 2012, 01:35:35 PM
Adamanteus,
            Thank so much for your words
            If we try Ztest from raymond, we have 3 cases:

            my case   e^10000 = 8.806818225662921 E4342
            You got - e^10000 = 8.8068182256629479E4342 
            Ztest     - e^10000 = 8.806818225663056 E4342


Hi all,
        First, thank you so much to all people for trying calcula24
               and trying to help me;

        Please, if you see an error or bug, reply to
        this post; It is possible it needs some corrections.
        If i know i post it here.

        One word to Raymond: thank you so much for your lib and your help !

        Calcula24 has some minor problems with signs.
        I know also this problems with calcula24:

                1. sin(3.5*pi/2)^2+cos(3.5*pi/2)^2 must be 1
                2. -x^2+x+1=0   doesnt solve any -x^2... =0 or +x^2... =0
                   or 2x^2... =0
                   
        All this problems are solved.
        Now you can try Calcula25

        Calculation rules

            1. terms inside parentheses or brackets
            2. functions
            3. exponents or powers
            4. multiplication and division
            5. addition and subtraction

        a) All calculatios are made in 80 bit format
           e.g.: 2+3    both are taken as real10 numbers
           
        b) Exceptions: expressions X^Y. Y is taken as integer32
                       if possible;
                       
           e.g.: (-2)^(2+3*1/3-1) but not here (-2)^(2+3*1/3-1.0)
                 because one term is 1.0

        c) Expressions like this:  SIN(...)^Y, 10^(...)^Y, ...
                            means
                                  (SIN(...))^Y, (10^(...))^Y, ...
       
        Some results from calcula25:
       
Quote
...
Type an expression and press enter [ ex: -pi + 3.1*(7 - 2*8.3) ]
sin(3.5*pi/2)^2+cos(3.5*pi/2)^2
This is your expression: sin(3.5*pi/2)^2+cos(3.5*pi/2)^2
This is your Result:   1.000000000000000
sin(3.5*pi/2)^2+cos(3.5*pi/2)^2= 1.000000000000000
---------------------------------------------
Type an expression and press enter [ ex: -pi + 3.1*(7 - 2*8.3) ]
-x^2+x+1=0
This is your expression: -x^2+x+1=0
RootX0= -0.5000000000+ i  0.8660254038
RootX1= -0.5000000000- i  0.8660254038
---------------------------------------------
Type an expression and press enter [ ex: -pi + 3.1*(7 - 2*8.3) ]
ln(e)
This is your expression: ln(e)
This is your Result:   1.000000000000000
ln(e)= 1.000000000000000
---------------------------------------------
Type an expression and press enter [ ex: -pi + 3.1*(7 - 2*8.3) ]
ln(5000)
This is your expression: ln(5000)
This is your Result:   8.517193191416237
ln(5000)= 8.517193191416237
---------------------------------------------
Type an expression and press enter [ ex: -pi + 3.1*(7 - 2*8.3) ]
log(10e5)
This is your expression: log(10e5)
This is your Result:   6.000000000000000
log(10e5)= 6.000000000000000
---------------------------------------------
Type an expression and press enter [ ex: -pi + 3.1*(7 - 2*8.3) ]
e^750
This is your expression: e^750
This is your Result:   5.258494541454804E+0325
e^750= 5.258494541454804E+0325
---------------------------------------------
Type an expression and press enter [ ex: -pi + 3.1*(7 - 2*8.3) ]
e^-500
This is your expression: e^-500
This is your Result:   0.000000000000000
e^-500= 0.000000000000000
---------------------------------------------
Type an expression and press enter [ ex: -pi + 3.1*(7 - 2*8.3) ]
e^0
This is your expression: e^0
This is your Result:   1.000000000000000
e^0= 1.000000000000000
---------------------------------------------
Type an expression and press enter [ ex: -pi + 3.1*(7 - 2*8.3) ]
pi
This is your expression: pi
This is your Result:   3.141592653589793
pi= 3.141592653589793
---------------------------------------------
Type an expression and press enter [ ex: -pi + 3.1*(7 - 2*8.3) ]
e
This is your expression: e
This is your Result:   2.718281828459045
e= 2.718281828459045
---------------------------------------------
Type an expression and press enter [ ex: -pi + 3.1*(7 - 2*8.3) ]
Type an expression and press enter [ ex: -pi + 3.1*(7 - 2*8.3) ]
e^-5000
This is your expression: e^-5000
This is your Result:   0.000000000000000
e^-5000= 0.000000000000000
---------------------------------------------
Type an expression and press enter [ ex: -pi + 3.1*(7 - 2*8.3) ]
e^-50000
This is your expression: e^-50000
This is your Result:   0
e^-50000= 0
---------------------------------------------
Type an expression and press enter [ ex: -pi + 3.1*(7 - 2*8.3) ]
10^5000
This is your expression: 10^5000
This is your Result:  OVERFLOW
10^5000=OVERFLOW
---------------------------------------------
Type an expression and press enter [ ex: -pi + 3.1*(7 - 2*8.3) ]
pi^pi
This is your expression: pi^pi
This is your Result:   36.46215960720791
pi^pi= 36.46215960720791
---------------------------------------------
Type an expression and press enter [ ex: -pi + 3.1*(7 - 2*8.3) ]
pi^e
This is your expression: pi^e
This is your Result:   22.45915771836105
pi^e= 22.45915771836105
---------------------------------------------
Type an expression and press enter [ ex: -pi + 3.1*(7 - 2*8.3) ]
e^pi
This is your expression: e^pi
This is your Result:   23.14069263277927
e^pi= 23.14069263277927
---------------------------------------------
Type an expression and press enter [ ex: -pi + 3.1*(7 - 2*8.3) ]
e^e
This is your expression: e^e
This is your Result:   15.15426224147926
e^e= 15.15426224147926
---------------------------------------------
Type an expression and press enter [ ex: -pi + 3.1*(7 - 2*8.3) ]
e^-pi
This is your expression: e^-pi
This is your Result:   0.043213918263772
e^-pi= 0.043213918263772
---------------------------------------------
Type an expression and press enter [ ex: -pi + 3.1*(7 - 2*8.3) ]
pi^-e
This is your expression: pi^-e
This is your Result:   0.044525267266923
pi^-e= 0.044525267266923
---------------------------------------------
EDIT: one procedure was not completed
      so i removed calcula25 for some time
Title: Re: Solving real expressions
Post by: raymond on March 28, 2012, 04:30:00 AM
QuoteOne word to Raymond: thank you so much for your lib and your help !

You are most welcome. Keep up the good work. You must be getting a lot of satisfaction from all that hard work which resulted in what you were trying to achieve. :clap: :clap: :clap:
Title: Re: Solving real expressions
Post by: RuiLoureiro on March 28, 2012, 03:50:02 PM
Hi Raymond,
            Thank you so much.
            In any case you did a very good work !  :clap: :clap: :clap:

Hi all

    1. Calcula25 doesnt solve (2+3)^2

Quote
-------------------------------------------------------------------       
Type an expression and press enter [ ex: -pi + 3.1*(7 - 2*8.3) ]
(2+3)^2
This is your expression: (2+3)^2
This is your Result:  ERROR
(2+3)^2=ERROR

    2. Now, with calcula26 we can use the constants
       pi, +pi, -pi, e, +e, -e, or any constant in scientific notation
       in the equation aX^2+bX+c=c0 (but not expressions !)
       
       Examples:
-------------------------------------------------------------------
Type an expression and press enter [ ex: -pi + 3.1*(7 - 2*8.3) ]
-piX^2+eX+pi=2e3
This is your expression: -piX^2+eX+pi=2e3
RootX0=  0.432627989716133+ i -25.20778858587352
RootX1=  0.432627989716133- i -25.20778858587352
---------------------------------------------
Type an expression and press enter [ ex: -pi + 3.1*(7 - 2*8.3) ]
eX^2+piX=1
This is your expression: eX^2+piX=1
RootX0=  0.259874869004203
RootX1= -1.415602218795125
---------------------------------------------
Type an expression and press enter [ ex: -pi + 3.1*(7 - 2*8.3) ]
eX^2+piX-1=0
This is your expression: eX^2+piX-1=0
RootX0=  0.259874869004203
RootX1= -1.415602218795125
---------------------------------------------
Type an expression and press enter [ ex: -pi + 3.1*(7 - 2*8.3) ]
piX+e=2
This is your expression: piX+e=2
RootX0= -0.228636207064684
---------------------------------------------
Type an expression and press enter [ ex: -pi + 3.1*(7 - 2*8.3) ]
-eX^2=5
This is your expression: -eX^2=5
RootX0=  0+ i -1.356243785555241
RootX1=  0- i -1.356243785555241
---------------------------------------------
Type an expression and press enter [ ex: -pi + 3.1*(7 - 2*8.3) ]
-piX^2+2e3=1
This is your expression: -piX^2+2e3=1
RootX0= -25.22501660022046
RootX1=  25.22501660022046
---------------------------------------------
Type an expression and press enter [ ex: -pi + 3.1*(7 - 2*8.3) ]
-X^2+X-20=0
This is your expression: -X^2+X-20=0
RootX0=  0.500000000000000+ i -4.444097208657794
RootX1=  0.500000000000000- i -4.444097208657794
---------------------------------------------
Type an expression and press enter [ ex: -pi + 3.1*(7 - 2*8.3) ]
       
       
        3. We have:
       
        (e)^e = (+e)^e= e^e  and (-e)^2= e^2  and (-e)^3= -e^3 and (-e)^e= ERROR

        and
       
        (pi)^pi = (+pi)^pi= pi^pi  and (-pi)^2= pi^2  and (-pi)^3= -pi^3 and (-pi)^pi= ERROR
Title: Re: Solving real expressions
Post by: RuiLoureiro on March 28, 2012, 03:52:16 PM
Hi
        The first step to get the calculator is finished.
        All procedures are completed, at least for now
        (and while i dont find any error !  :wink).
       
        Here is calcula26.
        Try it and have a good luck !

        Thank you all
        RuiLoureiro
Title: Re: Solving real expressions
Post by: RuiLoureiro on March 30, 2012, 02:21:07 PM
Hi all,

I added the following functions to calcula26:

                sec(x), csc(x), cot(x), secd(x), cscd(x), cotd(x)
         arcsec(x), arccsc(x), arccot(x), arcsecd(x), arccscd(x), arccotd(x)

They are in calcula27
Try it and say something !
Thanks :wink

Quote
-------------------------------------------------------------------
Type an expression and press enter [ ex: -pi + 3.1*(7 - 2*8.3) ]
cos(pi/6)
This is your expression: cos(pi/6)
This is your Result:   0.866025403784439
cos(pi/6)= 0.866025403784439
---------------------------------------------
Type an expression and press enter [ ex: -pi + 3.1*(7 - 2*8.3) ]
sec(pi/6)
This is your expression: sec(pi/6)
This is your Result:   1.154700538379252
sec(pi/6)= 1.154700538379252
---------------------------------------------
Type an expression and press enter [ ex: -pi + 3.1*(7 - 2*8.3) ]
1/cos(pi/6)
This is your expression: 1/cos(pi/6)
This is your Result:   1.154700538379252
1/cos(pi/6)= 1.154700538379252
---------------------------------------------
Type an expression and press enter [ ex: -pi + 3.1*(7 - 2*8.3) ]
pi/6
This is your expression: pi/6
This is your Result:   0.523598775598299
pi/6= 0.523598775598299
---------------------------------------------
Type an expression and press enter [ ex: -pi + 3.1*(7 - 2*8.3) ]
arcsec(1.1546)
This is your expression: arcsec(1.1546)
This is your Result:   0.523447935192547
arcsec(1.1546)= 0.523447935192547
---------------------------------------------
Type an expression and press enter [ ex: -pi + 3.1*(7 - 2*8.3) ]
sec(pi/6)
This is your expression: sec(pi/6)
This is your Result:   1.154700538379252
sec(pi/6)= 1.154700538379252
---------------------------------------------
Type an expression and press enter [ ex: -pi + 3.1*(7 - 2*8.3) ]
arcsec(1.154700538379252)
This is your expression: arcsec(1.154700538379252)
This is your Result:   0.523598775598300
arcsec(1.154700538379252)= 0.523598775598300
---------------------------------------------
Title: Re: Solving real expressions
Post by: RuiLoureiro on March 30, 2012, 02:24:34 PM
I added the following functions to calcula26:

                sec(x), csc(x), cot(x), secd(x), cscd(x), cotd(x)
         arcsec(x), arccsc(x), arccot(x), arcsecd(x), arccscd(x), arccotd(x)

I added also a table of constants to calcula26:

        We can define up to 10 constants;
       
        The name can have up to 8 characters: e.g.: exp=-10.5;sin=2.3;
        It must begin with a letter (A to Z or a to z);

        We type something like this:
       
        t=-1e3; x=1.2; y=4.5; i=3; n=5; m=100; u=-5.2; v=8.9; u=10.1; z=10;
        (with spaces or not)
       
        Each constant must end with ;

        If we want to change to another table of constants, simply
        we type another set;

        They are in calcula27
Quote
******This calculator solves expressions in 80-bit REAL format*****
------------------------By Rui Loureiro----------------------------
Type an Expression, Equation or Constants and press enter
exp=-15.3;t=-1e3;x=-12.53;y=45.2;

This is your expression: exp=-15.3;t=-1e3;x=-12.53;y=45.2;
Type an Expression, Equation or Constants and press enter
3*t+2*x-y
This is your expression: 3*t+2*x-y
This is your Result:  -3070.260000000000
3*t+2*x-y=-3070.260000000000
---------------------------------------------
Type an Expression, Equation or Constants and press enter
exp+t-x+y
This is your expression: exp+t-x+y
This is your Result:  -957.5700000000000
exp+t-x+y=-957.5700000000000
---------------------------------------------
Type an Expression, Equation or Constants and press enter
sin(x+y)
This is your expression: sin(x+y)
This is your Result:   0.950261196835101
sin(x+y)= 0.950261196835101

        Try it and say something !
        Thank you
Title: Re: Solving real expressions
Post by: raymond on March 30, 2012, 03:59:22 PM
QuoteThis is your expression: e^-t+10
This is your Result:   11.00000000000000
e^-t+10= 11.00000000000000

Could you have another look at this one.
You have t = -1e3 = -1000
Therefore, -t = +1000, and e^1000 should be a large number. How do you arrive at the quoted result?
Title: Re: Solving real expressions
Post by: RuiLoureiro on March 30, 2012, 06:10:22 PM
Raymond,
        Sorry it's an error in the calculator while
        trying to get the exponent in scientific format.
        This is because we can type e^e or e^+e or e^-e
        the second 'e' is a constant E not scientific format.
       
        Now it is correct, thank you  :thumbu

        I removed the old calcula27 and
        i replaced by the new calcula27
        Thanks  :wink
         
Quote
-------------------------------------------------------------------
Type an Expression, Equation or Constants and press enter
e^1000
This is your expression: e^1000
This is your Result:   1.970071114017047E+0434
e^1000= 1.970071114017047E+0434
---------------------------------------------
Type an Expression, Equation or Constants and press enter
e^1e3
This is your expression: e^1e3
This is your Result:   1.970071114017046E+0434
e^1e3= 1.970071114017046E+0434
---------------------------------------------
Type an Expression, Equation or Constants and press enter
e^+1e3
This is your expression: e^+1e3
This is your Result:   1.970071114017046E+0434
e^+1e3= 1.970071114017046E+0434
---------------------------------------------
Type an Expression, Equation or Constants and press enter
e^-1e3
This is your expression: e^-1e3
This is your Result:   0.000000000000000
e^-1e3= 0.000000000000000
---------------------------------------------
Type an Expression, Equation or Constants and press enter
e^-1000
This is your expression: e^-1000
This is your Result:   0.000000000000000
e^-1000= 0.000000000000000
---------------------------------------------
Type an Expression, Equation or Constants and press enter
t=-1e3;u=1e3;
This is your expression: t=-1e3;u=1e3;
Type an Expression, Equation or Constants and press enter
e^-t
This is your expression: e^-t
This is your Result:   1.970071114017046E+0434
e^-t= 1.970071114017046E+0434
---------------------------------------------
Type an Expression, Equation or Constants and press enter
e^u
This is your expression: e^u
This is your Result:   1.970071114017046E+0434
e^u= 1.970071114017046E+0434
---------------------------------------------
Type an Expression, Equation or Constants and press enter
e^e
This is your expression: e^e
This is your Result:   15.15426224147926
e^e= 15.15426224147926
---------------------------------------------
Type an Expression, Equation or Constants and press enter
e^+e
This is your expression: e^+e
This is your Result:   15.15426224147926
e^+e= 15.15426224147926
---------------------------------------------
Type an Expression, Equation or Constants and press enter
e^-e
This is your expression: e^-e
This is your Result:   0.065988035845313
e^-e= 0.065988035845313
---------------------------------------------
Type an Expression, Equation or Constants and press enter
Title: Re: Solving real expressions
Post by: RuiLoureiro on March 30, 2012, 07:47:34 PM
Can i load Fpu from a register ?
I have a value in the EAX register
and i want to load it directly into Fpu ?
Impossible ?
Thanks
Title: Re: Solving real expressions
Post by: dedndave on March 30, 2012, 08:18:39 PM
        push    eax
        fld real4 ptr [esp]
        pop     eax
Title: Re: Solving real expressions
Post by: raymond on March 30, 2012, 08:41:02 PM
Quote from: dedndave on March 30, 2012, 08:18:39 PM
push eax
fld real4 ptr [esp]
pop eax


Values in a register from previous computations would normally be integers. If so, the correct load would be:

fild dword ptr [esp]

Quoteand i want to load it directly into Fpu ?

You are correct: impossible. No single instruction can do that.
Title: Re: Solving real expressions
Post by: dedndave on March 30, 2012, 08:51:35 PM
Quote from: raymond on March 30, 2012, 08:41:02 PMValues in a register from previous computations would normally be integers. If so, the correct load would be:

fild dword ptr [esp]

huh ?
oh - i got it - lol

        push    eax
        fild dword ptr [esp]
        pop     eax
Title: Re: Solving real expressions
Post by: RuiLoureiro on March 30, 2012, 09:08:40 PM
Raymond and Dave,

        Thank you !
       
        Tomorrow calcula27 does factorial ( i hope  :lol)
Title: Re: Solving real expressions
Post by: RuiLoureiro on March 31, 2012, 02:02:33 PM
Hi
    i wrote this procedure to calculate the logarithm base B
    ( B = _Integer32 positive not 1) and it works perfectly
    when i use base e (fldln2) or base 10 (fldlg2).

    1. What is the best: base 10 or base E ?
    2. Is there a directly way to calculate log base 2 ?

Quote
                fld     tbyte ptr OperandZ
               
                cmp     _Integer32, 10
                je      short _fnc3     ; go to log(x)         

                fldln2                  ; or this: fldlg2
                ;fldlg2
                fxch
                fyl2x                   ;->[log2(OperandZ)]*ln(2) = ln(OperandZ) base e

                fstsw ax                ;retrieve exception flags from FPU
                fwait
                shr   al,1              ;test for invalid operation
                jc    _erro0
               
                fild    dword ptr _Integer32

                fldln2                  ; or this: fldlg2
                ;fldlg2
                fxch
                fyl2x                   ;->[log2(_Integer32)]*ln(2) = ln(_Integer32) base e

                fstsw ax                ;retrieve exception flags from FPU
                fwait
                shr   al,1              ;test for invalid operation
                jc    _erro2

                fdiv                    ; st(0)= ln(OperandZ) / ln(_Integer32)
                jmp   _exit
               
    _erro2:     fstp  st
    _erro0:     fstp  st                ;get rid of st(0)
                ret 
Title: Re: Solving real expressions
Post by: dedndave on March 31, 2012, 03:05:31 PM
Log10 are called "common logs" (Log)
Loge are called "natural logs" (Logn)
both are used and should be supported

the FYL2X instruction calculates Y*Log2(X)
that's pretty close   :P
if Y = 1, then it calculates Log2
Title: Re: Solving real expressions
Post by: RuiLoureiro on March 31, 2012, 05:31:52 PM
    Dave,
            Ok thanks, it is exactly that
Quote
                fld     tbyte ptr OperandZ
                fld1
                fxch
                fyl2x                   ->[log2(OperandZ)]*1.0 = log2(OperandZ) base 2
               
                fstsw ax                ;retrieve exception flags from FPU
                fwait
                shr   al,1              ;test for invalid operation
                jc    _erro0
                ret               

Quote
Log10 are called "common logs" (Log)
Loge are called "natural logs" (Logn)
both are used and should be supported
both are supported in calcula27:
            ln(x)   - "natural logs"
            log(x)  - "common logs"

        In the next calcula28 we can use

            logb(x,n)   - base n
            LOGB(x,n)   - base n

        and more ...
Title: Re: Solving real expressions
Post by: dedndave on March 31, 2012, 05:55:10 PM
yah - "ln" is the right way - not "logn"   :U

Ln is used in trig and geometry, etc
Log is used in physics, electronics, etc

for example, a decibel is one tenth of a bel (named after Alexander Graham Bell, of course)
L(Bels) = Log(P2/P1), where P1,2 are power levels and L is a ratio of level change
Title: Re: Solving real expressions
Post by: RuiLoureiro on April 01, 2012, 12:12:12 PM
Hi all,
        With calcula28 we can use

            logb(x,n)   - base n                      [e.g.: logb(23,5) ]
            LOGB(x,n)   - base n
           
            n!          - factorial                        [e.g.: 10! ]
             
            comb(n, k)  - k-combination of n    [e.g.: comb(20,5) ]
            COMB(n, k)

        Try it and say something
        Thanks

i replaced calcula28. Now we can do t=10;k=5;
and comb(n,k)

       
        Here are some results       
Quote
-------------------------------------------------------------------
Type an Expression, Equation or Constants and press enter
1e23
This is your expression: 1e23
This is your Result:   1.000000000000000E+0023
1e23= 1.000000000000000E+0023
---------------------------------------------
Type an Expression, Equation or Constants and press enter
10^23
This is your expression: 10^23
This is your Result:   1.000000000000000E+0023
10^23= 1.000000000000000E+0023
---------------------------------------------
Type an Expression, Equation or Constants and press enter
10!
This is your expression: 10!
This is your Result:   3628800.000000000
10!= 3628800.000000000
---------------------------------------------
Type an Expression, Equation or Constants and press enter
100!
This is your expression: 100!
This is your Result:   9.332621544394415E+0157
100!= 9.332621544394415E+0157
---------------------------------------------
Type an Expression, Equation or Constants and press enter
10!/(2!*(10-2)!)
This is your expression: 10!/(2!*(10-2)!)
This is your Result:   45.00000000000000
10!/(2!*(10-2)!)= 45.00000000000000
---------------------------------------------
Type an Expression, Equation or Constants and press enter
comb(10,2)
This is your expression: comb(10,2)
This is your Result:   45.00000000000000
comb(10,2)= 45.00000000000000
---------------------------------------------
Type an Expression, Equation or Constants and press enter
comb(500,20)
This is your expression: comb(500,20)
This is your Result:   2.667198512837438E+0035
comb(500,20)= 2.667198512837438E+0035
---------------------------------------------
Type an Expression, Equation or Constants and press enter
1000!
This is your expression: 1000!
This is your Result:   4.023872600770939E+2567
1000!= 4.023872600770939E+2567
---------------------------------------------
Type an Expression, Equation or Constants and press enter
log(23)
This is your expression: log(23)
This is your Result:   1.361727836017593
log(23)= 1.361727836017593
---------------------------------------------
Type an Expression, Equation or Constants and press enter
logb(23,10)
This is your expression: logb(23,10)
This is your Result:   1.361727836017593
logb(23,10)= 1.361727836017593
---------------------------------------------
Type an Expression, Equation or Constants and press enter
ln(23)
This is your expression: ln(23)
This is your Result:   3.135494215929150
ln(23)= 3.135494215929150
---------------------------------------------
Type an Expression, Equation or Constants and press enter
t=10;x=13;
This is your expression: t=10;x=13;
Type an Expression, Equation or Constants and press enter
ln(t+x)
This is your expression: ln(t+x)
This is your Result:   3.135494215929150
ln(t+x)= 3.135494215929150
---------------------------------------------
Type an Expression, Equation or Constants and press enter
ln(x-t)
This is your expression: ln(x-t)
This is your Result:   1.098612288668110
ln(x-t)= 1.098612288668110
---------------------------------------------
Type an Expression, Equation or Constants and press enter
ln(3)
This is your expression: ln(3)
This is your Result:   1.098612288668110
ln(3)= 1.098612288668110
---------------------------------------------
Type an Expression, Equation or Constants and press enter
logb(25,12)
This is your expression: logb(25,12)
This is your Result:   1.295370924755994
logb(25,12)= 1.295370924755994
---------------------------------------------
Type an Expression, Equation or Constants and press enter
logb(25,16)
This is your expression: logb(25,16)
This is your Result:   1.160964047443681
logb(25,16)= 1.160964047443681
---------------------------------------------
Type an Expression, Equation or Constants and press enter
logb(12.25,20)
This is your expression: logb(12.25,20)
This is your Result:   0.836365104822369
logb(12.25,20)= 0.836365104822369
---------------------------------------------
Type an Expression, Equation or Constants and press enter
logb(10,2)
This is your expression: logb(10,2)
This is your Result:   3.321928094887362
logb(10,2)= 3.321928094887362
---------------------------------------------
Title: Re: Solving real expressions
Post by: MichaelW on April 01, 2012, 07:46:57 PM
Rui,

Have you considered testing your calculation code against an established library, GSL for example?

http://www.masm32.com/board/index.php?topic=16725.0

Title: Re: Solving real expressions
Post by: RuiLoureiro on April 01, 2012, 09:14:21 PM
Hi MichaelW

        The answer is no. To test some functions i can use
        the Raymond program, but i need more time to do this.
       
        But, in any way, i dont know how to access to that
        "established" library. Is it easy to use ?
       
        My work is to use the correct instructions, coding
        the procedures correctly and in this way i hope
        the result is correct (unless it has a bug).

        Did you test some functions ?
       
        Thank you for your reply Michael  :wink
        Rui Loureiro
Title: Re: Solving real expressions
Post by: RuiLoureiro on April 02, 2012, 05:39:38 PM
        Now, calcula29 has one more function: mean(x1,x2,...,xn)

        It gives the variance and standard deviation
        Try it and say something
        Thanks
Quote
-------------------------------------------------------------------
Type an Expression, Equation or Constants and press enter
mean(10,11,12,13,14,15)

This is your expression: mean(10,11,12,13,14,15)
---------------------------------------------
mean(10,11,12,13,14,15)= 12.50000000000000
Variance:  2.916666666666667
Standard Deviation:  1.707825127659933
Sample Variance:  3.500000000000000
Sample Standard Deviation:  1.870828693386971
---------------------------------------------
Title: Re: Solving real expressions
Post by: dedndave on April 02, 2012, 05:53:52 PM
what we need is to make a little GUI app
with support for variable names, subscripting, and superscripting   :U
add in the normal scientific calculator buttons - with unit conversions, memory, and so on
Title: Re: Solving real expressions
Post by: RuiLoureiro on April 05, 2012, 07:25:32 PM
Hi Dave,

Quote
what we need is to make a little GUI app

        Do you want to share this project with me ?
        Anyone wants ?
       
Quote
with support for variable names

        With calcula29 we can define 10 variable names

        Now, with calcula30 we can solve
        a system of 2 linear equations.
        It is under test but it seems it works correctly.
        I use matrices to solve it.

         We must use aX+bY=c; fX+gY=h;  The first must be X and second Y.
Quote
-------------------------------------------------------------------
Type an Expression, Equation or Constants and press enter
2x+3y=10;x-y=2;
This is your expression: 2x+3y=10;x-y=2;
---------------------------------------------
X=  3.200000000000000
Y=  1.200000000000000
---------------------------------------------
Type an Expression, Equation or Constants and press enter
Title: Re: Solving real expressions
Post by: dedndave on April 05, 2012, 08:32:30 PM
well - most members don't like the way i write code - lol
i don't care for .IF/.ELSEIF/.ENDIF or .WHILE/.ENDW, nor do i care for indenting code
but - all you need is an edit box and a bunch of buttons - toss in some menus   :P
the GUI part would be much easier than the math part