Showing posts with label guest post. Show all posts
Showing posts with label guest post. Show all posts

Monday, February 14, 2022

Casio fx-5800P: Convert to Fractions by Pierre Gillet

 Casio fx-5800P: Convert to Fractions by Pierre Gillet


The program on this blog entry are created and authored by Pierre Gillet.   Gratitude for his permission to post this on my blog.  The program FRAC will show successful approximations of fractions.  Note, the program uses 30 additional registers by the DimZ command.  


Take it away, Pierre.


Casio fx-5800P FRAC and Notes


    Casio fx-5800P:

    "FRAC":

    ?X : Abs(X)->Z

    30->DimZ : 0->W

    Lbl 1    

    W+1->W

    Int(Z)->Z[W]

    Z[W]->R : 1->S

    For W-1->I TO 1 Step -1

    R->T

    Z[I]*R+S->R : T->S

    Next

    Cls : Locate 1,1,R

    Locate 1,2,"÷"

    Locate 2,2,S

    Locate 1,3,"="

    Locate 2,3,R/S

    Locate 1,4,R/S-Abs(X)◢

    1/Frac(Z)->Z

    Goto 1


Notes:


    ⦁ ?X is allowed on the fx-5800P:   When executed, the last value of X is shown which can be accepted or replaced. It doesn't work for the Casio graphing calculators. 

    ⦁ The program works with the absolute value of X

    ⦁ The program uses 30 DimZ extra memories (from Z[1] to Z[30]) by default; If it's not enough, it will display "Dimension ERROR"

    ⦁ The program pauses displays pauses after each step, displaying 4 lines per step, until it suits you:

        ⦁ Numerator

        ⦁ Denominator

        ⦁ Result of the division of Numerator by Denominator

        ⦁ Absolute error, compared to absolute value of X

For example, at the 4th step with X=Pi, the program will display:


        ⦁ 355

        ⦁ ÷113

        ⦁ =3.14159292

        ⦁ 2.6676418x10^-7


    ⦁ The fx-5800P doesn't allow "A=";A  to display "A=8"  (if A=8) 


BUT you can bypass this using Locate <Column>, <Row>, <String or Variable>

For example, in order to display "A=8"  (if A=8)  at the beginning of the first row of the display, do:


    ⦁ Locate 1,1,"A="

    ⦁ Locate 3,1,A



Examples


0.675 -> 27/40 after 4 steps  


2.08080808 -> 26,010,101/12,500,000 with approximately 0 difference


1.37456356 -> 1,812,138/1,318,337  with approximately 0 difference 



Thank you to Pierre Gillet.


Eddie 


All original content copyright, © 2011-2022.  Edward Shore.  Programs provided by Pierre Gillet with permission, © 2022.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author. 


Monday, January 17, 2022

Casio fx-5800P: Lambert Function by Pierre Gillet

Casio fx-5800P: Lambert Function by Pierre Gillet


The programs on this blog entry are created and authored by Pierre Gillet. Gratitude for his permission to post this on my blog.


Introduction


The Lambert function is defined as:


    w = W(x) where  w * e^w = x


W(x) is the inverse of y = x * e^x: so, W(x) * e^(W(x)) = x and W(x * e^x)=x

In all cases, x must be >= -1/e to get a real value of W(x)

For x>=0, there’s only one value of W(x), called W0(x) (« principal branch »   of W(x))

For x<0, two values of W(x) are possible : W0(x) and W-1(x)

In all cases, W0(x) >= -1 and W-1(x) < = -1


The set of programs presented use W(x) to solve equations such as:

    x^x = a

    log x = x - 1

    a^x = b - x

where a and b are real constants.  


The trick to solve these kinds of equation is to transform them into the form

    f(x) * e^f(x) = constant

Then comes

    W(f(x) * e^f(x)) = W(constant)

    f(x) = W(constant) (remember that W(x * e^x) = x)

and then you normally solve easily for x but still have to calculate the above W(constant)


You can calculate W(p) (where p is constant) with the efficient Newton’s method solving the equation x * e^x – p = 0:

To get W0(p) : 

    if -1/e <= p <= 10 then x_0 = 0

    if p > 10  then x_0 = ln(p) – ln(ln(p))   (asymptotic behavior of W0(x))

To get W-1(p) :

    If -1/e <= p <= -0.1 then x_0 = -2

    if p > -0.1 then x_0 = ln(-p) – ln(-ln(-p))   (asymptotic behavior of W-1(x))

    Then iterate x_n = (x^2 + p * e^(-x)) / (x + 1)

      will normally converge to the desired W(p) value


See this post: 

https://math.stackexchange.com/questions/463055/approximation-to-the-lambert-w-function


Programs :


"W0FX"  // The program asks for x and displays W0(x) value (stored in W)

?X:0->G

X>10 => Ln(X)-Ln(Ln(X))->G

Prog "WSUB":W


"W-1FX"  // The program asks for x and displays W-1(x) value (stored in W)

?X:-2->G

X>-.1 => Ln(-X)-Ln(-Ln(-X))->G

Prog "WSUB":W


"WSUB"  // Subroutine called by W0FX and W-1FX

X<-e^(-1) => -1->G

10^(-10)->E:Lbl 1

(G^2+Xe^(-G))/(G+1)->W

Abs(G-W)<E => Return

W->G:Goto 1


Notes:

Precision is 1E-10 (see 10^(-10) in WSUB)

The first line in WSUB ensures Math error if X<-1/e


Note from Edward Shore:

?X is allowed on the fx-5800P:   When executed, the last value of X is shown which can be accepted or replaced.   It doesn't work for the Casio graphing calculators. 


Below is a graph of x*e^x vs. W_0 from W0FX and W_-1 from W-1FX, as created by the Desmos graphing app:




Examples


x^x = 2


    x * ln(x) = ln(2)    

    Let t = ln x (=>x = e^t)

    t * e^t = ln(2)

    W(t * e^t) = W(ln(2))

    t = W(ln(2))

    x= e^W(ln(2))


    Ln(2) is >= 0 => Only one value for W: on W0(x)

    Execute W0FX:

    Type ln(2) then EXE

    The program displays approx 0.4444 (ie W0(ln(2)))

    You are out of the program and now type e^(W)

    The machine displays approx 1.5596 (x value)



log x = x - 1


    x = 10^(x - 1)

    x = 10^x * 10^(-1)

    x = e^(x * ln(10)) * 10^(-1)

    x*e^(-x * ln(10)) = 10^(-1)

    -x * ln(10) * e^(-x * ln(10)) = -10^(-1) * ln(10)

    W(-x * ln(10) * e^(-x * ln(10))) = W(-10^(-1) * ln(10)

    -x * ln(10) = W(-10^(-1) * ln(10)

    x = -W(-10^(-1) * ln(10)) / ln(10)


    -10^(-1) * ln(10))) is < 0 => Two values for W : on W0(x) and W-1(x)

    Execute W0FX:

    Type -10^(-1) * ln(10) then EXE

    The program displays approx -0.3158 (ie W0(-10^(-1) * ln(10)))

    You are out of the program and now type -W / ln(10)

    The machine displays approx 0.1371 (first x value)


    Then Execute W-1FX:

    Press EXE (to keep the current value -10^(-1) * ln(10) in X)  (approx -0.2303)

    The program displays approx -2.3026 (ie W-1(-10^(-1) * ln(10)))

    You are out of the program and now type -W / ln(10)

    The machine displays approx 1 (second x value)


2^x = 11 - x


    Let t = 11-x (=>x = 11-t)

    2^(11 - t) = t

    2^11 * 2^(-t) = t

    2^11 * e^(-t * ln(2)) = t

    e^(-t * ln(2)) = t / (2^11)

    1 = t * e^(t * ln(2)) / (2^11)

    ln(2) = t * ln(2) * e^(t * ln(2)) / (2^11)

    2^11 * ln(2) = t * ln(2) * e^(t * ln(2))

    W(2^11 * ln(2)) = W(t * ln(2) * e^(t * ln(2))

    W(2^11 * ln(2)) = t * ln(2)

    t = W(2^11 * ln(2)) / ln(2)

    x= 11 - W(2^11 * ln(2)) / ln(2)


    2^11 * ln(2) is >= 0 => Only one value for W: on W0(x)

    Execute W0FX:

    Type 2^11*ln(2) then EXE

    The program displays approx 5.5452 (ie W0(2^11 * ln(2)))

    You are out of the program and now type 11 – W / ln(2)

    The machine displays approx 3 (x value)



What for numbers beyond 10^100 ?


Even for small values of the constants involved in an equation, you have        to calculate W(x) with rapidly astronomical arguments :


For example, with the equation 2^x = 1000 – x  (cf the 2^x = 11 – x case), you’d need to calculate W(2^1000 * ln(2)), causing overflow of most of the        calculators.


Here again, you can calculate W(p) (where p is constant) with the efficient        Newton’s method solving this time the equation ln(x) + x - ln(p) = 0, handling ln(p) instead of p:

To get W0(ln(p)): 

    x_0 = ln(p) – ln(ln(p))   (asymptotic behavior of W0(x))

Then iterate:  

x_n = x * (1 - ln(x) + ln(p)) / (x + 1)

will normally converge to W0(p)


Additional programs


"W0FLNX"  // The program asks for ln(x) and displays W0(x) value (stored in W)

?X:0->G

X-Ln(X)->G

Prog "WSUBLN":W


"WSUBLN"  // Subroutine called by W0FLNX

10^(-10)->E:Lbl 1

G(1-Ln(G)+X)/(G+1)->W

Abs(G-W)<E => Return

W->G:Goto 1


Notes:

If p is an excessively large number then W0FLNX asks for ln(p) and returns W0(p). Enter ln(p) in a good way : for example, not ln(10^1000) but 1000 * ln(10)

2nd line in W0FLNX: "X - Ln(X)" is in fact ln(p) - ln(ln(p)) since you entered ln(p) in X


Example


2^x = 1000 - x


    Solution : x = 1000 - W0(2^1000 * ln(2)) / ln(2) 

    (cf the Solve 2^x = 11 - x case)


    2^1000 * ln(2) is >= 0 => Only one value for W: on W0(x)

    2^1000 * ln(2) > 10^100 so you can’t execute W0FX


    Note that ln (2^1000 * ln(2)) = 1000 * ln(2) + ln(ln(2))


    Execute W0FLNX:

    Type 1000 * ln(2) + ln(ln(2))  then EXE

    The program displays approx 686.2494  (ie W0(2^1000 * ln(2)))

    You are out of the program and now type 1000 - W / ln(2)

    The machine displays approx 9.9514 (x value)



Thank you to Pierre Gillet.


Eddie 


All original content copyright, © 2011-2022.  Edward Shore.  Programs provided by Pierre Gillet with permission, © 2022.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author. 


Thursday, February 2, 2017

eCalc Scientific Calculator (Guest Post: Christine of Web Technology USA)

Today’s post is a guest post from Christine of Web Technology USA ( http://www.webtechnologyusa.com/ ), and she is going to talk about their online scientific calculator which can be downloaded, the eCalc.  I played with the eCalc and it is really nice and well organized. 

Christine, thank you for emailing me and allowing me to share.   Much appreciated.

Take it away, Christine.


Eddie

--------------------------------------------------------------------------------

eCalc Scientific Calculator
(by Christine of Web Technology USA)

Screen shot of eCalc, provided by Christine - Thanks

On the 21st century where nearly everything can be processed online, each device may now have its web-based counterpart. And calculators are no exemption. From the Abacus of 2000 BC to the Arithmometer of 18th century, the evolution of this device has been in sync with the times. Coming into the scene is eCalc, a readily available software that is offered as both online calculator and as a downloadable application.

eCalc is a free and easy to use scientific calculator that supports many advanced features including unit conversion, equation solving, and even complex-number math. This application operates in either algebraic input or Reverse Polish Notation (RPN). The algebraic input is the default mode which is widely used by most handheld calculators. RPN, on the other hand, is a stack-based notation where operators are designed to follow their operands.

Data entry on this calculator is quite straightforward. This is achieved by the use of a graphical button or through traditional keyboard keys. In fact, the user is given the option to use either input method which are both equally valid. However, due to the limited amount of space available for graphical button placements, some trigonometric functions are limited to computer keyboard entry only. Aside from certain basic functions, all hyperbolic trigonometric functions need to be entered by typing their keywords accordingly.

eCalc is divided into two sections: the scientific calculator interface on the left and the calculator pallet on the right. The pallet houses a display area for special features such as Unit Converter, Constants Library, Equation Solver, Polynomial Solver, Base Conversion, and Decimal to Fraction Conversion.

Another notable feature of eCalc is “stack”. This particular attribute is inherent providing the user a way to view a history of results. Although the stack displays only 4 items at once, one can scroll up and down the stack by clicking the up and down arrow above it. A user even has the option to “pop” down a value currently existing in the stack into the input field of the calculator by clicking on the down arrows to the left of the line in the stack.

Simple yet robust, eCalc can solve other forms of mathematical equations be it basic or complex placing it a notch above battery-powered handheld calculators. And due to its nature being a standalone software, it is capable of being updated with future possible functionalities.

 eCalc Scientific Calculator is available for Windows Desktop and Mac OS X Dashboard.


--------------------------------------------------------------------------------


This blog is property of Edward Shore, 2017.

HP 15C: The I Squared Rule and HHC 2026

HP 15C: The I Squared Rule and HHC 2026 HHC 2026 Videos Before we start, the videos for HHC 2026 are up! Please take a look, ev...