Showing posts with label logic. Show all posts
Showing posts with label logic. Show all posts

Saturday, July 1, 2023

Sharp EL-9300C Program Bank

Sharp EL-9300C Program Bank







Time for some retro-programming.  



Random Integers:  pickint


REAL Mode


Print "Pick n integers"

Print "(a,b)"

Input a

Input b

Input n

Label loop

num=ipart ((b-a+1)random)

Print num

Wait

n=n-1

If n≠0 Goto loop


Example:  Pick 5 integers from 100 to 999. 

a = 100,  b = 999,  n = 5

Results:  num = 487, 834, 587, 486, 617 (results will vary)



Binary Integer Arithmetic:  binbool


NBASE Mode


ClrT

0→bin

Rem switch to binary

Rem must use global

Print "binary int 1"

Input X

Print "binary int 2"

Input Y

ClrT

Print "and (1/4)"

Q=X and Y

Print Q

Print "or (2/4)"

R=X or Y

Print R

Wait

Print "nand (3/4)"

S=not(X and Y)

Wait

Print "xor (4/4)"

T = X xor Y

Print T

End


Example:

X = 111011

Y =  000111


Results:

(and)

Q = 0000 0000 0000 0011

(or)

R = 0000 0000 0001 1111

(nand)

S = 1111 1111 1111 1100

(xor)

T = 0000 0000 0001 1100



Distance Between Two Spheres:  distsph


REAL Mode


ClrT

Print "Distance between"

Print "two spheres"

Print "Sphere 1"

Rem 2ndF number in test

Input x₁

Input y₁

Input z₁

Input r₁

Print "Sphere 2"

Input x₂

Input y₂

Input z₂

Input r₂

dist=√((x₁-x₂)²+(y₁-y₂)²+(z₁+z₂)²)-r₁-r₂

Print "Distance="

Print dist

End



Example:

Sphere 1:  (80, 0, 60), radius 5

Sphere 2:  (14, -5, 20), radius 10

Result:  62.3369252



Draw Lines:  drawlines


REAL Mode


Rem 2ndF number

Rem A and B are orig pts.

ClrG

Range -10,10,1,-10,10,1

Print "Draw a polygon"

Print "A = x₀"

Input A

Print "B = y₀"

Input B

xa=A

ya=B

Plot A,B

Label loop1

Print "Orig. (A,B)"

Input xi

Input yi

t=0

Lable loop2

x=(1-t)*xa+t*xi

y=(1-t)*ya+t*yi

Plot x,y

t=t+.02

If t<0 Goto loop2

xa=xi

ya=yi

Print "0=no 1=yes"

Input more

If more≠0 Goto loop1

DispG


To return to the original point, set xi = A ([ALPHA] [2ndF] A) and yi = B ([ALPHA] [2ndF] B).


Example:  

Draw a polygon of points (0,8), (3,5), (0,-3), (-2, 3).






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. 


Saturday, June 3, 2023

Carnival of Mathematics # 216

Carnival of Mathematics # 216



Welcome to a special edition of Eddie's Math and Calculator Blog.  I am once again happy to host the Carnival of Mathematics, which this is the 216th Edition.  The Carnival of Mathematics is facilitated by The Aperiodical.   

Check out the monthly series, where you can also submit articles for future carnival articles, at https://aperiodical.com/carnival-of-mathematics/.

May 2023's Carnival was hosted by Cassandra from Cassandra Lee Yieng's Blog:  https://leeyieng.wordpress.com/2023/05/01/carnival-of-mathematics-215-april-2023/

July 2023's Carnival will be hosted by Vaibhav at Double Root.  Double Root's blog:  https://doubleroot.in/

Gratitude to Ioanna Georgiou for the invitation to host once again.    




The Number 216


In a regular, non-leap year, the 216th day of the calendar is August 4.  On leap years, the 216th day is August 3. 


The digital root of 216 is 9.  (2 + 1 + 6 = 9).


The prime factorization of 216 is 2^3 * 3^3.   Note that 216 = 6^3.  


The divisors of 216 are:  1, 2, 3, 4, 6, 8, 9, 12, 18, 24, 27, 36, 54, 72, 108, and 216.  The sum of the proper divisors are 384, making 216 an abundant number.  


216 hours is 9 days exactly.


216 can be expressed as sums and differences of powers, including:


216 = 3^5 - 3^3

216 = 2 * 10^2 + 4^2

216 = 12^2 + 9^2 - 3^2

216 = 4^4 - (6^2 + 2^2)

216 = 8^3 - (14^2 + 10^2)



The Carnival


Thank you to everyone who submitted an article.  You can submit entries at https://aperiodical.com/carnival-of-mathematics/.



SineRider 


This is a really cool game about mathematics.  The goal is to set a curve so that the snow-people successfully pass through a designated number of gates.  At first, the curves are linear but they get more challenging as the game goes on.  The game also saves your progress. (Screen shots are from the game.)






View Hack Club's intro video on Youtube:  https://www.youtube.com/watch?v=35nDYoIwiA8


Play the game here:  https://sinerider.com/




The Game of Hex:  Submitted by Massimo Dacasto





The game of Hex has two players.  The goal is to connect a string of hexagons from one side to the opposite side.  Each player claims a hexagon with their own color, such as red and blue.  The game of Hex is featured in the 1980s game show Blockbusters.  


The web page Hall of Hexagons is a gallery of moves a player can make to guarantee themselves a connection over a set number of rows.  Check out the gallery here:  https://www.drking.org.uk/hexagons/hex/templates.html.




Peirce's Law:  Jon Awbrey of the Inquiry Into Inquiry blog


This article explains Pierce's Law and provides the proof of the law.  The proof is provided in two ways:  by reason and graphically.  Simply put, for propositions P and Q, the law states:


P must be true if there exists Q such that the statement "if P then Q" is true.  In symbols:


(( P ⇒ Q) ⇒ P) ⇒ P


Article:  https://inquiryintoinquiry.com/2008/10/06/peirces-law/


The law is an interesting tongue twister to say the least.




Praeclarum Theorema:  Jon Awbrey of the Inquiry Into Inquiry blog



Jon Awbrey provides an explanation and proof of the Praeclarum Theorema, also known as the Splendid Theorem, which states:


For statements a, b, c, and d:  


((a ⇒ b) ^ (d ⇒ c)) ⇒ ((a ^ d) ⇒ (b ^ c))


Article:  https://inquiryintoinquiry.com/2008/10/05/praeclarum-theorema/



A Spiral on the Brighton Seafront:  Sam Hartburn


The place is the Brighton Seafront in Brighton, UK.  On the sea front there is a spiral of poles, which is the ratio of radii of the large circle to small circle is about the Golden Ratio ( (1 + √5) ÷ 2 ).   


See this spiral here:  https://samhartburn.co.uk/sh/maths-tourism-a-spiral-on-brighton-seafront/



Green's Windmill & Science Centre


In another travel related article, Tom, an Education Officer and blog writer of mathematics and astronomy, reviews the Green's Windmill and Science Centre in Nottingham, UK.  By the picture posted on Tom's post, this is a place I would like to visit one day.   Tom praises the Windmill for giving vision to the mathematics behind windmills, including displaying an integral equation related to electricity and magnetism:  


∫ dσ V dU/dw + ∫ dx dy dx V δU = ∫ dδ U dV/dw + ∫ dx dy dz U δV


The blog entry also features the work of George Green, a British mathematician.   


Tom's Blog Entry:  https://tommaths.blogspot.com/2023/05/greens-windmill-science-centre-museum.html


Green's Mill and Science Centre's Web Site:  https://tommaths.blogspot.com/2023/05/greens-windmill-science-centre-museum.html



Golden Integration:  John D. Cook


Speaking of the Golden Ratio, John d. Cook demonstrates Monte Carlo integration but instead of using a purely random sequence, a pseudo-random sequence using the fractional values of n * φ, where φ = ( (1 + √5) ÷ 2 ).  The method is demonstrated using Python.


Article:  https://www.johndcook.com/blog/2023/04/29/golden-integration/


Monte Carlo integration has an advantage of ease of calculation, with a cost of having to sample a large amount of points to get an accurate answer.  




A Plan to Address the World Challenges With Math:  Kevin Harnett of Quanta Magazine


The article is an interview with mathematician Minhyong Kim, Director of the International Centre of Mathematical Sciences (ICMS) in Edinburgh, Scotland.  The goal is ICMS is to focus mathematics with humanitarian studies. 


In the article, Kim emphasizes that young mathematicians want to work in diverse fields outside the traditional subjects.  


Article:  https://www.quantamagazine.org/a-plan-to-address-the-worlds-challenges-with-math-20230511/


Web page for ICMS:  https://www.icms.org.uk/


The ICMS's web page for The Mathematics for Humanity program, which has recently launched:  https://www.icms.org.uk/funding-opportunities/mathematics-humanity



Hamilton's Quaternions, or, The Trouble with Triples:  Article by James Propp


Math with a romantic story between William Rowan Hamilton and Catherine Barlow.  Hamilton's infatuation for Barlow lasted, despite the fact that Barlow was married to another man.   Barlow's son needed a tutor in mathematics, and Hamilton was the man to call.  While Hamilton was tutoring her son, he and Barlow discussed Barlow's unhappy marriage.   


Propp then details who Hamilton and Barlow first met, along with the math of quaternions in detail.  


A quaternion is defined an extended complex number represented in the form


q1 * i + q2 * j + q3 * k + q4, with q1, q2, q3, and q4 are real numbers.


When multiplying quaternions the following rules are observed:


i^2 = j^2 = k^2 = -1

i * j = k,   j * i = -k

j * k = i,   k * j = -i

k * i = j,   i * k = -j


The article:  https://mathenchant.wordpress.com/2023/05/17/hamiltons-quaternions-or-the-trouble-with-triples/



Degree of ζ(3)


Here is a stack exchange talking about the integral representation of ζ(3)  (Riemann Zeta function of 3).  As of June 2, 2023, the post has the option question regarding a degree of a group of permutations.   


The open question:  https://math.stackexchange.com/questions/4703662/degree-of-zeta3-as-a-period




I would like to thank everyone who submitted articles for the Carnival of Mathematics.  Gratitude to the Aperiodical for having me as this month's host.   


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. 


Wednesday, September 4, 2013

XOR vs Addition, AND vs Multiplication



Hi everyone!

In this blog post, all numbers with a "b" after them are designated binary numbers. (the extra zeroes in front are for illustration purposes only)

XOR vs Addition

The logical operator XOR and addition may be very similar, but they are not the same.

Examples:

1101b + 0110b = 10011b but 1101b XOR 0110b = 1011b
1001b + 0011b = 1100b but 1001b XOR 0011b = 1010b

Truth table for XOR (Exclusive OR):
1 XOR 1 = 0
1 XOR 0 = 1
0 XOR 1 = 1
0 XOR 0 = 0

XOR is like addition if we let 0 represent an even number and 1 represent an odd number:
odd + odd = even
even + odd = odd
odd + even = odd
even + even = even

AND vs Multiplication

Likewise, the logical operator AND and multiplication may be very similar, but they are not the same.

Examples:
1101b × 0010b = 11010b but 1101b AND 0010b = 0000b
1100b × 1110b = 10101000b but 1100b AND 1110b = 1100b

Truth table for AND:
1 AND 1 = 1
1 AND 0 = 0
0 AND 1 = 0
0 AND 0 = 0

And likewise, AND is like addition if we let 0 represent an even integer and 1 represent an odd integer:
odd × odd = odd
odd × even = even
even × odd = even
even × even = even

Hopefully this clears any confusion up between arithmetic and two logic gates sometimes labeled as arithmetic. As always, love any comments and thanks as always.

Eddie


This blog is property of Edward Shore. 2013

RPN HP 12C: Fibonacci and Lucas Sequences

  RPN HP 12C: Fibonacci and Lucas Sequences Golden Ratio, Formulas, and Sequences Let φ be the Golden Ratio: φ = (1 + √5) ÷ 2...