News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

The calculator

Started by RuiLoureiro, May 31, 2012, 10:59:09 PM

Previous topic - Next topic

Gunther

Rui,

awesome.  :t

Gunther
You have to know the facts before you can distort them.

RuiLoureiro

Quote from: Gunther on January 08, 2014, 07:05:02 AM
Rui,

awesome.  :t

Gunther

Hi Gunther
                        Thanks for your words  :t

Hi
        --**** The calculator v2014.02 ****--
                          (calcula64)
   
        This is the latest powerful version.

        ---------------------------------------------
        Polynomials with integer coefficients
        ---------------------------------------------

        General:   

                  p(x)=I7 x^7 + I6 x^6 + ...+ I1 x + I0

        where I7, I6, ..., I0 are integers.

        The calculator tries to find integer roots only.
   
        ------------------------------------------------
        Type:           
                p(x)=x^2+x-2

        We get:
                p(x)= (x+2 ) * (x-1 )

        ------------------------------------------------
        Type:           
                p(x)=x^5 +2x^4 -x^3 -2x^2

        We get:
                p(x)= (x+2 ) * (x+1 ) * (x-0 ) * (x-0 ) * (x-1 )
        ------------------------------------------------
        Type:           
                p(x)=x^2-2x+2

        We get:
                There is no integer roots in the table from -30 to 30
                 x^2-2 x+2= (x-1+i ) * (x-1-i )
        ------------------------------------------------
        Type:           
                p(x)=x^6 -1

        We get:
                p(x)= (x+1 ) * (x-1 ) * ( x^4+ x^2+1 )

        ------------------------------------------------
        Type:           
                p(x)=-5x^4 +5

        We get:
                p(x)= -5 * (x+1 ) * (x-1 ) * ( x^2+1 )
                x^2+1= (x+i ) * (x-i )

        ------------------------------------------------
        Type:           
                p(x)=-6x^6

        We get:
       
                p(x)= -6 * (x-0 ) * (x-0 ) * (x-0 ) * (x-0 ) * (x-0 ) * (x-0 )
           
    Jan. 2014

    Good luck !   
    RuiLoureiro

RuiLoureiro

#92
Hi all,

****--The Calculator v2014.03 by RuiLoureiro--****
                              (calcula65)
                 
        ------------------------------------
                  DERIVATIVES
                     first version
        ------------------------------------

        In this version, we may compute the derivative
        of one given function.

       
        1. Write an expression:   x^2-x*sin(x-x^2)

        2. Put the expression between brackets

           (x^2-x*sin(x-x^2)) or [x^2-x*sin(x-x^2)]

        3. end it

           (x^2-x*sin(x-x^2))' or [x^-x*sin(x-x^2)]'

        4. compute (we get)

            2*x-[sin(x-x^2)+(1-2*x)*cos(x-x^2)*x]


        In the same way, we have:

            [-(x)*sin(x-x^2)]' = -[sin(x-x^2)+(1-2*x)*cos(x-x^2)*x]

        ------------
        basic rule
        ------------

           the calculator doesn't know how to solve
           expressions with brackets inside brackets
       
        --------------------
        some messages
        --------------------
       
        1. «The expression is too complex»

            means that the calculator doesnt solve that case
            (it will solve later but not now)

        2. «Expression error»

            In many cases, it means that the calculator
            doesnt solve that case
            (it will solve later but not now)

            [x^2 + 2 * sin(x) ]' = Expression error

            but
           
            [x^2 + (2) * sin(x) ]' = 2*x+cos(x)*(2)

        -----------------------------------
        how to read the expression
        -----------------------------------

        We must read the expression from left to right.

        Example:
       
        [arctan(x^2-1)^(-1/2)]' = (-1/2)*2*x/(1+(x^2-1)^2)*arctan(x^2-1)^(-3/2)

        means this:

                                                 (-1/2)*2*x
        [arctan(x^2-1)^(-1/2)]' = --------------- * arctan(x^2-1)^(-3/2)
                                               (1+(x^2-1)^2)


                                           -x
                                = --------------- * arctan(x^2-1)^(-3/2)
                                   (1+(x^2-1)^2)

                                                          -x
                                = -----------------------------------------------
                                   (1+(x^2-1)^2) * arctan(x^2-1)^(3/2)

        ------------
        examples
        ------------
       
[sin(x^2-x)^(1/3) / (x^2-1)]'=[(1/3)*(2*x-1)*cos(x^2-x)*sin(x^2-x)^(-2/3)*(x^2-1) -
                                 2*x*sin(x^2-x)^(1/3)]/(x^2-1)^2

[(x^2-1) * sin(x^2-x)^(1/3)]' = 2*x*sin(x^2-x)^(1/3) +
                                (1/3)*(2*x-1)*cos(x^2-x)*sin(x^2-x)^(-2/3)*(x^2-1)

[(x^2-1) / sin(x^2-x)^(1/3)]' = [2*x*sin(x^2-x)^(1/3) -
                                (1/3)*(2*x-1)*cos(x^2-x)*sin(x^2-x)^(-2/3)*(x^2-1)] /
                                sin(x^2-x)^(2/3)


        This is the first version and this may contain some
        bugs. I am sure you will call my attention to that
        if you want to help me.
        Thank you.

        Good luck  :t
        Mar. 2014
        RuiLoureiro

Gunther

Hi Rui,

seems to be a great step forward. I'll test the new version next weekend. Thank you.

Gunther
You have to know the facts before you can distort them.

RuiLoureiro

Hi Gunther,
            Thank you.  :t
            I also think it will be a great step forward:
            we write a function, we have the derivative!
            Only to us: i hope that Hutch will do some
                differential calculus, now and quickly.
  ;)

:biggrin:
Hi all,

****--The Calculator v2014.03.01 by RuiLoureiro--****
                                  (calcula65)
                 
        ------------------------------------
           DIFFERENTIAL CALCULUS
        ------------------------------------       
    I found a bug in the previous version v2014.03.

    First, i want to say that i did a lot of tests before posting
    the last version. For instance, i got
   
    [cos(x^2-1)^(1/2) * sin(x-x^2)^(1/3)]'  =

        -(1/2)*2*x*sin(x^2-1)*cos(x^2-1)^(-1/2)*sin(x-x^2)^(1/3) +
        (1/3)*(1-2*x)*cos(x-x^2)*sin(x-x^2)^(-2/3)*cos(x^2-1)^(1/2)

    and it is correct. But probably i did some modifications in the model
    and using the version i posted, we get

    -(1/2)*2*x*sin(x^2-1)*cos(x^2-1)^(-1/2)*sin(x-x^2) +
     (1/3)*(1-2*x)*cos(x-x^2)*sin(x-x^2)^(-2/3)*cos(x^2-1)

    Here, we have sin(x-x^2) NOT sin(x-x^2)^(1/3)
    and cos(x^2-1) NOT cos(x^2-1)^(1/2)

    This is the bug.

    In this new version we get

    -x*sin(x^2-1)*cos(x^2-1)^(-1/2)*sin(x-x^2)^(1/3) +
    (1/3)*(1-2*x)*cos(x-x^2)*sin(x-x^2)^(-2/3)*cos(x^2-1)^(1/2)

    See this:   -(1/2)*2*x ...   in the previous
             IS:    -x ...                 now

    This is the new model.
   
    Another example I:

    [sin(3.1*x^2-x)^(1/3) / cos(2.5*x^2-1)^(1/2)]'=

    [(1/3)*(6.2*x-1)*cos(3.1*x^2-x)*sin(3.1*x^2-x)^(-2/3)*cos(2.5*x^2-1)^(1/2) -
    (-5/2)*x*sin(2.5*x^2-1)*cos(2.5*x^2-1)^(-1/2)*sin(3.1*x^2-x)^(1/3)] / cos(2.5*x^2-1)

    Another example II:

    [sin(3.1*x^2-x)^(1/3) * cos(2.5*x^2-1)^(1/2)
    +(x^2-x)^(3) * (x^2-1)
    +exp(x^2-x) * ln(x^2-1)]'=

    (1/3)*(6.2*x-1)*cos(3.1*x^2-x)*sin(3.1*x^2-x)^(-2/3)*cos(2.5*x^2-1)^(1/2) +
    (-5/2)*x*sin(2.5*x^2-1)*cos(2.5*x^2-1)^(-1/2)*sin(3.1*x^2-x)^(1/3) +
    3*(2*x-1)*(x^2-x)^2*(x^2-1) +
     2*x*(x^2-x)^3 +
     (2*x-1)*exp(x^2-x)*ln(x^2-1)+(2*x/(x^2-1))*exp(x^2-x)

        Good luck !
        Mar. 2014
        RuiLoureiro

        EDIT: we may use list or show to see the defined constants.

Gunther

Rui,

thank you for the new archives.  :t

Gunther
You have to know the facts before you can distort them.

RuiLoureiro

#96
****--The Calculator v2014.04 by RuiLoureiro--****
                              ( calcula66 )                 
        --------------------------------------------
              SOME DETECTED PROBLEMS
               
in the previous versions
        --------------------------------------------
    ----------------------------
    1. 
REAL EXPRESSIONS
    ----------------------------
       
If we try:   
                       jr   = 10.6;
                       tj   = jr/1200
                       tj1  =(1200+jr)/1200
                       tj72 =tj1^72
        we get:

               pm=(10500.0 * ( jr / 1200) * (1+ jr / 1200)^72  ) / ( (1+tj)^72-1 )
                 =197.71325597595037

               pm=(10500.0 * ( jr / 1200) * (1+ jr / 1200)^72  ) / ( tj72-1 )
                 =197.71325597595036

        In the previous we GET: ERROR

              HERE: +tj)^  <--- brackets not tested after variable name

        Now it is solved.
       
    ----------------------------
    2. COMPLEX NUMBERS
    ----------------------------
       
Try:
                10^1+i0

        It should be: 10+i0
        (first power 10^1 and second ADD i0)

        But we get: 1.0+i0
                            | Z |=  1.0
                            Angle=  0 degrees
                            Angle=  0 radians

        Now we get: 10.0+i0         
                              | Z |=  10.0
                              Angle=  0 degrees
                              Angle=  0 radians

        Now it is solved.
                   
    ------------------------------
     3.  LOGIC EXPRESSIONS
    ------------------------------
       
Try:        xz=92h and 20h
        we get:  ERROR (doesnt detect 'and' operator)

        I redid all procedures to compute
        logic expressions and now
        it is, better and faster.
         
        We get: 0
                      00000000H
                      00000000000000000000000000000000B
       
        Now it is solved.

    --------------------------
    5.    CONVERSIONS
    --------------------------
       
Now,    '-'    means 'negative number'
        and    NOT  means  'complement'

        Example 11
        --------------

            type:   not -42d

            we get: 41
                          00000029H
                          00000000000000000000000000101001B
    --------------------------
    4.    DERIVATIVES
    --------------------------
       
I did a lot of work about this, but it is
        not completed yet.

        NOTE: in many cases, when the calculator gives ERROR, it
                   means that it cannot solve the problem (it fails).


        Good luck !  :t
        Jun. 2014
        RuiLoureiro

Gunther

Rui,

I see, it's an error update. So the calculator becomes more and more stable. That's good news.

Gunther
You have to know the facts before you can distort them.

RuiLoureiro

Hi all,

****--The Calculator v2014.05 by RuiLoureiro--****
                          ( calcula67 )
                 
        1.    SOME DETECTED PROBLEMS
             in the previous versions
                 were corrected;
        -------------------------------------------------

        2.  Now, the calculator use SSE
            instructions in some cases.
            It is faster;
        -------------------------------------------------

        3.  See the following files where
            we can find a lot of examples
            about matrices.
           
            . Examples_real0_matrix.txt
            . Examples_complex0_matrix.txt

            If matCMPX is complex,
            matREAL= cnvreal(matCMPX) is real.
        -------------------------------------------------

            I did these examples to show that
            The calculator works correctly.

        Good luck !  :t
        Set. 2014
        RuiLoureiro

Gunther

Rui,

thank you for the new version.  :t SSE accelerates much.

Gunther
You have to know the facts before you can distort them.

guga

Excelent work rui


You could do a library version. (dll and lib) as well. It would be very handfull
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

Gunther

Quote from: guga on September 23, 2014, 05:51:45 AM
You could do a library version. (dll and lib) as well. It would be very handfull

This idea isn't so bad. I think it's a question of time.

Gunther
You have to know the facts before you can distort them.

RuiLoureiro


Mikl__


RuiLoureiro

Quote from: Mikl__ on March 29, 2016, 05:25:53 PM
Ola, Rui!

Olá Mikl__, very nice to see you here !  :t :icon14: