News:

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

Main Menu

TheCalculator-new powerful version 2017

Started by RuiLoureiro, April 08, 2017, 08:03:13 AM

Previous topic - Next topic

RuiLoureiro

Hi all
        This is to announce the end of my main, basic and fundamental work
        that put «TheCalculator» to compute a derivative of any function of
        x, correctly, showing simplified solutions (see yourself).
       
        We may compute any product, up to 4 factors A,B,C,D or
        any argument of 4 factors A,B,C,D:

        A*B*C*D             A*B/C/D = A*B/(C*D)
        A*B*C/D             A/B*C/D = A*C/(B*D)
        A*B/C*D             A/B/C*D = A*D/(B*C)
        A/B*C*D =A*C*D/B
        ...                 ...
        A/B/C/D = A/(B*C*D) - we dont need to use brackets to solve any case

        In this version, we may use:

        Integers, Reals (eg. 523.78 or 5.2378E2 ),
        Rational numbers (k/n),
        pi and literal constantes a,b,c,d,e,f,...

        We may use up to 5 nested functions in each factor.

        This was done following a new complete method that i created:
        we analyse the expression and we give the answer case by case.
        Any mathematical expression is one of 3 types only:
        single,multiple or sum. And any expression is coded in 32 bites.
        But first we transform any expression into a symbolic expression
        and then we call a procedure that solves the symbolic expression.
        And it works ... correctly.
        The structure of variables has now 330000 bytes in the stack.
        It was written using Quick Editor - by Hutch.

        Now, i am testing all kind of expressios and getting the solutions
        to one file of complete examples. I want to correct something
        wrong before posting it. So, i will post it as soon as possible.

        Thank you Jochen Nidud, Dave,HSE,... and all friends
        Thanks
        Regards
        Rui Loureiro
                                 http://masm32.com/board/index.php?topic=6197.0     <<<<<<<<
Quote
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; example with brackets: A/(B*C*D) - all functions of x

input box=>     [x / (e^x * sin(3*pi/x) * cos(x^2-tan(3*pi*x)))]'

solution box1=> (
                  ( e^x*sin(3*pi/x)*cos(x^2-tan(3*pi*x)) )  <<- brackets without meaning
                 
                  -x * ( e^x*sin(3*pi/x)*cos(x^2-tan(3*pi*x))
                 
                         -3*pi/x^2*cos(3*pi/x)*e^x*cos(x^2-tan(3*pi*x))
                 
                         +(2*x-3*pi*sec(3*pi*x)^2)*sin(x^2-tan(3*pi*x))*e^x*sin(3*pi/x)
                       )

                )/(e^x*sin(3*pi/x)*cos(x^2-tan(3*pi*x)))^2               
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; example of arguments with 4 factors A,B,C,D

input box=> [ sin(a*x^2*tan(3*pi*x)*e^x) * cos(a*x^2*tan(3*pi*x)*e^x)]'

solution box1=> a * ( 2*x * e^x * tan(3*pi*x)

                     +3*pi * sec(3*pi*x)^2 * x^2 * e^x
                   
                     +e^x * x^2 * tan(3*pi*x)

                    ) * cos(a*x^2*tan(3*pi*x)*e^x) * cos(a*x^2*tan(3*pi*x)*e^x)
                   
               -a * ( 2*x * e^x * tan(3*pi*x)

                      +3*pi * sec(3*pi*x)^2 * x^2 * e^x

                     +e^x * x^2 * tan(3*pi*x)
                     
                    ) * sin(a*x^2*tan(3*pi*x)*e^x) * sin(a*x^2*tan(3*pi*x)*e^x)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; example of  4 factors A,B,C,D

input box=>     [a * x^2 * tan(3*pi*x) * e^x]'

solution box1=> a * ( 2*x * e^x * tan(3*pi*x)
                     + 3*pi * sec(3*pi*x)^2 * x^2 * e^x
                     + e^x * x^2 * tan(3*pi*x)
                    )

RuiLoureiro

Hi all

Here more examples
Quote
; example with brackets: 1/(A*B*C) - functions of x

input box=>     [1/(x*sin(3*pi/x)*cos(x^2-tan(3*pi*x)))]'

solution box1=> -( sin(3*pi/x)*cos(x^2-tan(3*pi*x))
                  -3*pi/x^2*cos(3*pi/x)*x*cos(x^2-tan(3*pi*x))
                  +(2*x-3*pi*sec(3*pi*x)^2)*sin(x^2-tan(3*pi*x))*x*sin(3*pi/x)

                 ) / (x*sin(3*pi/x)*cos(x^2-tan(3*pi*x)))^2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; example without brackets: 1/A/B/C - functions of x

input box=>     [1/x/sin(3*pi/x)/cos(x^2-tan(3*pi*x))]'

solution box1=> -( sin(3*pi/x)*cos(x^2-tan(3*pi*x))
                  -3*pi/x^2*cos(3*pi/x)*x*cos(x^2-tan(3*pi*x))
                  -(2*x-3*pi*sec(3*pi*x)^2)*sin(x^2-tan(3*pi*x))*x*sin(3*pi/x)

                 ) / (x*sin(3*pi/x)*cos(x^2-tan(3*pi*x)))^2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; example: A*B*C - functions of x

input box=>     [x * sin(3*pi/x) * cos(x^2-tan(3*pi*x))]'

solution box1=>    sin(3*pi/x)*cos(x^2-tan(3*pi*x))

                   -3*pi/x^2*cos(3*pi/x)*x*cos(x^2-tan(3*pi*x))
               
                   -(2*x-3*pi*sec(3*pi*x)^2)*sin(x^2-tan(3*pi*x))*x*sin(3*pi/x)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; example of B' - B is a function of x

input box=>     [sin(3*pi/x)]'

solution box1=> -3*pi/ x^2 * cos(3*pi/x)

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; example of C' - C is a function of x with nested functions

input box=>     [cos(x^2-tan(3*pi*x))]'

solution box1=> -( 2*x - 3*pi*sec(3*pi*x)^2) * sin(x^2-tan(3*pi*x))

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; example with brackets: A/(B*C) - all functions of x

input box=>     [x / ( sin(3*pi/x) * cos(x^2-tan(3*pi*x)) )]'

solution box1=> (
                  ( sin(3*pi/x) * cos(x^2-tan(3*pi*x)) )    <<- brackets without meaning

                  -x * ( -3*pi/x^2 * cos(3*pi/x) * cos(x^2-tan(3*pi*x))

                         +(2*x-3*pi*sec(3*pi*x)^2)*sin(x^2-tan(3*pi*x)) * sin(3*pi/x)
                       )

                ) / (sin(3*pi/x)*cos(x^2-tan(3*pi*x)))^2


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; example without brackets: A/B/C - all functions of x

input box=>     [x / sin(3*pi/x) / cos(x^2-tan(3*pi*x)) ]'

solution box1=> (
                  sin(3*pi/x)*cos(x^2-tan(3*pi*x))      <<- without brackets

                  -x * ( -3*pi/x^2*cos(3*pi/x)*cos(x^2-tan(3*pi*x))

                         +(2*x-3*pi*sec(3*pi*x)^2) * sin(x^2-tan(3*pi*x)) *sin(3*pi/x)
                       )
                 ) / (sin(3*pi/x)*cos(x^2-tan(3*pi*x)))^2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; example without brackets: A/B/C/D - all functions of x

input box=>     [x / e^x / sin(3*pi/x) / cos(x^2-tan(3*pi*x))]'

solution box1=> (
                  e^x*sin(3*pi/x)*cos(x^2-tan(3*pi*x))      <<- without brackets

                  -x * ( e^x*sin(3*pi/x)*cos(x^2-tan(3*pi*x))
                 
                         -3*pi/x^2*cos(3*pi/x)*e^x*cos(x^2-tan(3*pi*x))
                 
                         +(2*x-3*pi*sec(3*pi*x)^2)*sin(x^2-tan(3*pi*x))*e^x*sin(3*pi/x)
                       )
                ) / (e^x*sin(3*pi/x)*cos(x^2-tan(3*pi*x)))^2

RuiLoureiro

Hi Hutch

        Many years ago, i taught higher mathematics in a higher school. I have a
        backgroud of twenty in twenty and 2 schools in one year. If you search, you
        may find one credit from an usa university. It was given to me- was given. Now,
        i am retired and i am 63 years old. So, now, i am doing things to pass the time.

        As far as i know, you dont like mathematics so it is possible that you
        dont consider TheCalculator an important project in this your site.
       
        I considered that you buried The Calculator elsewhere here in this your site and
        i dont know why - it was in The Campus since april 09 2012.

        I want to ask you if you allow the new version in The Workshop - or you may transfer
        the old one to Workshop.

        Thank you
        Regards
:icon14:

        Rui


HSE

Fantastic Rui!  :t

Whatever searcher find the calculator with the words "derivative masm32". More important that the place is the description that you make.
Equations in Assembly: SmplMath

guga

Great work, as usual, Rui.

Did  you post the update ?
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

jj2007

Quote from: RuiLoureiro on April 08, 2017, 08:11:57 AMi taught higher mathematics in a higher school.

That explains your passion for The Calculator, Rui - it's a great project :t

Btw I agree this project would be better suited for The Workshop, it's slightly too difficult for The Campus.

There is an interesting post by bitRAKE showing how the RichEdit control can be used to display math:
QuoteMath Zone syntax is fairly easy, imho. Auto-correction will convert symbol names to the symbol (e.g. \alpha, \theta), and automatically create syntax groups based on function names or start/end synbols (e.g. matching (), {}, [], etc.). Also, there are built-in macros (\binomial, \integral, \limit, \quadratic, ...),

Search inside the page for re6mz.zip to find a 2048 bytes exe with a RichEdit control where you can type \integral[space] to get what is shown in the screenshot below. I have not implemented this option in RichMasm, but if there is an interest, I'll look into it.

jj2007

The new RichMasm version posted here as part of the MasmBasic package can handle mathematical formulas.

I attach a demo with a number of shortcut examples. See also this post.

hutch--

Rui,

For the life of me, I cannot find your post containing the finished app you mentioned. The reason why I occasionally move very long threads that have been lingering for a very long time with only tiny incremental changes is because they block up the normal posts that other people make. If you have a finished version, post it in the Workshop.

jack

I thought I was the only one unable to see the download link  :biggrin:

RuiLoureiro

Hutch,
            Thank you, i will do it as soon as possible.
Jochen,
            Coming from you, one day, i learned 2 lessons: you and Dave
            are my good friends for ever. No more words.
            Thank you  :t

            I never forget all good friends like MichaelW, Gunther, Guga,
            Mikl__ or HSE. Of course Hutch - i use Quick Editor...
            You are also my friends for ever.
Hi all
            I have a lot of tested functions and
            all tested functions are correct.
            But now i am writing simplifiers, so
            next week or so i will post the calculator - first version.

            Thank all all
Quote
note: all these solutions are produced by a general procedure to
      give the derivative of any function
.

; example: all solutions are simplified

input box=> [ln(x/(3+a))    -ln(x/(3+a))    +ln(-x/(3+a))     -ln(-x/(3+a))
            +ln(2*x/(3+a))  -ln(2*x/(3+a))  +ln(-2*x/(3+a))   -ln(-2*x/(3+a))
            +ln(x^2/(3+a))  -ln(x^2/(3+a))  +ln(-x^2/(3+a))   -ln(-x^2/(3+a))
            +ln(3*x^2/(3+a))-ln(3*x^2/(3+a))+ln(-3*x^2/(3+a)) -ln(-3*x^2/(3+a))
            +ln(x^2)        -ln(x^2)        +ln(-x^2)         -ln(-x^2)
            +ln(3*x^2)      -ln(3*x^2)      +ln(-3*x^2)       -ln(-3*x^2)
           
            +ln(x^3)        -ln(x^3)        +ln(-x^3)         -ln(-x^3)
            +ln(2*x^3)      -ln(2*x^3)      +ln(-2*x^3)       -ln(-2*x^3)]'

solution box1=> 1/x         -1/x            +1/x              -1/x
               +1/x         -1/x            +1/x              -1/x
               +2*x^-1      -2*x^-1         +2*x^-1           -2*x^-1
               +2*x^-1      -2*x^-1         +2*x^-1           -2*x^-1
               +2*x^-1      -2*x^-1         +2*x^-1           -2*x^-1
               +2*x^-1      -2*x^-1         +2*x^-1           -2*x^-1
               
               +3*x^-1      -3*x^-1         +3*x^-1           -3*x^-1
               +3*x^-1      -3*x^-1         +3*x^-1           -3*x^-1               
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; example: solutions ARE NOT simplified yet, but are correct

input box=>     [ln(x/5)       -ln(x/5)        +ln(-x/5)         -ln(-x/5)
                +ln(2*x/5)     -ln(2*x/5)      +ln(-2*x/5)       -ln(-2*x/5)
                +ln(x^2/5)     -ln(x^2/5)      +ln(-x^2/5)       -ln(-x^2/5)
               
                +ln(3*x^2/5)   -ln(3*x^2/5)    +ln(-3*x^2/5)     -ln(-3*x^2/5)
               
                +ln(x^3/5)     -ln(x^3/5)      +ln(-x^3/5)       -ln(-x^3/5)
               
                +ln(2*x^3/5)   -ln(2*x^3/5)    +ln(-2*x^3/5)     -ln(-2*x^3/5)]'

solution box1=> (5/x)/5        -(1/5)*(5/x)    +(1/5)*(5/x)      -(1/5)*(5/x)
               +(2/5)*5/(2*x)  -(2/5)*5/(2*x)  +(2/5)*5/(2*x)    -(2/5)*5/(2*x)
               +2/5*x*5*x^-2   -2/5*x*5*x^-2   +2/5*x*5*x^-2     -2/5*x*5*x^-2

               +(3/5)*2*x*5/(3*x^2)             -(3/5)*2*x*5/(3*x^2)
               +(3/5)*2*x*5/(3*x^2)             -(3/5)*2*x*5/(3*x^2)

               +3/5*x^2*5*x^-3                  -3/5*x^2*5*x^-3
               +3/5*x^2*5*x^-3                  -3/5*x^2*5*x^-3
               
               +(2/5)*3*x^2*5/(2*x^3)           -(2/5)*3*x^2*5/(2*x^3)
               +(2/5)*3*x^2*5/(2*x^3)           -(2/5)*3*x^2*5/(2*x^3)

RuiLoureiro

Hi 
        Here are simplified solutions given by TheCalculator
        We may see a lot of solutions in the file TheCalculator_derivatives03.txt below.
        I will post TheCalculator this week in The Workshop.

        See you
Quote
input box=>     [ln(x/(3+a))        -ln(x/(3+a))    +ln(-x/(3+a))       -ln(-x/(3+a))
                +ln(2*x/(3+a))      -ln(2*x/(3+a))  +ln(-2*x/(3+a))     -ln(-2*x/(3+a))
                +ln(x^2/(3+a))      -ln(x^2/(3+a))  +ln(-x^2/(3+a))     -ln(-x^2/(3+a))
                +ln(3*x^2/(3+a))    -ln(3*x^2/(3+a))+ln(-3*x^2/(3+a))   -ln(-3*x^2/(3+a))
                +ln(x^2)            -ln(x^2)        +ln(-x^2)           -ln(-x^2)
                +ln(3*x^2)          -ln(3*x^2)      +ln(-3*x^2)         -ln(-3*x^2)
                +ln(x^3)            -ln(x^3)        +ln(-x^3)           -ln(-x^3)
                +ln(2*x^3)          -ln(2*x^3)      +ln(-2*x^3)         -ln(-2*x^3)     
                +ln(x/5)            -ln(x/5)        +ln(-x/5)           -ln(-x/5)       
                +ln(2*x/5)          -ln(2*x/5)      +ln(-2*x/5)         -ln(-2*x/5)     
                +ln(x^2/5)          -ln(x^2/5)      +ln(-x^2/5)         -ln(-x^2/5)     
                +ln(3*x^2/5)        -ln(3*x^2/5)    +ln(-3*x^2/5)       -ln(-3*x^2/5)   
                +ln(x^3/5)          -ln(x^3/5)      +ln(-x^3/5)         -ln(-x^3/5)     
                +ln(2*x^3/5)        -ln(2*x^3/5)    +ln(-2*x^3/5)       -ln(-2*x^3/5)]'

solution box1=> 1/x             -1/x            +1/x                -1/x
                +1/x            -1/x            +1/x                -1/x
                +2*x^-1         -2*x^-1         +2*x^-1             -2*x^-1
                +2*x^-1         -2*x^-1         +2*x^-1             -2*x^-1
                +2*x^-1         -2*x^-1         +2*x^-1             -2*x^-1
                +2*x^-1         -2*x^-1         +2*x^-1             -2*x^-1
                +3*x^-1         -3*x^-1         +3*x^-1             -3*x^-1
                +3*x^-1         -3*x^-1         +3*x^-1             -3*x^-1
                +1/x            -1/x            +1/x                -1/x
                +1/x            -1/x            +1/x                -1/x
                +2*x^-1         -2*x^-1         +2*x^-1             -2*x^-1
                +2*x^-1         -2*x^-1         +2*x^-1             -2*x^-1
                +3*x^-1         -3*x^-1         +3*x^-1             -3*x^-1
                +3*x^-1         -3*x^-1         +3*x^-1             -3*x^-1


+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
input box=>     [ln(x/b)        -ln(x/b)        +ln(-x/b)       -ln(-x/b)
                +ln(2*x/b)      -ln(2*x/b)      +ln(-2*x/b)     -ln(-2*x/b)
                +ln(x^2/b)      -ln(x^2/b)      +ln(-x^2/b)     -ln(-x^2/b)
                +ln(3*x^2/b)    -ln(3*x^2/b)    +ln(-3*x^2/b)   -ln(-3*x^2/b)
                +ln(x^3/b)      -ln(x^3/b)      +ln(-x^3/b)     -ln(-x^3/b)
                +ln(2*x^3/b)    -ln(2*x^3/b)    +ln(-2*x^3/b)   -ln(-2*x^3/b)
                +ln(a*x/b)      -ln(a*x/b)      +ln(-a*x/b)     -ln(-a*x/b)
                +ln(a*x^2/b)    -ln(a*x^2/b)    +ln(-a*x^2/b)   -ln(-a*x^2/b)   
                +ln(a*x^3/b)    -ln(a*x^3/b)    +ln(-a*x^3/b)   -ln(-a*x^3/b)]'

solution box1=> 1/x             -1/x            +1/x            -1/x
                +1/x            -1/x            +1/x            -1/x
                +2*x^-1         -2*x^-1         +2*x^-1         -2*x^-1
                +2*x^-1         -2*x^-1         +2*x^-1         -2*x^-1
                +3*x^-1         -3*x^-1         +3*x^-1         -3*x^-1
                +3*x^-1         -3*x^-1         +3*x^-1         -3*x^-1
                +1/x            -1/x            +1/x            -1/x
                +2*x^-1         -2*x^-1         +2*x^-1         -2*x^-1
                +3*x^-1         -3*x^-1         +3*x^-1         -3*x^-1

HSE

Hi Rui!!

What purpose have this in the input box:+ln(-x^2/b)     -ln(-x^2/b)

You can simplify the input 8)
Equations in Assembly: SmplMath

RuiLoureiro

Quote from: HSE on April 26, 2017, 10:26:48 AM
Hi Rui!!

What purpose have this in the input box:+ln(-x^2/b)     -ln(-x^2/b)

You can simplify the input 8)
Hi HSE,
             It is to test all 4 cases: function is ln(u)- u is x^2/b

             case1:  ln(u)
             case2:-ln(u)
             case3:  ln(-u)
             case4: -ln(-u)
                                                   [ln(u)]' = u' * u^-1

             We have a general procedure to get u' and a general procedure to multiply A by B.
             Thanks
             See you  :t

HSE

 :biggrin: Yes, but if you simplify then you don't see nothing. It's not a simplified solution.
Equations in Assembly: SmplMath

RuiLoureiro

#14
Quote from: HSE on April 27, 2017, 06:50:15 AM
:biggrin: Yes, but if you simplify then you don't see nothing. It's not a simplified solution.
Hi HSE,

Yes they are simplified solutions (reply#10). If we have A= (x^2-1)/(x+1) it may be one solution of any problem but it is not a simplified solution. The simplified solution is A= x-1. It is one example only and you may show why.
See you