Tampilkan postingan dengan label algebra. Tampilkan semua postingan
Tampilkan postingan dengan label algebra. Tampilkan semua postingan

HP Prime: Reversing an Integer's Digits

HP Prime:  Reversing an Integer's Digits


(Inspired by the HHC 2022 programming contest)


What Should I Add To Reverse the Digits?


Let A, B, C, D, and E be individual digits (0-9) of an integer.   AB would represent a two digit integer with the value of 10 * A + B.  ABC would represent a three digit integer with the value of 100 * A + 10 * B + C.


Reversing a Two Digit Integer


AB + # = BA

10 * A + B + # = 10 * B + A

# = 9 * (B - A)


Example:  Let AB = 76.

A = 7, B = 6

# = 9 * (6 - 7) = -9

76 - 9 = 67


Reversing a Three Digit Integer


ABC + # = CBA

100 * A + 10* B + C + # = 100 * C + 10 * B + A

# = 99 * (C - A)


Example:  ABC = 469

# = 99 * (9 - 4) = 495

469 + 495 = 964


Reversing a Four Digit Integer


ABCD + # = DCBA

1000 * A + 100 * B + 10 * C + D + # = 1000 * D + 100 * C + 10 * B + A

# = 999 * (D - A) + 90 * (C - B)


Example:  ABCD = 7219

# = 999 * (9 - 7) + 90 * (1 - 2) = 1908

7219 + 1908 = 9127


Reversing a Five Digit Integer


ABCDE + # = EDBCA

10000 * A + 1000 * B + 100 * C + 10 * D + E + # =

10000 * E + 1000 * D + 100 * C + 10 * B + A 

# = 9999 * (E - A) + 990 * (D - B)


Example: ABCDE = 52693

# = 9999 * (3 - 5) + 990 * (9 - 2) = -13068

52693 - 13068 = 39625


Having the Calculator Do It


The program REVINT reverses the digits of an integer, up to 11 digits.   The program does not allow numbers that have non-zero fractional parts or integers more than 11 digits.  Instead of solving for # (see above), the program splits the integers into a list in reverse order, and uses list processing to get the final answer. 


HP Prime Program:  REVINT


Caution:  Integers that end or begin with zero may not return accurate results.   My suggestion is not use 0s with this program.  See examples below for more details.  


EXPORT REVINT(N)

BEGIN

// 2022-09-18 EWS

// reverse the integer N

// up to 12 digits

LOCAL D,P,A,I,M,L;

L:={};

P:=XPON(N);


// check size 

  IF P>11 THEN

  RETURN "TOO BIG";

  KILL;

  END;

 

// check type

  IF FP(N) THEN

  RETURN "NOT AN INTEGER";

  KILL;

  END;

   

D:=N;


// loop

  FOR I FROM P DOWNTO 0 DO

  A:=D/ALOG(I);

  L:=CONCAT({IP(A)},L);

  D:=D-IP(A)*ALOG(I); 

  END;

  

// rebuild 

M:=ΣLIST(MAKELIST(ALOG(X),X,P,0,−1)*L);

RETURN M; 

END;


Examples:


REVINT(4321) returns 1234


REVINT(56765) returns 56765   (56765 is a palindrome, reversing the digits results in the same number)


REVINT(42910) returns 1924 (01924 - be aware about integers ending or beginning with 0)


REVINT(67.28) returns "NOT AN INTEGER" (error)



Eddie


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


Proving Chebyshev Polynomial Closed Formulas for n = 0, n = 1, and n = 2

Proving Chebyshev Polynomial Closed Formulas for n = 0, n = 1, and n = 2



Chebyshev Polynomials of the First Kind


Recurrence Definition:


T_0(x) = 1

T_1(x) = x

T_n+1(x) = 2 * x * T_n(x) - T_n-1(x)


Closed Definition:


T_n(x) = 1/2 * [ (x - √(x^2 - 1))^n + (x + √(x^2 - 1))^n ]


Let: w = √(x^2 - 1)


T_n(x) = 1/2 * [ (x - w)^n + (x + w)^n ]


n = 0

T_0(x) 

= 1/2 * [ (x - w)^0 + (x + w)^0 ]

= 1/2 * [ 1 + 1 ] 

= 1


n = 1

T_1(x)

= 1/2 * [ (x - w)^1 + (x + w)^1 ]

= 1/2 * [ x - w + x + w ]

= 1/2 * [ 2 * x]

= x


n = 2

T_2(x)

= 1/2 * [ (x - w)^2 + (x + w)^2 ]

= 1/2 * [ x^2 - 2*w + w^2 + x^2 + 2*w^2 + w^2 ]

= 1/2 * [ 2 * x^2 + 2 * w^2 ]

= x^2 + x^2 - 1

= 2 * x^2 - 1



Chebyshev Polynomials of the Second Kind


Recurrence Definition:


U_0(x) = 1

U_1(x) = 2 * x

U_n+1(x) = 2 * x * U_n(x) - U_n-1(x)


Closed Definition:


U_n(x) = [ (x + √(x^2 - 1))^(n + 1) - (x - √(x^2 - 1))^(n + 1) ] ÷ [ 2 * √(x^2 - 1) ]


Let: w = √(x^2 - 1)


U_n(x) = [ (x + w)^(n + 1) - (x - w)^(n + 1) ] ÷ [ 2 * w ]


n = 0

U_0(x)

= [ (x + w)^(1) - (x - w)^(1) ] ÷ [ 2 * w ]

= [ x + w - x + w ] ÷ (2 * w)

= (2 * w) ÷ (2 * w)

= 1


n = 1

U_1(x)

= [ (x + w)^(2) - (x - w)^(2) ] ÷ [ 2 * w ]

= [ (x^2 + 2 * x * w + w^2) - (x^2 - 2 * x * w + w^2) ] ÷ (2 * w)

= [ 4 * x * w ] ÷ (2 * w)

= 2 * x


n = 2

U_2(x)

= [ (x + w)^(3) - (x - w)^(3) ] ÷ [ 2 * w ]

= [ x^3 + 3*x^2*w + 3*x*w^2 + w^3 - (x^3 - 3*x^2*w + 3*x*w^2 - w^3)] ÷ [ 2*w ]

= [ x^3 + 3*x^2*w + 3*x*w^2 + w^3 - x^3 + 3*x^2*w - 3*x*w^2 + w^3] ÷ [ 2*w ]

= [ 6*x^2*w + 2*w^3 ] ÷ [ 2*w ]

= [ 6*x*√(x^2 - 1) + 2*(x^2 - 1)^(3/2) ] ÷ [ 2*√(x^2 - 1)  ]

= [ 6*x*√(x^2 - 1) + 2*(x^2 - 1)*√(x^2- 1) ] ÷ [ 2*√(x^2 - 1)  ]

= [ 6*x*√(x^2 - 1) + 2*(x^2 - 1)*√(x^2- 1) ] ÷ [ 2*√(x^2 - 1)  ]

= [ 6*x*√(x^2 - 1) + (2*x^2 - 2)*√(x^2- 1) ] ÷ [ 2*√(x^2 - 1)  ]

= [ (8*x - 2)*√(x^2 - 1) ] ÷ [ 2*√(x^2 - 1)  ]

= 4*x^2 - 1


Good that the closed formulas hold up, at least for n = 0, 1, 2.   The closed formulas would be good if you don't want to use recurrence relations.  


Sources:


"Chebyshev polynomials"  Wikipedia.   https://en.wikipedia.org/wiki/Chebyshev_polynomials  Last Updated July 20, 2022.  Last Accessed June 21, 2022


Oldman, Keith, Jan Myland, & Jerome Spainer  An Atlas of Functions: with Equator, the Atlas Function Calculator  2nd Edition   Springer:  New York, NY.  2009  ISBN 978-0-387-48806-6


Eddie


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


Quick Tip: Determining the Characteristics of a Quadratic Equation

Quick Tip:   Determining the Characteristics of a Quadratic Equation


Introduction


For our algebra and college pre-calculus students, here is a quick way to tell whether the quadratic equations 


A * x^2 + B * x + C = 0


has real roots or complex roots (in the form of a + bi or r*e^(Θi)).  The simple way is to calculate the discriminant.


The discriminant of the quadratic equation is B^2 - 4 * A * C.   


If B^2 > 4 * A * C, or B^2 - 4 * A * C > 0, the roots are real and distinct


If B^2 = 4 * A * C, or B^2 - 4 * A * C = 0, there is a repeated root


If B^2 < 4 * A * C, or B^2 - 4 * A * C < 0, the roots are complex


(A, B, C are real numbers)



Examples


3 * x^2 - 6 * x + 81 = 0

B^2 = 36

4 * A * C = 972

36 < 972

The roots are complex  (1 ± i√26)


4 * x^2 + 44 * x - 318 = 0

B^2 = 1936

4 * A * C = -5088

1936 > -5088

The roots are real and distinct ( (-11 ±√439)/2 )


-3 * x^2 - 6 * x - 5

B^2 = 6

4 * A * C = 60

6 < 60

The roots are complex ( (-3 ± i√6)/ 3)



A Study 


If we let A = 1 and B and C range of integers through -5 to 5, if we pick a quadratic equation from random we find that:


25.62% of the equations have complex roots

4.13% has a repeated root

70.25% has two distinct real roots


Here is the Google Sheet that has the study:  

https://docs.google.com/spreadsheets/d/1ZKAR1dtnHAss1CzxqygHCIB3Mq2u2fn3TLR3espUUXM/edit?usp=sharing



Hope this helps,


Eddie 


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


Logit and Sigmoid Functions and its Calculus

Logit and Sigmoid Functions and its Calculus



Definitions


The sigmoid function is defined as:


sigmoid(x) = 1 ÷ (1 + e^(-x))


The logit function is defined as:  


logit(p) = ln (p ÷ (1 - p))


For logit(p) to have a real number answer, 0 ≤ p < 1



Transform from the Sigmoid Function to the Logit Function


We can easily transform from the sigmoid function to the logit function.  


Let s = sigmoid(x). Then:


s = 1 ÷ (1 + e^(-x))

s * (1 + e^(-x)) = 1

s + s * e^(-x) = 1

s * e^(-x) = 1 - s

e^(-x) = (1 - s) ÷ s

e^x = s ÷ (1 - s)

x = ln(s ÷ (1 - s)) = logit(s)


To transform from the logit function to the sigmoid function, just go backwards.  



Sigmoid Function:  Derivative and Integral


Derivative


s = sigmoid(x)

s = 1 ÷ (1 + e^(-x))


Using the quotient rule of derivatives:

ds/dx = [(1 + e^(-x)) * 0 - 1 * -e^(-x)] ÷ (1 + e^(-x))^2

= -(-e^(-x)) ÷ (1 + e^(-x))^2

= -e^(-x) ÷ (1 + e^(-x))^2



Integral


s = sigmoid(x)

s = 1 ÷ (1 + e^(-x))


Multiply both sides by e^x ÷ e^x:


s * (e^x ÷ e^x) = (e^x ÷ e^x) * (1 ÷ (1 + e^(-x)))

s = e^x ÷ (e^x + 1)


Integral:

∫ e^x ÷ (e^x + 1) dx


Let u = e^x + 1.  Then du = e^x dx 

= ∫  du ÷ (u + 1) 

= ln (u + 1) + C

= ln (e^x + 1) + C


Summary:

d/dx sigmoid(x) = -e^(-x) ÷ (1 + e^(-x))^2

∫ sigmoid(x) dx = ln (e^x + 1) + C



Logit Function:  Derivative and Integral


Derivative


logit(p) = ln (p ÷ (1 - p))

L = ln (p ÷ (1 - p))


Derivative:

dL/dp =  [(1 - p) ÷ p] * d/dp ln (p ÷ (1 - p))

=  [(1 - p) ÷ p] * [(1 - p) * 1 - p * (-1)] ÷ [(1 - p)^2] 

=  [(1 - p) ÷ p] * [1 - p + p] ÷ [(1 - p)^2]

=  [(1 - p) ÷ p] * 1 ÷ (1 - p)^2

= 1 ÷ [p * (1 - p)]


Integral:

∫ ln (p ÷ (1 - p)) dp


By integration by parts:

u = ln (p ÷ (1 - p)) 

du = 1 ÷ [p * (1 - p)] dp


v = dp

v = p


Then:

∫u dv

= p * ln ( p ÷ (1 - p)) - ∫ p ÷ (1 - p) dp

= p * ln ( p ÷ (1 - p)) + ∫ -p ÷ (1 - p) dp

= p * ln ( p ÷ (1 - p)) + ln(1 - p) + C


In Summary:

d/dp logit(p) = 1 ÷ [p * (1 - p)]

∫ logit(p) dp = p * ln ( p ÷ (1 - p)) + ln(1 - p) + C


Eddie


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


Rationalizing a Quadratic Polynomial

Rationalizing a Quadratic Polynomial


Problem


Rewrite the Quadratic Polynomial 1 + A*x + B*x^2 as a rational function of polynomials.  A and B are real numbers (however, this should work if A and B were complex numbers).  


1 + A*x + B*x^2 → p(x) / q(x)


Attempt 1:  1 + A*x + B*x^2 → (1 + C*x) / (1 + D*x)


1 + A*x + B*x^2 = (1 + C*x) / (1 + D*x)

(1 + A*x + B*x^2) * (1 + D*x) = (1 + C*x) / (1 + D*x) * (1 + D*x)

A*x + B*x^2 + D*x + A*D*x^2 + D*B*x^3 = C*x


Comparing the powers of x:


constant:  0 = 0

x:  A + D = C

x^2:  B + A*D = 0

x^3:  B*D = 0


This leads to either B=0 or D=0


Assume B=0. 

Then B + A*D = 0

A*D = 0


If A=0, then D = C, which leads to:

1 + A*x + B*x^2 = (1 + C*x) / (1 + D*x)

1 = (1 + C*x) / (1 + C*x)

1 = 1


If D=0, then A = C

1 + A*x + B*x^2 = (1 + C*x) / (1 + D*x)

1 + C*x = (1 + C*x) 


If D=0, then B=0, and we get the same results as above.   


Ultimately this transformation to (1 + C*x) / (1 + D*x) leads to nothing useful.


Attempt 2:  1 + A*x + B*x^2 → (1 + C*x^2) / (1 + D*x)

 

1 + A*x + B*x^2 = (1 + C*x^2) / (1 + D*x)

(1 + A*x + B*x^2) * (1 + D*x) = 1 + C*x^2 

(A + D)*x + (B + A*D)*x^2 + B*D*x^3 = C*x^2


Comparing the powers of x:


constant:  0 = 0

x:  A + D = 0

x^2:  B + A*D = C

x^3:  B*D = 0


A + D = 0 implies that A = -D or D = -A


Also either B = 0 or D = 0.


Assume B = 0. Then with A = -D:

A*D = C

-D*D = C

C = -D^2


1 + A*x + B*x^2 = (1 + C*x^2) / (1 + D*x)

1 -  D*x = (1 - D*x^2) / (1 + D*x)

1 -  D*x = ((1 - D*x) * (1 + D*x))/ (1 + D*x)

1 - D*x = 1 - D*x


If we assume that D = -A, then:

C = -A^2 and

1 + A*x = (1 - A*x^2) / (1 - A*x)

1 + A*x = ((1 - A*x)  * (1 + A*x)) / (1 - A*x)

1 + A*x = 1 + A*x


Assume D = 0.

Then A = 0 and B = C:

1 + B*x^2 = 1 + B*x^2

1 + C*x^2 = 1 + C*x^2


Again, we have transformations that are trivial.


Attempt 3:  1 + A*x + B*x^2 → (1 + C*x^3) / (1 + D*x)


1 + A*x + B*x^2 = (1 + C*x^3) / (1 + D*x)

(1 + A*x + B*x^2) * (1 + D*x) = 1 + C*x^3

(A + D)*x + (B + A*D)*x^2 + B*D*x^3 = 1 + C*x^3


Comparing the powers of x:


constant:  0 = 0

x:  A + D = 0

x^2:  B + A*D = 0

x^3:  B*D = C


This implies that:

A + D = 0

D = -A


B + A*D = 0

B+ A*-A = 0

B = A^2   (this restricts A and B)


B * D = C

(A^2)*(-A) = C

C = -A^3


We can conclude that B = A^2, C = -A^3, D = -A


The relationship between A, B, C, and D are all connected in this case.


Examples:


A = 2 ⇒ B = 4, C = -8, D = -2 and

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


A = -2 ⇒ B = 4, C = 8, D = 2 and

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



Note:  Casio fx-991EX Week - September 5, 2022 to September 9, 2022 


Eddie


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


TI 84 Plus CE and HP 33S: Scaled Data for Statistics

TI 84 Plus CE and HP 33S:  Scaled Data for Statistics


Introduction and the Mathematics


The goal of the programs posted today is to take a data set of real numbers and scale it down to the range [1,10].  Why?  Sometimes scaling data by applying a linear transformation, it could make curve fitting and data analysis more accessible and open up regression analysis previously not available, such as logarithmic or power regression.   


Let:


max = maximum value of the data set

min = minimum  value of the data set


And:


min * a + b = 1

max * a + b = 10


Solving for a and b:


a = 9/(max - min)

b = 1 - a * min = 10 - a * max


Apply this transformation to the data set to get:


x' = a*x + b


And to convert back:


x = (b - x')/a



TI-84 Plus CE Program:  DSCALE   (TI-Basic)


Disp "DATA SCALE TO [1,10]","BY EDWARD SHORE"

Input "XLIST: ",L5

9/(max(L5)-min(L5))→A

1-A*min(L5)→B

Disp "FORMULA:","X'="+toString(A)+"X+"+toString(B)

Pause

A*L5+B→L6

Disp "SCALED DATA:"

Pause L6


Note:

L5:  List 5, used for input, [ 2nd ] [ 5 ]

L6:  List 6, used for output, [ 2nd ] [ 6 ]


HP 33S Programs


LBL Y:  determine A and B.  Stack:  Y:  max, X:  min

HP 33S Size:  LN = 72, CK = B830


Y0001  LBL Y

Y0002  -

Y0003  LASTx

Y0004  x<>y

Y0005  1/x

Y0006  9

Y0007  ×

Y0008  STO A

Y0009  VIEW A

Y0010  ×

Y0011  1

Y0012  x<>y

Y0013  -

Y0014  STO B

Y0015  VIEW B

Y0016  RTN


LBL X:  Calculate x'

HP 33S Size:  LN = 15, CK = 08B6


X0001  LBL X

X0002  RCL- B

X0003  RCL÷ A

X0004  STOP

X0005  GTO X    // this allows for repeated calculations by pressing R/S


LBL Z:  Calculate x

HP 33S Size: LN = 15, CK = 4552


Z0001  LBL Z

Z0002  RCL× A

Z0003  RCL+ B

Z0004  STOP

Z0005  GTO Z   // this allows for repeated calculations by pressing R/S


Instructions:

1.  Do this first:  max [ ENTER ] min [ XEQ ] Y  

2.  XEQ Z  to calculate X'.  XEQ X to calculate X'. 


X' = A * X + B


Example


Data Set:  [-5, -3, 2, 3, 6]


max = 6

min = -5


(results are rounded to six decimal places)

a = 0.818182

b = 5.090909


Translated Data: 


x to x':

x = -5,  x' = 1.000000

x = -3,  x' = 2.636364

x = 2, x' = 6.727273

x = 3, x' = 7.545455

x = 6, x' = 10.000000


x' to x:

x' = 2.5, x = -3.16667

x' = 5,  x = -0.111111

x' = 7.5, x = 2.944444


Hope you find this helpful.  Next week is a retro review of the HP 33S Calculator, once abhorred now held as valuable.  


Eddie


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


Converting a Line in Parametric Line to a Function Line

Converting a Line in Parametric Line to a Function Line 


From (x(t), y(t)) to y(x)


Express a line, presented in parametric form:


x = A * t + B

y = C * t + D


where A, B, C, and D are constants, and convert it to function form (y(x) or f(x)).


Here is one way to do this:


x = A * t + B

A * t = x - B

t = x / A - B / A


y = C * (x / A - B / A) + D

y = (C/A) * x - B*C/A + D

y = (C/A) * x + (D - B*C/A)


We know have a function in the slope-intercept form where:


slope = C/A


intercept = D - B*C/A


Casio fx-4000P Program:  Converting Parametric Lines to Functional Line

Size:  77 bytes

(line breaks added for readability)


"X=AT+B; A":

?→A:

"B":

?→B:

"Y=CT+D; C":

?→C:

"D":

?→D:

"SLOPE="⊿

C÷A→M⊿

"ITC="⊿

D-B×M→I


Examples


Graph screens are created by the Numworks emulator:  https://www.numworks.com/simulator/


Example 1:

x = 3 * t  - 4 

y = 2 * t + 8


A = 3, B = -4, C = 2, D = 8


Results:

SLOPE = 0.666666667

ITC = 10.66666667






Example 2:

x = -2 * t + 6

y = 4 * t + 3


A = -2, B = 6, C = 4, D = 3


Results:

SLOPE = -2

ITC = 15





Hope you find this useful.  Take care,


Eddie 


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


The Sum and Product of Roots of a Quadratic Equation

The Sum and Product of Roots of a Quadratic Equation


Introduction


Let s, t be the roots of the equation a*x^2 + b*x + c = 0.


Let:


s = (-b + √(b^2 - 4*a*c)) / (2 * a)

t = (-b - √(b^2 - 4*a*c)) / (2 * a)


Then


s + t = -b / a

s * t = c / a


We see this topic a lot in algebra, let's see how these properties are derived. Fairly simple.  


Sum of the Roots


s + t

=  (-b + √(b^2 - 4*a*c)) / (2 * a) + (-b - √(b^2 - 4*a*c)) / (2 * a)

= (-2 * b) / (2 * a)

= -b / a


Product of the Roots


s * t 

=  (-b + √(b^2 - 4*a*c)) / (2 * a) * (-b - √(b^2 - 4*a*c)) / (2 * a)

= (b^2 + b * √(b^2 - 4*a*c) - b * √(b^2 - 4*a*c) - (b^2 - 4*a*c)) / (4*a^2)

= (b^2 - b^2 + 4*a*c) / (4*a^2)

= (4*a*c) / (4*a^2)



Eddie



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


Population vs Standard: Deviation and Covariance

 Population vs Standard: Deviation and Covariance



Population Deviation vs Standard Deviation


How is the population deviation related to the standard deviation?


Population Deviation (of a data set x_i):


σx = √( Σ(x_i - mean(x)) / n)


where mean(x) is the arithmetic mean of the data set over x_i


Standard Deviation:


sx = √( Σ(x_i - mean(x)) / (n - 1))


n is the size of the data set x_i.  


Suppose we can calculate the standard deviation by multiplying a factor (let's call it ß for the purpose of this example) to the population deviation.   


ß * σx = sx


ß * √( Σ(x_i - mean(x)) / n) = √( Σ(x_i - mean(x)) / (n - 1))


ß  * √( Σ(x_i - mean(x))) /  √n = √( Σ(x_i - mean(x))) / √(n - 1)


ß * √( Σ(x_i - mean(x)))  / √( Σ(x_i - mean(x))) = √n / √(n - 1)


ß  = √n / √(n - 1)


ß  = √(n/(n - 1))


Hence:


sx =  √(n/(n - 1)) * σx


and


σx = sx * √((n-1)/n)



Example:


x = {4, 7, 10, 16, 38}   

n = 5


σx = 12.16552506

sx = 12.16552506 * √(5/4) = 13.60147051



Population Covariance vs Standard Covariance


For the data sets x_i and y_i, population covariance:


cov_σ = 1/n * Σ((x_i - mean(x)) * (y_i - mean(y)))


And the sample covariance:


cov_s = 1/(n - 1) * Σ((x_i - mean(x)) * (y_i - mean(y)))


We will use the similar tactic above to find a relationship between population covariance and sample covariance:


ß * cov_σ = cov_s


ß * 1/n * Σ((x_i - mean(x)) * (y_i - mean(y))) = 

1/(n - 1) * Σ((x_i - mean(x)) * (y_i - mean(y)))


ß * Σ((x_i - mean(x)) * (y_i - mean(y))) / Σ((x_i - mean(x)) * (y_i - mean(y))) =

n/(n - 1)


ß = n/(n - 1)



Hence:


cov_ s = n/(n - 1) * cov_σ 


and


cov_σ = (n - 1)/n * cov_s



Example:


x = {4, 5, 6, 8}

y = {-2, -1, 2, 0}

n = 4


mean(x) = 5.75

mean(y) = -0.25


cov_σ = 1.1875

cov_s = 1.1875 * 4/3 = 1.5833333333


Hope you find this helpful,


Eddie 


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


Backlink 9999 Traffic Super

Order Now...!!!!