Showing posts with label beta. Show all posts
Showing posts with label beta. Show all posts

Sunday, March 12, 2023

Casio fx-CG50: Logistic Equation - Solving For Parameters From Two Data Points

Casio fx-CG50:  Logistic Equation - Solving For Parameters From Two Data Points



The Challenge



It can be a challenge, especially without a statistics software package or method like the maximum likelihood estimate, to fit data (x, p), to the curve:


p(x) = 1 / ( 1 + α * x^β ) = ( 1 + α * x^β )^-1



What happens if we just have two data points (x1, p1) and (x2, p2).  Then finding α and β turns into simpler task.   Either we find a quick estimate to extend to other data points or if we just have two data points, exact solutions.




Finding α and β



With the points (x1, p1) and (x2, p2), the system to solve is:


1 / ( 1 + α * x1^β ) = p1

1 / ( 1 + α * x2^β ) = p2


1 + α * x1^β = 1/p1

1 + α * x2^β = 1/p2


α * x1^β = 1/p1 - 1

α * x2^β = 1/p2 - 1 


Assuming that α ≠ 0, divide both equations to get:


x1^β / x2^β = (1/p1 - 1) / (1/p2 - 1)


Solve for β:


(x1/x2)^β = (1/p1 - 1) / (1/p2 - 1)


ln [ (x1/x2)^β  ] = ln [ (1/p1 - 1) / (1/p2 - 1) ]


β * ln [ (x1/x2) ] = ln [ (1/p1 - 1) / (1/p2 - 1) ]


β = ln [ (1/p1 - 1) / (1/p2 - 1) ] / ln [ (x1/x2) ] 


Then we can get α:  


α = (1/p1 - 1) / (x1^β) = (1/p2 - 1) / (x2^β) 




Casio fx-CG50 Program:  BETPARAM

(276 bytes)


The characters α and β are found in the CHAR sub menu (outside of the PRGM menu).  If you have a monochrome calculator or just don't want color, ignore the color commands.


The program then graphs the resulting equation.   The variables Y1 and Y2 (with the bold Y) represent functions of X.  

 


Red "P(X)=1÷(1+αX^β)"

"SOLVE FOR α, β"◢

Rad

"POINT 1"

"X1"?→Y

"P1"?→Q

"POINT 2"

"X2"?→Z

"Y2"?→R

ln ((Q^-1 -1)÷(R^1 - 1))

Ans÷ln (Y÷Z)→B

(Q^-1 - 1)÷(Y^B)→A

ClrText

Blue Locate 1,3,"EST. PARAMETERS"

Locate 1,4,"α="

Locate 5,4,A

Locate 1,5,"β="

Locate 5,5,B

"1÷(1+A×X^B)"→Y1

""→Y2

SetG-Color Green,1

DrawGraph

ZoomAuto



Examples


Example 1:

(x1, p1) = (0.5, 0.76)

(x2, p2) = (1.5, 0.70)





Example 2:

(x1, p1) = (3/2, 5/8)

(x2, p2) = (2/3, 3/8)






Source:


Sumpter, David.  The Ten Equations That Rule the World: And How You Can use Them Too.  Flatiron Books: New York.  2021.  ISBN 978-1-250-24696-7



Eddie



All original content copyright, © 2011-2023.  Edward Shore.   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. 


Friday, May 7, 2021

HP Prime Firmware Update (Beta) - Python Becomes Available

 HP Prime Firmware Update (Beta) - Python Becomes Available 


Special thanks to go the HP Calculator Team for the new updates for the HP Prime. 


What's New?


This is not an all-inclusive list. (All screen shots are from the 5/5/2021 firmware).


*  Polynomial Roots Wizard.  Path:  [ Toolbox ], ( CAS ), 6.  Polynomial, 7.  Polynomial roots wizard.   We can calculate either the roots of a polynomial or build a polynomial from their roots.  For the 5/5/21 update, the graph on the polynomial appears for any polynomial with real coefficients.


*  Probability Wizard:  Calculate and draw probability distributions for the Normal (z), Student (t), ChiSquare ( χ^2), Fisher (F), and Geometric.  Path:  [ Toolbox ], ( Math ), 5. Probability, 4. Prob Wizard


Both wizards can be accessed no matter what App is running. :) 

*  Intelligent Math:   When checked in the Home options, certain calculations return exact results.   I will probably have this turned on at all times.



*  Save and Load States:  You can save the contents of the Home screen, settings, inputs, results, home variables, user variables, and lists. 

*  Python Programming App. (Micropython) There are two main screens.  [ Symb ] brings up the editor and [ Num ] brings up the terminator.  In the current firmware, we can have more than one script, but pressing [ Num ] will import all the scripts automatically.   I anticipate heavy use of the def-return structures.  In the future I am going to include python scripts to be used with the HP Prime.

Modules Available (5/5/2021 firmware) (not an all inclusive list):
* array
* math
* cmath
* ustruct
* utimeq
* urandom
* cas  (HP Prime exclusive, I think) 
* hpprime (HP Prime exclusive)
* linalg
* matplotl
(and more)


Firmware Available

4/28/2021:

Connectivity Kit (Beta)
Emulator (Beta)
Calculator Firmware for both G1 and G2 (hardware) (Beta):


5/5/2021:

Calculator Firmware only:

Copy this into File Explorer (Windows)
ftp://ftp.hp.com/pub/calculators/Prime/

I'm not sure if the above method work for MacOS (at this time).  TI-Planet (see link below) also has a direct download.  

Documentation

A thread on the 4/28/2021 update (MoHPC):


 Here is a thread on the 5/5/2021 update (MoHPC):


Discussion on TI-Planet (French, can be translated into English):



Any further updates will be posted as they come.  

Eddie

All original content copyright, © 2011-2021.  Edward Shore.   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. 

Earth's Radius by Latitude

Earth's Radius by Latitude Introduction: Calculating the Earth’s Radius In quick, general calculations, we assume that the...