0% found this document useful (0 votes)
8 views82 pages

Python For The Ti84 Powerful Python Programs And Games For The Ti84 Plus Ce Graphing Calculator Practical And Fun Python Programming For Calculators John Craig download

Ebook installation

Uploaded by

viskubpasso
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views82 pages

Python For The Ti84 Powerful Python Programs And Games For The Ti84 Plus Ce Graphing Calculator Practical And Fun Python Programming For Calculators John Craig download

Ebook installation

Uploaded by

viskubpasso
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 82

Python For The Ti84 Powerful Python Programs And

Games For The Ti84 Plus Ce Graphing Calculator


Practical And Fun Python Programming For
Calculators John Craig download
https://ebookbell.com/product/python-for-the-ti84-powerful-
python-programs-and-games-for-the-ti84-plus-ce-graphing-
calculator-practical-and-fun-python-programming-for-calculators-
john-craig-50783112

Explore and download more ebooks at ebookbell.com


Here are some recommended products that we believe you will be
interested in. You can click the link to download.

Python For The Nspire Powerful Python Programs And Games For The
Tinspire Tm Cx Ii Technology Calculator Craig

https://ebookbell.com/product/python-for-the-nspire-powerful-python-
programs-and-games-for-the-tinspire-tm-cx-ii-technology-calculator-
craig-34389970

Python For The Life Sciences A Gentle Introduction To Python For Life
Scientists Alexander Lancaster Gordon Webster

https://ebookbell.com/product/python-for-the-life-sciences-a-gentle-
introduction-to-python-for-life-scientists-alexander-lancaster-gordon-
webster-36155304

Python For The Life Sciences A Gentle Introduction To Python For Life
Scientists 1st Edition Alexander Lancaster

https://ebookbell.com/product/python-for-the-life-sciences-a-gentle-
introduction-to-python-for-life-scientists-1st-edition-alexander-
lancaster-43425662

Python For Data Science The Latest Guide For The Novice Data Scientist
Learn The Principles Of Python Language To Analyze And Manage Data
Machine Learning And Scikitlearn Sections Included William Dimick

https://ebookbell.com/product/python-for-data-science-the-latest-
guide-for-the-novice-data-scientist-learn-the-principles-of-python-
language-to-analyze-and-manage-data-machine-learning-and-scikitlearn-
sections-included-william-dimick-232316884
Essential Python For The Physicist 1st Edition Giovanni Moruzzi

https://ebookbell.com/product/essential-python-for-the-physicist-1st-
edition-giovanni-moruzzi-11109812

Python For Beginners A Practical Guide For The People Who Want To
Learn Python The Right And Simple Way John Snowden

https://ebookbell.com/product/python-for-beginners-a-practical-guide-
for-the-people-who-want-to-learn-python-the-right-and-simple-way-john-
snowden-22487584

Python For Casio Calculators Powerful Python Programs And Games For
The Casio Fxcg50 And Fx9750giii Calculators Craig

https://ebookbell.com/product/python-for-casio-calculators-powerful-
python-programs-and-games-for-the-casio-fxcg50-and-fx9750giii-
calculators-craig-46317172

Dead Simple Python Idiomatic Python For The Impatient Programmer


Converted Jason C Mcdonald

https://ebookbell.com/product/dead-simple-python-idiomatic-python-for-
the-impatient-programmer-converted-jason-c-mcdonald-46507694

Numerical Methods With Python For The Sciences William Miles

https://ebookbell.com/product/numerical-methods-with-python-for-the-
sciences-william-miles-49178872
Python for the TI-84

Powerful Python
programs and games
for the TI-84 Plus CE Python graphing calculator

by

John Clark Craig


Table of Contents

Acknowledgements

Introduction
Programs

1. Calendar Functions

CALENDAR
DATE
DATEPLUS
DAYSDATS
JULIAN

2. Electronics

AVGPKRMS
BRIDGE
DELTAWYE
FREQWAVE
LED_RES
OHMSLAW
PARALLEL
RCTIMING
SERIES
ZROUND

3 Games and Chance

DECKCRDS
DICE
DIGITS
FACTCBPM
HEADSROW
HUNT_DIR
HUNT_DIS
JUMBLE
MAZE
MEMORY
MNTYHALL
PI_BUFFN
PI_DARTS
RNDMBYTE
WORDPERM

4. GPS and Navigation

GPS_AREA
GPS_DIST
MIDPOINT
NAVIGATE

5. Money and Finance

DEPOSITS
FUTURVAL
INTEREST
MONTHS
PAYMENTS
PRNCIPAL

6. Numerical Calculations

BINHXDEC
BINSRCH
FACTORS
FIBONACC
GCD_LCM
GLDRATIO
NEWTON
PRIMES
QUADRATC
REC_POLR
SIMULTEQ
VECTORS

7. Other Useful Programs

CONCRETE
CRICKETS
LASERDIS
MPH
SECRET
WAIT_KEY
WET_BULB
WNDCHILL

8. Plane Geometry

ARCS
AREA_3P
AREA_3S
AREA_PTS
CIRCLE3P
DISTANCE
DIVLINE
LINE_2P
LINSLOPE
TRANSFRM
TRIANG3P
TRIANGLE

9. Space Geometry

COORD_3D
DIVLIN3D
ROTATE3D
TRIANG3D
VOLUME4P

10. Space Sciences


GEOSYNC
MOON
PENNIES
RADIOISO
RELATVTY
SPACEANG
STN_GRAV
SUN_ELEV
SUBSOLAR

About the Author

Other Books By John Clark Craig


Introduction

Why Python?

Python, the world's most popular programming language, is an ideal


language for handheld calculators. The syntax is concise, easy to read, and
easy to understand, even for beginners. The language is non-proprietary, so it
runs everywhere, even on desktop and laptop computers with only minor
modifications from what you'll find in this book, and even then only in a very
few cases.

Python handles number crunching well, and with its lists, strings, and
other data structures, it powerfully handles a very wide variety of
programming tasks. But perhaps the biggest advantage of learning Python via
your programmable calculator is that this knowledge will be applicable and
useful no matter what computers or systems you might work with in the
future. Learn it once and you'll have a new life skill of great value.

Python in your calculator

Most of the number crunching that takes place in Python programs is


straightforward and easy to understand. When it comes to interacting with the
user to request input and output (commonly referred to as I/O) there are some
optional approaches, and understanding some of these make it easier for you
to make shorter programs, or longer but more user friendly programs,
depending on your style and programming goals. The programs in this book
use several of these approaches, and it's important to know that you can
change these programs if you prefer one type of programming over another.

An excellent way to leverage Python in your calculator is to simply


define functions in a "program" file. When you run the program, nothing
visibly happens. But the function definitions are effectively added to your
calculator's toolbox, ready for your use while working in the shell. For
example, here's a very short program that defines a function named add().

def add(x,y):
return x+y
After you run this program, in the shell you can type something like
"add(3,4)" to get 7, or to add any two numbers or variables together. Or,
rather than type the function names yourself, on your TI-84 CE Plus Python
calculator, you can select "4:vars..." from the [Tools] menu to access a quick
list of functions your program has defined. More complicated functions can
add some powerful new capabilities to your computation toolbox!

Many of the programs in this book were created as sets of function


definitions in this way. This keeps the programs very short and easier to
enter. In some cases, the programs also printed some instructions and
reminders on how to use the functions, for easy reference. Take a look at the
vectors program near the end of chapter 6 for a good example of how to add
helpful instructions, while just defining functions for later use in the shell.

The standard way to create standalone programs in most programming


languages is to prompt the user for input data, and then to process that data in
a meaningful way to create output for the user. Throughout this book there
are several programs where you are asked to type data in response to a
prompt at run time, and then the calculations begin. Take a look at the primes
program, also in chapter 6, for an example where the program asks you to
enter the starting point to look for primes, and the number of those primes to
find.

There are a few other useful I/O tricks presented in several of the
programs in this book. It is sometimes useful to ask for a number, but to let
the user simply press [enter] without entering a number if they don't know the
value. This is actually a tricky thing to do, as a simple assignment to a
variable after an input() function call can fail if nothing is input. Take a close
look at the program ARCS, in chapter 8 for an example where any
combination of two of four variables can be entered, and the missing ones
will be calculated. Here's a pair of code lines where an angle is entered, or a
value of zero is put in place if the user simply presses [enter].

a=input("Angle (deg): ")


a=float(a) if a else 0
Finally, note that the Python shell itself provides a powerful calculation
environment. Rather than edit and save a program, sometimes it's faster and
more efficient to simply type calculations line-by-line interactively in the
shell. Several of the keys on your TI-84 Plus CE Python calculator are
redefined when in the Python environment, and learning how to leverage
them can provide some really cool results. For example, the [2nd][ans] key
enters an underscore in the Python shell, and it turns out the underscore is a
special temporary variable that contains the results of the last calculation.
Here's a quick example that results from first entering 3 and pressing the x-
squared key, then using [2nd][ans] to triple the result.
Learn by Examples

There are many, many resources online and in other books to learn the
intricacies of the Python language. The goal of this book isn't to duplicate all
this information. Instead, there's a lot of short, useful programs that you can
use "right out of the box", and in putting them to use you'll learn a lot about
Python indirectly.

If you are looking for an absolute beginner's tutorial to help you get up to
speed with programming in Python on your TI-84 Plus CE Python calculator,
there's an excellent web site by Texas Instruments titled "10 Minutes of
Code: Python". I strongly recommend taking a look at these skill building
lessons. Here is the link:

https://education.ti.com/en/activities/ti-codes/python/84

Whenever you find a command that looks a little mysterious, I strongly


suggest you Google it for more information. In my opinion, this is a better
way to learn a lot of Python programming techniques, by using and
experiencing the commands in action.

For example, it took me awhile to stumble upon Python's useful zip()


function. I used it several places in the vectors program to create extremely
concise and powerful vector functions. Do a Google search on "Python zip",
learn how it works, and then you'll gain a really good understanding of how
several of the vector functions work for 2d, 3d, or even bigger vectors.

Any TI-84 calculator is a very powerful learning tool, but with the
addition of Python in your TI-84 Plus CE Python calculator, its mind-
expanding capabilities are truly awesome!
1.
Calendar Functions

How old are you today?

Next time someone asks you this question, you can answer with the exact
number of days rather than just rounding off to the number of years. Then, to
impress them even more, be sure to casually mention the day of the week you
were born.

These are the types of questions the programs in this chapter will let you
answer with ease.
CALENDAR

This program creates a nice one-month, single-page calendar for any


month over a several-century period of time.

At the heart of this program is a function that returns the Julian Day
Number for any date in the range of years from 1582 to 4000. This function,
named jd(), is explained in more detail later in this chapter, but here it is used
to determine the number of days in any given month, and the day of the week
for any date. From this information we can format all the days in a given
month into an easy-to-read one-month calendar.

Wilbur and Orville Wright's first heavier than air flight took place on the
morning of December 17, 1903, at Kitty Hawk, North Carolina. We can run
this program to see the full one-month layout of December, 1903 and easily
determine that the 17th was a Thursday.
import ti_plotlib as plt

def jd(m,d,y):
if m<3:
y-=1
m+=12
a=int(y/100)
b=2-a+int(a/4)
e=int(365.25*(y+4716))
f=int(30.6001*(m+1))
return b+d+e+f-1524.5

# Get month and year


m=int(input("\nMonth (1-12): "))
y=int(input("Year (1582-4000): "))
d1=int(jd(m,1,y))
dw=(d1+2)%7
m2=m+1 if m<12 else 1
y2=y if m<12 else y+1
d2=int(jd(m2,1,y2))
dm=d2-d1
mo=["Jan","Feb","Mar","Apr","May","Jun",
"Jul","Aug","Sep","Oct","Nov","Dec"]

# Month, Year caption


plt.cls()
s="{} {}".format(mo[m-1],y)
plt.text_at(3,s,"center")

# Days of the week


s="Su Mo Tu We Th Fr Sa"
plt.text_at(4,s,"center")

# Prep first row


s=" "*(3*dw-1) if dw else ""

# Rows of day numbers


r=5
for d in range(1,dm+1):
ds=len(s)
if ds==20:
plt.text_at(r,s,"center")
s="{:2d}".format(d)
r+=1
elif ds:
s+="{:3d}".format(d)
else:
s+="{:2d}".format(d)
s+=" "*20
plt.text_at(r,s[:20],"center")
plt.show_plot()
DATE

This program uses the Julian Day Number function to calculate the day of
the week and the day of the year for a date in the range of years from 1582 to
4000. The jd() function is described in more detail elsewhere in this chapter.

For example, December 17, 1903 (the day Orville and Wilbur made their
first heavier-than-air flight) was a Thursday, and it was the 351st day of the
year, as shown in the following output in the Python Shell..

The day of the year is found by subtracting the Julian Day Number for
December 31 of the previous year from the selected day's Julian Day
Number.

def jd(m,d,y):
if m<3:
y-=1
m+=12
a=int(y/100)
b=2-a+int(a/4)
e=int(365.25*(y+4716))
f=int(30.6001*(m+1))
return b+d+e+f-1524.5

m=int(input("\nMonth (1-12): "))


d=int(input("Day (1-31): "))
y=int(input("Year (1582-4000): "))
dj=int(jd(m,d,y))
dn=(dj+2)%7
dw=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]
print("\n{}/{}/{}\n".format(m,d,y))
print("Day of week: ",dw[dn])
dy=dj-int(jd(12,31,y-1))
print("Day of year: ",dy)
DATEPLUS

This program calculates a date that is a given number of days added to a


starting date. For example, the Wright brother's first flight occurred on
December 17, 1903. What was the date 40,000 days in the future from that
day? As shown in the output, June 22, 2013 is the date "way out in the future"
from the day people first took to the air.

In case you're wondering, yes you can add a negative number of days to
find an earlier date.

To perform this calculation the starting date is converted to its Julian Day
Number using the jd() function, the number of days is added to create a
second Julian Day Number, and the mdy() function converts that number
back to a date. The Julian Day Number automatically takes care of leap years,
varying numbers of days in the months, and all those details. These two
functions are described in more detail in the julian.py program in this chapter.
from math import *

def jd(m,d,y):
if m<3:
y-=1
m+=12
a=int(y/100)
b=2-a+int(a/4)
e=int(365.25*(y+4716))
f=int(30.6001*(m+1))
return b+d+e+f-1524.5

def mdy(jd):
z=int(jd+.5)
f=jd+.5-z
if z<2299161:
a=z
else:
t=int((z-1867216.25)/36524.25)
a=z+1+t-int(t/4)
b=a+1524
c=int((b-122.1)/365.25)
g=int(365.25*c)
e=int((b-g)/30.6001)
d=int(b-g-int(30.6001*e)+f)
if e<14:
m=e-1
else:
m=e-13
if m>2:
y=c-4716
else:
y=c-4715
return [m,d,y]

m=int(input("\nMonth (1-12): "))


d=int(input("Day (1-31): "))
y=int(input("Year (1582-4000): "))
n=int(input("\nNumber of days: "))
m,d,y=mdy(jd(m,d,y)+n)
print("\n{0}/{1}/{2}\n".format(m,d,y))
DAYSDATS

How many days will you have been on the Earth on your next birthday?
This kind of question is easy to answer with this program. Two dates are
input, they are converted to Julian Day Numbers, and the difference between
them is output as the number of days between the two dates.

The jd() function is at the core of this program. It is described in more


detail in the julian.py program presented in this chapter.

The sample calculation finds the number of days from the day Orville and
Wilbur made their first flight ( December 17, 1903) and the date of Y2K, or
January 1, 2000. The result is 35,079 days to be exact.
def jd(m,d,y):
if m<3:
y-=1
m+=12
a=int(y/100)
b=2-a+int(a/4)
e=int(365.25*(y+4716))
f=int(30.6001*(m+1))
return b+d+e+f-1524.5

print("\nFirst date")
m1=int(input("Month (1-12): "))
d1=int(input("Day (1-31): "))
y1=int(input("Year (1582-4000): "))
print("\nSecond date")
m2=int(input("Month (1-12): "))
d2=int(input("Day (1-31): "))
y2=int(input("Year (1582-4000): "))
nd=int(abs(jd(m1,d1,y1)-jd(m2,d2,y2)))
print("\n{}/{}/{}".format(m1,d1,y1))
print("{}/{}/{}".format(m2,d2,y2))
print("Days between: ",nd)
JULIAN

This program demonstrates two functions that are very useful for a
variety of calendar calculations. All other programs in this chapter use one or
both of these functions.

jd() calculates the Julian Day Number for a given date in the year range
1582 to 4000. This is an absolute day number used by astronomers and others
to clearly designate the sequence for each day, without regard to leap years
and other such complications.

Note that for historical reasons, each astronomical day begins at noon
Greenwich time, so there's an extra ".5" on these Julian Day Numbers. In the
programs presented here we add and subtract whole days to find relative
dates, and this extra fractional part doesn't really matter. For astronomical
calculations this fractional part does become important.

The mdy() function provides a way to convert a Julian Day Number back
to a triplet of numbers for the month, day, and year for that date. This makes
it easy to add and subtract days to get a new date accurately, without having
to do any complicated adjustments for the number of days in each month, or
for leap years.

The example code inputs a date and outputs its Julian Day Number. Next,
any Julian Day Number is input and the calendar date for that day is output.
As shown, December 17, 1903 has Julian Day Number 2,416,465.5 and
Julian Day Number 2,500,000.5 will fall on September 1 in the year 2132.
from math import *

def jd(m,d,y):
if m<3:
y-=1
m+=12
a=int(y/100)
b=2-a+int(a/4)
e=int(365.25*(y+4716))
f=int(30.6001*(m+1))
return b+d+e+f-1524.5

def mdy(jd):
z=int(jd+.5)
f=jd+.5-z
if z<2299161:
a=z
else:
t=int((z-1867216.25)/36524.25)
a=z+1+t-int(t/4)
b=a+1524
c=int((b-122.1)/365.25)
g=int(365.25*c)
e=int((b-g)/30.6001)
d=int(b-g-int(30.6001*e)+f)
if e<14:
m=e-1
else:
m=e-13
if m>2:
y=c-4716
else:
y=c-4715
return [m,d,y]

m=int(input("\nMonth (1-12): "))


d=int(input("Day (1-31): "))
y=int(input("Year (1582-4000): "))
j=jd(m,d,y)
print("\nJulian Day: ",j)
j=float(input("\nJulian Day: "))
m,d,y=mdy(j)
print("{0}/{1}/{2}".format(m,d,y))
2.
Electronics

This chapter presents a sampling of useful programs for doing various


electronics calculations. The author has used these and similar calculations
when inventing some fun gadgets, such as a bicycle brake light that requires
no wiring, you just stick it on your bike or helmet and ride! It uses an
accelerometer and some fun program code to get rid of bumps and rotations
while detecting braking and putting on a bright brake light. (LucidBrakes™)

Whether you are experimenting with Arduinos, Raspberry Pis, or creating


your own circuits at the component level, these calculations can come in very
handy.
AVGPKRMS

Homes in the United States are supplied with electrical power in the form
of a sine wave with an effective voltage of about 117 volts. This effective
voltage provides the same power in watts to a resistive load as would a DC
voltage of 117 volts. Effective voltage is also called RMS, which stands for
"Root-Mean-Squared", because of the way it is mathematically derived.

Most of the time we use the effective voltage value, because it is the
value that allows quick calculation of power to a circuit. But there are two
other ways to measure a sine wave voltage. The peak voltage, at the very top
point of the sine wave, provides a "Peak" voltage value, and the average
magnitude of the voltage over time, without regard to polarity, provides the
"Average" voltage value.

Here are the two main conversion equations. All the relationships
between Peak, Average, and RMS voltages can be figured out by
algebraically working with these two:

This program provides the conversions between these three ways to


describe a pure sine wave voltage. Enter the one known value when prompted
for it, and just press [enter] to skip the other two. The program determines
which value you've entered, calculates the other two, and outputs all three for
easy reference.

As shown in this sample run, a standard U.S. house wiring voltage of 117
V (RMS) has a peak voltage of about 165 V, and an average voltage over
time of about 105 V.

from math import *

def ac_voltages(avg,peak,rms):
if avg:
peak=pi*avg/2
rms=peak/sqrt(2)
elif peak:
avg=peak*2/pi
rms=peak/sqrt(2)
elif rms:
peak=rms*sqrt(2)
avg=peak*2/pi
return [avg,peak,rms]

print("\n\nInput one AC voltage type\n")


s=input("Average: ")
avg=float(s) if s else 0
s=input("Peak: ")
peak=float(s) if s else 0
s=input("RMS: ")
rms=float(s) if s else 0
avg,peak,rms=ac_voltages(avg,peak,rms)
print("\nAvg: ",avg)
print("Peak: ",peak)
print("RMS: ",rms)
BRIDGE

Balanced bridge circuits, also called Wheatstone bridges, are used in


electronics for precision measurements and for other purposes. A common
calculation is to find the value of one leg of a balanced bridge when the other
three legs are known. For example, in the following figure we can calculate a
value for R4 when R1, R2, and R3 are known. These values cause the
ammeter across the middle to read zero amps. Similarly, a voltmeter across
these same two nodes would read zero volts.

Here's the equation relating the four resistors:

Note that the bridge() function uses variables z1 to z3 instead of R1 to


R3. This is because of an awesome feature of Python, where a variable can
just as easily contain a complex number as it can a real number. In circuit
analysis, complex numbers are very useful for AC circuits containing
capacitors and inductors in addition to resistors. And yes, AC bridge circuits
do follow all the same math rules when working with these components,
using complex numbers for their respective impedances

The following example calculates the value of the 4th leg resistance when
the first three resistors are 2700, 3900, and 5600 ohms, and it solves a second
time for complex impedances of 4+3j, 5+0j, and 3-7j.

As shown, the 4th resistor in the first case should be approximately 3877
ohms, and the impedance in the second case should be 6.6-3.8j ohms.

def bridge(z1,z2,z3):
return z1*z3/z2

r1=2700
r2=3900 # opposite the unknown
r3=5600
r4=bridge(r1,r2,r3)
print("r1: ",r1)
print("r2: ",r2)
print("r3: ",r3)
print("bridge(r1,r2,r3): ",r4)

z1=4+3j
z2=5+0j # opposite the unknown
z3=3-7j
z4=bridge(z1,z2,z3)
print("z1: ",z1)
print("z2: ",z2)
print("z3: ",z3)
print("bridge(z1,z2,z3): ",z4)

The bridge() function is very small, just the first two lines of code. Most
of this program demonstrates calling the bridge() function twice, once to
solve for a pure resistive bridge, and a second time to balance a bridge
composed of complex value impedances.
DELTAWYE

When you run this program, nothing happens. Okay, a little explanation
is in order. As explained early in this book, a simple and straightforward way
to add powerful functions to your calculator is to simply define functions in a
program that you can use over and over while working on some relevant
problems. In this case, two functions are defined at run time, delta() and
wye(), and they remain in the shell ready for your use.

You can type in these functions along with the parentheses that follow
them, but a nice quick way to access them is to choose 4:Vars from the Tools
menu. Choose a function from the list that shows, then you'll be able to type
in its parameters.

The delta() function converts resistances in a wye configuration to an


equivalent delta configuration. The wye() function does the exact opposite
conversion to output a wye configuration equivalent to a delta delta
configuration you pass to it.
Both of these functions also work for complex number impedances, as
demonstrated in the examples. This is a powerful feature for more advanced
electronics analysis.

The delta configuration is called that because the three resistors are
arranged in a triangle, although circuit diagrams often show them in more of
a pi arrangement, as shown here on the left. Notice that if you "pull together"
the bottoms of RB and RC, a triangle, or "delta" is formed.

Similarly, the wye configuration is often shown as more of a "T"


arrangement, as shown here on the right. Just imagine the center point
between R1, R2, and R3 pulled down a bit and you'll see the "Y", or wye
shape.

The delta() function uses the following equations to find values for RA,
RB, and RC that form an equivalent set of resistances, or impedances, when
given R1, R2, and R3.
The wye() function uses the following equations to find values for R1,
R2, and R3 that form an equivalent set of resistances, or impedances, when
given RA, RB, and RC.
The first few lines of code in the program define these delta() and wye()
functions. I've added optional print() commands at the end of the listing to
remind you at runtime how to call each of them. This is a good way to self-
document functions that are defined, but not actually called at runtime.

def delta(z1,z2,z3):
tmp=z1*z2+z2*z3+z3*z1
return tmp/z1,tmp/z2,tmp/z3

def wye(za,zb,zc):
tmp=za+zb+zc
return zb*zc/tmp,za*zc/tmp,za*zb/tmp

print("\nDelta to Wye (R or Z)")


print("wye(za,zb,zc)")
print("\nWye to Delta (R or Z)")
print("delta(z1,z2,z3)\n")
Here's what is displayed immediately after the program is run to load the
functions into the shell. As you can see, no calculations actually take place
yet. The new functions are loaded and ready to go.

Here's the result of calling each function. In the first case we convert
resistances in a wye configuration of 300, 400, and 500 ohms to the
equivalent delta configuration. The result is about 1567, 1175, and 940 ohms.
The second call converts impedances of 4+3j, 5, and 3-7j ohms from a delta
configuration to equivalent wye values. The results are the complex values 2-
2.25j, 2.95-0.6j, and 1.125+1.625j ohms.
FREQWAVE

The electromagnetic spectrum covers a wide range of phenomena, such


as radio waves, x-rays, visible light, infra-red light, microwaves, and so on.
Each of these features falls into a band of frequencies, each frequency has a
specific wavelength, and they all travel in free space at the speed of light.

Frequency in hertz and wavelength in meters are the exact inverse of each
other. They are both a function of the speed of light. Here's the simplest
equation that ties all this together, where C is the speed of light:

Most of the time, wavelength and frequency are expressed in engineering


notation, where the power of ten is a multiple of three. This notation converts
easily to prefixes such as kilo, Mega, nano, and others, making it easier to
grasp the magnitude of the value. The first two functions in this program,
named logb() and eng(), work together to format numbers into engineering
notation with any desired number of significant digits. You might want to
isolate these functions into a file for use in other programs you create.

from math import *

def logb(x,b):
return log(x)/log(b)

def eng(x,d):
x=abs(x)
if x==0:
return "0.0"
exp=floor(logb(x,10))
mant=x/10**exp
r = round(mant,d-1)
x = r*pow(10.0,exp)
p = int(floor(logb(x,10)))
p3 = p//3
value=x/pow(10.0,3*p3)
s="{:f}".format(value)
if s[d]!=".":
s=s[0:d+1]
else:
s=s[0:d]
if p3!=0:
return "{}e{:d}".format(s,3*p3)
else:
return "{}".format(s)

c,f,w=299792458,0,0
print("\nEnter known value...")
f=input("Frequency: ")
f=float(f) if f else 0
if f==0:
w=input("Wavelength (m): ")
w=float(w) if w else 0
if w!=0:
f=c/w
if f!=0:
w=c/f
digits=5
print("\nFrequency:")
print("{} Hz".format(eng(f,digits)))
print("\nWavelength:")
print("{} meters".format(eng(w,digits)))

This program prompts for a frequency, then for a wavelength if you skip
frequency by pressing [enter] without entering a number. The unknown value
in either case is calculated, both values are formatted into engineering
notation, and the results are output to your calculator's display.

Two example runs are shown, the first where a frequency is the known,
and second where a wavelength is the known value. In the first example the
frequency of the Helium "People's Network" for the Internet of Things (IOT)
is entered to calculate its wavelength. 915 megahertz has a wavelength of a
little less than a third of a meter.
In this second example we skip the frequency input and then enter 5 to
calculate the frequency when the wavelength is exactly 5 meters. The
frequency is just a tad less than 60 megahertz.

Note that the variable named digits, near the end of the program, is set to
five. Change this value if you want higher or lower precision in your answers.
For easy reference, here's a list of the metric prefixes for the various
engineering notation powers of ten:
LED_RES

LEDs are awesome. Once you know how to power them properly, you
can light up all kinds of fun artwork, gadgets, and inventions in any color and
blinking patterns imaginable. For example, the author invented a brake light
for bicycles that requires no wiring to the brakes at all, instead relying on an
accelerometer chip to determine when to flash bright red LEDs to indicate
deceleration. Check out LucidBrakes online.

An LED is a special type of diode, where current flows easily in one


direction through it, and not in the other direction. To light up an LED you
need to use a resistor to limit the amount of current allowed to flow in the
"easy" direction. This program helps you calculate the size of that resistor. It
also helps determine the current and power requirements, to make sure no
magic smoke is emitted from anything!

The standard way to wire up an LED is with a resistor in series, and a


voltage source powering them both:
Here are the equations that tie together all the calculations we'll need in
the program, where Vs is the source voltage, Vf is the forward voltage across
the LED, Vr is the voltage across the resistor, i is is the current in amps
through everything, Wr is the watts of power in the resistor, and Wf is the
watts of power in the LED.
Here's the the program listing:

def led_resistor(Vs,Vf,i):
r=(Vs-Vf)/i
Rw=(Vs-Vf)*i
Lw=Vf*i
return [r,Rw,Lw]

def led_current(Vs,Vf,r):
i=(Vs-Vf)/r
Rw=(Vs-Vf)*i
Lw=Vf*i
return [i,Rw,Lw]

Vs=float(input("\nSource Vs: "))


Vf=float(input("LED Vf: "))
print("\nNow enter one of these two...")
i=input("\nCurrent in amps: ")
i=float(i) if i else 0
r=input("LED resistor in ohms: ")
r=float(r) if r else 0
if i:
r,Rw,Lw=led_resistor(Vs,Vf,i)
else:
i,Rw,Lw=led_current(Vs,Vf,r)
print("\nVs: ",Vs)
print("Vf: ",Vf)
print("R: {} ohms".format(r))
print("i: {} amps".format(i))
print("Rw: {} watts".format(Rw))
print("Lw: {} watts".format(Lw))

The following two example runs first find the approximate value for a
resistor when the current is known, and the second example calculates the
current when a standard resistor is selected for the circuit.

In both cases you enter the source voltage and the LED forward voltage
(this Vf varies for LED types), and then enter either the current in amps or the
resistor value in ohms.
For a circuit powered with 12 volts, an LED with a forward voltage drop
of 2.4 volts with 25 mA of current through it requires an approximate resistor
size of 384 ohms.

The next run, with a voltage source of 9 volts and an LED forward
voltage drop of 2.3 volts and a standard resistor value of 270 ohms, results in
a current of about 24.8 milliamps.
It's important not to burn out the resistor or the LED in your circuit.
Resistors have a stated wattage, and they'll be okay if Wres is less than this
value. In our example the resistor is heated with about 0.17 watts of power,
so a standard quarter watt (0.25 watts) resistor should work fine. LEDs have a
stated maximum current, which you can also check with these results.
OHMSLAW

The subject of electricity and electronics is full of equations and


formulas, but by far the two most important equations are what we call
"Ohm's Law". If you learn only how to work with the following two simple
equations, you'll know enough to be considered an electronics whiz by most
everyone you know.

The first equation states that voltage (Electromagnetic force) is equal to


current in amps (I) times resistance in ohms (R). The second equation states
that wattage (Power) is equal to current in amps times voltage.

It's easy to algebraically rearrange these two equations to calculate the


unknowns when any two values are known. This program prompts you to
enter any two of these four values, the other two quantities will be calculated,
and all four values will be output.

This program defines a function named ohms_law(), prints some


instructions for your review, and then stops. From then on you call the new
function to calculate all four values when any two are known.

You can type the names of the functions, or you can select them from the
Tools menu through the 4:Vars option.

For example, consider a 60 watt light bulb powered by standard


household 117 volts. Enter zeros for the two unknowns, current and
resistance, and the function will find these values. The current is about half
an amp, and the resistance of the bulb is about 228 ohms.

def ohms_law(p,i,e,r):
if p and i:
e=p/i
r=p/(i*i)
elif p and e:
i=p/e
r=(e*e)/p
elif p and r:
i=math.sqrt(p/r)
e=math.sqrt(p*r)
elif i and e:
p=i*e
r=e/i
elif i and r:
p=i*i*r
e=i*r
elif e and r:
p=(e*e)/r
i=e/r
else:
pass
return ([p,i,e,r])
print("\nohms_law(p,i,e,r)")
print("Pass two known values, and zeros")
print("for the other two unknowns.")
PARALLEL

Resistors in parallel can be replaced with a single equivalent resistor, a


technique often used in circuit analysis. The same equation works for
impedances in parallel too, so this one program works for resistances or
complex number impedances alike.

The equivalent resistance (or impedance) is calculated with the following


formula:

Here's a sketch showing how the multiple resistors are wired in parallel:

The program defines a function named parallel(), and prints two lines of
instructions. Note that a single list of values is passed to this function,
allowing any number of parallel resistances or impedances to be processed.
Just add two or more to the list and pass the list to this function. The example
shows how square brackets define a list.

def parallel(zlist):
zp=sum(1/z for z in zlist)
return 1/zp
Random documents with unrelated
content Scribd suggests to you:
Ga g a ,
From where the West yet kept a pallid star
To thinner sky where dawn was wearing through,
Hugh shrank with dread, reluctant to renew
The war with that serene antagonist.
More fearsome than a smashing iron fist
Seemed that vast negativity of might;
Until the frustrate vision of the night
Came moonwise on the gloom of his despair.
And lo, the foe was naught but yielding air,
A vacancy to fill with his intent!
So from his spacious bed he ‘rose and went
Three-footed; and the vision goaded him.

All morning southward to the bare sky rim


The rugged coulee zigzagged, mounting slow;
And ever as it ‘rose, the lean creek’s flow
Dwindled and dwindled steadily, until
At last a scooped-out basin would not fill;
And thenceforth ‘twas a way of mocking dust.
But, in that Hugh still kept the driving lust
For vengeance, this new circumstance of fate
Served but to brew more venom for his hate,
And nerved him to avail the most with least.
Ere noon the crawler chanced upon a feast
Of breadroot sunning in a favored draw.
A sentry gopher from his stronghold saw
Some three-legged beast, bear-like, yet not a bear,
With quite misguided fury digging where
No hapless brother gopher might be found.
And while, with stripéd nose above his mound,
The sentinel chirped shrilly to his clan
Scare-tales of that anomaly, the man
Devoured the chance-flung manna of the plains
That some vague reminiscence of old rains
Kept succulent, despite the burning drouth.
So with new vigor Hugh assailed the South,
His pockets laden with the precious roots
Against that coming traverse, where no fruits
Of herb or vine or shrub might brave the land
Spread rooflike ‘twixt the Moreau and the Grand.

The coulee deepened; yellow walls flung high,


Sheer to the ragged strip of blinding sky,
Dazzled and sweltered in the glare of day.
Capricious draughts that woke and died away
Into the heavy drowse, were breatht as flame.
And midway down the afternoon, Hugh came
Upon a little patch of spongy ground.
His thirst became a rage. He gazed around,
Seeking a spring; but all about was dry
As strewn bones bleaching to a desert sky;
Nor did a clawed hole, bought with needed strength,
Return a grateful ooze. And when at length
Hugh sucked the mud, he spat it in disgust.
It had the acrid tang of broken trust,
The sweetish, tepid taste of feigning love!

Still hopeful of a spring somewhere above,


He crawled the faster for his taunted thirst.
More damp spots, no less grudging than the first,
Occurred with growing frequence on the way,
Until amid the purple wane of day
The crawler came upon a little pool!
Clear as a friend’s heart, ‘twas, and seeming cool—
A crystal bowl whence skyey deeps looked up.
So might a god set down his drinking cup
Charged with a distillation of haut skies.
As famished horses, thrusting to the eyes
Parched muzzles, take a long-sought water-hole,
Hugh plunged his head into the brimming bowl
As though to share the joy with every sense.
And lo the tang of that wide insolence
And lo, the tang of that wide insolence
Of sky and plain was acrid in the draught!
How ripplingly the lying water laughed!
How like fine sentiment the mirrored sky
Won credence for a sink of alkali!
So with false friends. And yet, as may accrue
From specious love some profit of the true,
One gift of kindness had the tainted sink.
Stripped of his clothes, Hugh let his body drink
At every thirsting pore. Through trunk and limb
The elemental blessing solaced him;
Nor did he rise till, vague with stellar light,
The lone gulch, buttressing an arch of night,
Was like a temple to the Holy Ghost.
As priests in slow procession with the Host,
A gusty breeze intoned—now low, now loud,
And now, as to the murmur of a crowd,
Yielding the dim-torched wonder of the nave.
Aloft along the dusky architrave
The wander-tale of drifting stars evolved;
And Hugh lay gazing till the whole resolved
Into a haze.
It seemed that Little Jim
Had come to share a merry fire with him,
And there had been no trouble ‘twixt the two.
And Jamie listened eagerly while Hugh
Essayed a tangled tale of bears and men,
Bread-root and stars. But ever now and then
The shifting smoke-cloud dimmed the golden hair,
The leal blue eyes; until with sudden flare
The flame effaced them utterly—and lo,
The gulch bank-full with morning!
Loath to go,
Hugh lay beside the pool and pondered fate.
He saw his age-long pilgrimage of hate
Stretch out—a fool’s trail; and it made him cringe;
For still amid the nightly vision’s fringe
For still amid the nightly vision s fringe
His dull wit strayed, companioned with regret.
But when the sun, a tilted cauldron set
Upon the gulch rim, poured a blaze of day,
He rose and bathed again, and went his way,
Sustaining wrath returning with the toil.

At noon the gulch walls, hewn in lighter soil,


Fell back; and coulees dense with shrub and vine
Climbed zigzag to the sharp horizon line,
Whence one might choose the pilotage of crows.
He labored upward through the noonday doze.
Of breathless shade, where plums were turning red
In tangled bowers, and grapevines overhead
Purpled with fruit to taunt the crawler’s thirst.
With little effort Hugh attained the first;
The latter bargained sharply ere they sold
Their luscious clusters for the hoarded gold
Of strength that had so very much to buy.
Now, having feasted, it was sweet to lie
Beneath a sun-proof canopy; and sleep
Came swiftly.
Hugh awakened to some deep
Star-snuffing well of night. Awhile he lay
And wondered what had happened to the day
And where he was and what were best to do.
But when, fog-like, the drowse dispersed, he knew
How from the rim above the plain stretched far
To where the evening and the morning are,
And that ‘twere better he should crawl by night,
Sleep out the glare. With groping hands for sight,
Skyward along the broken steep he crawled,
And saw at length, immense and purple-walled—
Or sensed—the dusky mystery of plain.
Gazing aloft, he found the capsized Wain
In mid-plunge down the polar steep. Thereto
He set his back; and far ahead there grew
He set his back; and far ahead there grew,
As some pale blossom from a darkling root,
The star-blanched summit of a lonely butte,
And thitherward he dragged his heavy limb.

It seemed naught moved. Time hovered over him,


An instant of incipient endeavor.
‘Twas ever thus, and should be thus forever—
This groping for the same armful of space,
An insubstantial essence of one place,
Extentless on a weird frontier of sleep.
Sheer deep upon unfathomable deep
The flood of dusk bore down without a sound,
As ocean on the spirits of the drowned
Awakened headlong leagues beneath the light.

So lapsed the drowsy æon of the night—


A strangely tensile moment in a trance.
And then, as quickened to somnambulance,
The heavens, imperceptibly in motion,
Were altered as the upward deeps of ocean
Diluted with a seepage of the moon.
The butte-top, late a gossamer balloon
In mid-air tethered hovering, grew down
And rooted in a blear expanse of brown,
That, lifting slowly with the ebb of night,
Took on the harsh solidity of light—
And day was on the prairie like a flame.

Scarce had he munched the hoarded roots, when came


A vertigo of slumber. Snatchy dreams
Of sick pools, inaccessible cool streams,
Lured on through giddy vacancies of heat
In swooping flights; now hills of roasting meat
Made savory the oven of the world,
Yet kept remote peripheries and whirled
About a burning center that was Hugh.
Then all were gone, save one, and it turned blue
And was a heap of cool and luscious fruit,
Until at length he knew it for the butte
Now mantled with a weaving of the gloam.
It was the hour when cattle straggle home.
Across the clearing in a hush of sleep
They saunter, lowing; loiter belly-deep
Amid the lush grass by the meadow stream.
How like the sound of water in a dream
The intermittent tinkle of yon bell.
A windlass creaks contentment from a well,
And cool deeps gurgle as the bucket sinks.
Now blowing at the trough the plow-team drinks;
The shaken harness rattles. Sleepy quails
Call far. The warm milk hisses in the pails
There in the dusky barn-lot. Crickets cry.
The meadow twinkles with the glowing fly.
One hears the horses munching at their oats.
The green grows black. A veil of slumber floats
Across the haunts of home-enamored men.

Some freak of memory brought back again


The boyhood world of sight and scent and sound:
It perished, and the prairie ringed him round,
Blank as the face of fate. In listless mood
Hugh set his face against the solitude
And met the night. The new moon, low and far,
A frail cup tilted, nor the high-swung star,
It seemed, might glint on any stream or spring
Or touch with silver any toothsome thing.
The kiote voiced the universal lack.
As from a nether fire, the plain gave back
The swelter of the noon-glare to the gloom.
In the hot hush Hugh heard his temples boom.
Thirst tortured. Motion was a languid pain.
Why seek some further nowhere on the plain?
H i ht th ki t f t ll th
Here might the kiotes feast as well as there.
So spoke some loose-lipped spirit of despair;
And still Hugh moved, volitionless—a weight
Submissive to that now unconscious hate,
As darkling water to the hidden moon.

Now when the night wore on in middle swoon,


The crawler, roused from stupor, was aware
Of some strange alteration in the air.
To breathe became an act of conscious will.
The starry waste was ominously still.
The far-off kiote’s yelp came sharp and clear
As through a tunnel in the atmosphere—
A ponderable, resonating mass.
The limp leg dragging on the sun-dried grass
Produced a sound unnaturally loud.

Crouched, panting, Hugh looked up but saw no cloud.


An oily film seemed spread upon the sky
Now dully staring as the open eye
Of one in fever. Gasping, choked with thirst,
A childish rage assailed Hugh, and he cursed:
‘Twas like a broken spirit’s outcry, tossed
Upon hell’s burlesque sabbath for the lost,
And briefly space seemed crowded with the voice.

To wait and die, to move and die—what choice?


Hugh chose not, yet he crawled; though more and more
He felt the futile strife was nearly o’er.
And as he went, a muffled rumbling grew,
More felt than heard; for long it puzzled Hugh.
Somehow ‘twas coextensive with his thirst,
Yet boundless; swollen blood-veins ere they burst
Might give such warning, so he thought. And still
The drone seemed heaping up a phonic hill
That towered in a listening profound.
Then suddenly a mountain peak of sound
e sudde y a ou ta pea o sou d
Came toppling to a heaven-jolting fall!
The prairie shuddered, and a raucous drawl
Ran far and perished in the outer deep.

As one too roughly shaken out of sleep,


Hugh stared bewildered. Still the face of night
Remained the same, save where upon his right
The moon had vanished ‘neath the prairie rim.
Then suddenly the meaning came to him.
He turned and saw athwart the northwest sky,
Like some black eyelid shutting on an eye,
A coming night to which the night was day!
Star-hungry, ranged in regular array,
The lifting mass assailed the Dragon’s lair,
Submerged the region of the hounded Bear,
Out-topped the tall Ox-Driver and the Pole.
And all the while there came a low-toned roll,
Less sound in air than tremor in the earth,
From where, like flame upon a windy hearth,
Deep in the further murk sheet-lightning flared.
And still the southern arc of heaven stared,
A half-shut eye, near blind with fever rheum;
And still the plain lay tranquil as a tomb
Wherein the dead reck not a menaced world.

What turmoil now? Lo, ragged columns hurled


Pell-mell up stellar slopes! Swift blue fires leap
Above the wild assailants of the steep!
Along the solid rear a dull boom runs!
So light horse squadrons charge beneath the guns.
Now once again the night is deathly still.
What ghastly peace upon the zenith hill,
No longer starry? Not a sound is heard.
So poised the hush, it seems a whispered word
Might loose all noises in an avalanche.
Only the black mass moves, and far glooms blanch
With fitful flashes. The capricious flare
Reveals the butte-top tall and lonely there
Like some gray prophet contemplating doom.

But hark! What spirits whisper in the gloom?


What sibilation of conspiracies
Ruffles the hush—or murmuring of trees,
Ghosts of the ancient forest—or old rain,
In some hallucination of the plain,
A frustrate phantom mourning? All around,
That e’er evolving, ne’er resolving sound
Gropes in the stifling hollow of the night.

Then—once—twice—thrice—a blade of blinding light


Ripped up the heavens, and the deluge came—
A burst of wind and water, noise and flame
That hurled the watcher flat upon the ground.
A moment past Hugh famished; now, half drowned,
He gasped for breath amid the hurtling drench.

So might a testy god, long sought to quench


A puny thirst, pour wassail, hurling after
The crashing bowl with wild sardonic laughter
To see man wrestle with his answered prayer!

Prone to the roaring flaw and ceaseless flare,


The man drank deeply with the drinking grass;
Until it seemed the storm would never pass
But ravin down the painted murk for aye.
When had what dreamer seen a glaring day
And leagues of prairie pantingly aquiver?
Flame, flood, wind, noise and darkness were a river
Tearing a cosmic channel to no sea.

The tortured night wore on; then suddenly


Peace fell. Remotely the retreating Wrath
Trailed dull, reluctant thunders in its path,
And up along a broken stair of cloud
The Dawn came creeping whitely. Like a shroud
Gray vapors clung along the sodden plain.
Up rose the sun to wipe the final stain
Of fury from the sky and drink the mist.
Against a flawless arch of amethyst
The butte soared, like a soul serene and white
Because of the katharsis of the night.

All day Hugh fought with sleep and struggled on


Southeastward; for the heavy heat was gone
Despite the naked sun. The blank Northwest
Breathed coolly; and the crawler thought it best
To move while yet each little break and hollow
And shallow basin of the bison-wallow
Begrudged the earth and air its dwindling store.
But now that thirst was conquered, more and more
He felt the gnaw of hunger like a rage.
And once, from dozing in a clump of sage,
A lone jackrabbit bounded. As a flame
Hope flared in Hugh, until the memory came
Of him who robbed a sleeping friend and fled.
Then hate and hunger merged; the man saw red,
And momently the hare and Little Jim
Were one blurred mark for murder unto him—
Elusive, taunting, sweet to clutch and tear.
The rabbit paused to scan the crippled bear
That ground its teeth as though it chewed a root.
But when, in witless rage, Hugh drew his boot
And hurled it with a curse, the hare loped off,
Its critic ears turned back, as though to scoff
At silly brutes that threw their legs away.

Night like a shadow on enduring day


Swooped by. The dream of crawling and the act
Were phases of one everlasting fact:
H h k dh d i h th d d
Hugh woke, and he was doing what he dreamed.
The butte, outstripped at eventide, now seemed
Intent to follow. Ever now and then
The crawler paused to calculate again
What dear-bought yawn of distance dwarfed the hill.
Close in the rear it soared, a Titan still,
Whose hand-in-pocket saunter kept the pace.

Distinct along the southern rim of space


A low ridge lay, the crest of the divide.
What rest and plenty on the other side!
Through what lush valleys ran what crystal brooks!
And there in virgin meadows wayside nooks
With leaf and purple cluster dulled the light!

All day it seemed that distant Pisgah Height


Retreated, and the tall butte dogged the rear.
At eve a stripéd gopher chirping near
Gave Hugh an inspiration. Now, at least,
No thieving friend should rob him of a feast.
His great idea stirred him as a shout.
Off came a boot, a sock was ravelled out.
The coarse yarn, fashioned to a running snare,
He placed about the gopher’s hole with care,
And then withdrew to hold the yarn and wait.
The night-bound moments, ponderous with fate,
Crept slowly by. The battered gray face leered
In expectation. Down the grizzled beard
Ran slaver from anticipating jaws.
Evolving twilight hovered to a pause.
The light wind fell. Again and yet again
The man devoured his fancied prey: and then
Within the noose a timid snout was thrust.
His hand unsteadied with the hunger lust,
Hugh jerked the yarn. It broke.

Down swooped the night,


o s ooped t e g t,
A shadow of despair. Bleak height on height,
It seemed, a sheer abyss enclosed him round.
Clutching a strand of yarn, he heard the sound
Of some infernal turmoil under him.
Grimly he strove to reach the ragged rim
That snared a star, until the skyey space
Was darkened with a roof of Jamie’s face,
And then the yarn was broken, and he fell.
A-tumble like a stricken bat, his yell
Woke hordes of laughers down the giddy yawn
Of that black pit—and suddenly ‘twas dawn.

Dream-dawn, dream-noon, dream-twilight! Yet, possest


By one stern dream more clamorous than the rest,
Hugh headed for a gap that notched the hills,
Wherethrough a luring murmur of cool rills,
A haunting smell of verdure seemed to creep.
By fits the wild adventure of his sleep
Became the cause of all his waking care,
And he complained unto the empty air
How Jamie broke the yarn.

The sun and breeze


Had drunk all shallow basins to the lees,
But now and then some gully, choked with mud,
Retained a turbid relict of the flood.
Dream-dawn, dream-noon, dream-night! And still obsessed
By that one dream more clamorous than the rest,
Hugh struggled for the crest of the divide.
And when at length he saw the other side,
‘Twas but a rumpled waste of yellow hills!
The deep-sunk, wiser self had known the rills
And nooks to be the facture of a whim;
Yet had the pleasant lie befriended him,
And now the brutal fact had come to stare.

S bi t l d i
Succumbing to a languorous despair,
He mourned his fate with childish uncontrol
And nursed that deadly adder of the soul,
Self-pity. Let the crows swoop down and feed,
Aye, batten on a thing that died of need,
A poor old wretch betrayed of God and Man!
So peevishly his broken musing ran,
Till, glutted with the luxury of woe,
He turned to see the butte, that he might know
How little all his striving could avail
Against ill-luck. And lo, a finger-nail,
At arm-length held, could blot it out of space!
A goading purpose and a creeping pace
Had dwarfed the Titan in a haze of blue!
And suddenly new power came to Hugh
With gazing on his masterpiece of will.
So fare the wise on Pisgah.

Down the hill,


Unto the higher vision consecrate,
Now sallied forth the new triumvirate—
A Weariness, a Hunger and a Glory—
Against tyrannic Chance. As in a story
Some higher Hugh observed the baser part.
So sits the artist throned above his art,
Nor recks the travail so the end be fair.
It seemed the wrinkled hills pressed in to stare,
The arch of heaven was an eye a-gaze.
And as Hugh went, he fashioned many a phrase
For use when, by some friendly ember-light,
His tale of things endured should speed the night
And all this gloom grow golden in the sharing.
So wrought the old evangel of high daring,
The duty and the beauty of endeavor,
The privilege of going on forever,
A victor in the moment.
Ah but when
Ah, but when
The night slipped by and morning came again,
The sky and hill were only sky and hill
And crawling but an agony of will.
So once again the old triumvirate,
A buzzard Hunger and a viper Hate
Together with the baser part of Hugh,
Went visionless.
That day the wild geese flew,
Vague in a gray profundity of sky;
And on into the night their muffled cry
Haunted the moonlight like a far farewell.
It made Hugh homesick, though he could not tell
For what he yearned; and in his fitful sleeping
The cry became the sound of Jamie weeping,
Immeasurably distant.
Morning broke,
Blear, chilly, through a fog that drove as smoke
Before the booming Northwest. Sweet and sad
Came creeping back old visions of the lad—
Some trick of speech, some merry little lilt,
The brooding blue of eyes too clear for guilt,
The wind-blown golden hair. Hate slept that day,
And half of Hugh was half a life away,
A wandering spirit wistful of the past;
And half went drifting with the autumn blast
That mourned among the melancholy hills;
For something of the lethargy that kills
Came creeping close upon the ebb of hate.
Only the raw wind, like the lash of Fate,
Could have availed to move him any more.
At last the buzzard beak no longer tore
His vitals, and he ceased to think of food.
The fighter slumbered, and a maudlin mood
Foretold the dissolution of the man.
He sobbed, and down his beard the big tears ran.
And now the scene is changed; the bleak wind’s cry
And now the scene is changed; the bleak wind s cry
Becomes a flight of bullets snarling by
From where on yonder summit skulk the Rees.
Against the sky, in silhouette, he sees
The headstrong Jamie in the leaden rain.
And now serenely beautiful and slain
The dear lad lies within a gusty tent.

Thus vexed with doleful whims the crawler went


Adrift before the wind, nor saw the trail;
Till close on night he knew a rugged vale
Had closed about him; and a hush was there,
Though still a moaning in the upper air
Told how the gray-winged gale blew out the day.
Beneath a clump of brush he swooned away
Into an icy void; and waking numb,
It seemed the still white dawn of death had come
On this, some cradle-valley of the soul.
He saw a dim, enchanted hollow roll
Beneath him, and the brush thereof was fleece;
And, like the body of the perfect peace
That thralled the whole, abode the break of day.
It seemed no wind had ever come that way,
Nor sound dwelt there, nor echo found the place.
And Hugh lay lapped in wonderment a space,
Vexed with a snarl whereof the ends were lost,
Till, shivering, he wondered if a frost
Had fallen with the dying of the blast.
So, vaguely troubled, listlessly he cast
A gaze about him: lo, above his head
The gray-green curtain of his chilly bed
Was broidered thick with plums! Or so it seemed,
For he was half persuaded that he dreamed;
And with a steady stare he strove to keep
That treasure for the other side of sleep.

Returning hunger bade him rise; in vain


etu g u ge bade se; a
He struggled with a fine-spun mesh of pain
That trammelled him, until a yellow stream
Of day flowed down the white vale of a dream
And left it disenchanted in the glare.
Then, warmed and soothed, Hugh rose and feasted there,
And thought once more of reaching the Moreau.

To southward with a painful pace and slow


He went stiff-jointed; and a gnawing ache
In that hip-wound he had for Jamie’s sake
Oft made him groan—nor wrought a tender mood:
The rankling weapon of ingratitude
Was turned again with every puckering twinge.

Far down the vale a narrow winding fringe


Of wilted green betokened how a spring
There sent a little rill meandering;
And Hugh was greatly heartened, for he knew
What fruits and herbs might flourish in the slough,
And thirst, henceforth, should torture not again.

So day on day, despite the crawler’s pain,


All in the windless, golden autumn weather,
These two, as comrades, struggled south together—
The homeless graybeard and the homing rill:
And one was sullen with the lust to kill,
And one went crooning of the moon-wooed vast;
For each the many-fathomed peace at last,
But oh the boon of singing on the way!
So came these in the golden fall of day
Unto a sudden turn in the ravine,
Wherefrom Hugh saw a flat of cluttered green
Beneath the further bluffs of the Moreau.

With sinking heart he paused and gazed below


Upon the goal of so much toil and pain.
Yon green had seemed a paradise to gain
Yon green had seemed a paradise to gain
The while he thirsted where the lonely butte
Looked far and saw no toothsome herb or fruit
In all that yellow barren dim with heat.
But now the wasting body cried for meat,
And sickness was upon him. Game should pass,
Nor deign to fear the mighty hunter Glass,
But curiously sniffing, pause to stare.

Now while thus musing, Hugh became aware


Of some low murmur, phasic and profound,
Scarce risen o’er the border line of sound.
It might have been the coursing of his blood,
Or thunder heard remotely, or a flood
Flung down a wooded valley far away.
Yet that had been no weather-breeding day;
‘Twould frost that night; amid the thirsty land
All streams ran thin; and when he pressed a hand
On either ear, the world seemed very still.

The deep-worn channel of the little rill


Here fell away to eastward, rising, rough
With old rain-furrows, to a lofty bluff
That faced the river with a yellow wall.
Thereto, perplexed, Hugh set about to crawl,
Nor reached the summit till the sun was low.
Far-spread, shade-dimpled in the level glow,
The still land told not whence the murmur grew;
But where the green strip melted into blue
Far down the winding valley of the stream,
Hugh saw what seemed the tempest of a dream
At mimic havoc in the timber-glooms.
As from the sweeping of gigantic brooms,
A dust cloud deepened down the dwindling river;
Upon the distant tree-tops ran a shiver
And huddled thickets writhed as in a gale.
On creeps the windless tempest up the vale,
The while the murmur deepens to a roar,
As with the wider yawning of a door.
And now the agitated green gloom gapes
To belch a flood of countless dusky shapes
That mill and wrangle in a turbid flow—
Migrating myriads of the buffalo
Bound for the winter pastures of the Platte!

Exhausted, faint with need of meat, Hugh sat


And watched the mounting of the living flood.
Down came the night, and like a blot of blood
The lopped moon weltered in the dust-bleared East.
Sleep came and gave a Barmecidal feast.
About a merry flame were simmering
Sweet haunches of the calving of the Spring,
And tender tongues that never tasted snow,
And marrow bones that yielded to a blow
Such treasure! Hugh awoke with gnashing teeth,
And heard the mooing drone of cows beneath,
The roll of hoofs, the challenge of the bull.
So sounds a freshet when the banks are full
And bursting brush-jams bellow to the croon
Of water through green leaves. The ragged moon
Now drenched the valley in an eerie rain:
Below, the semblance of a hurricane;
Above, the perfect calm of brooding frost,
Through which the wolves in doleful tenson tossed
From hill to hill the ancient hunger-song.
In broken sleep Hugh rolled the chill night long,
Half conscious of the flowing flesh below.
And now he trailed a bison in the snow
That deepened till he could not lift his feet.
Again, he battled for a chunk of meat
With some gray beast that fought with icy fang.
And when he woke, the wolves no longer sang;
White dawn athwart a white world smote the hill,
And thunder rolled along the valley still.

Morn, wiping up the frost as with a sponge,


Day on the steep and down the nightward plunge,
And Twilight saw the myriads moving on.
Dust to the westward where the van had gone,
And dust and muffled thunder in the east!
Hugh starved while gazing on a Titan feast.
The tons of beef, that eddied there and swirled,
Had stilled the crying hungers of the world,
Yet not one little morsel was for him.

The red sun, pausing on the dusty rim,


Induced a panic aspect of his plight:
The herd would pass and vanish in the night
And be another dream to cling and flout.
Now scanning all the summit round about,
Amid the rubble of the ancient drift
He saw a bowlder. ‘Twas too big to lift,
Yet he might roll it. Painfully and slow
He worked it to the edge, then let it go
And breathlessly expectant watched it fall.
It hurtled down the leaning yellow wall,
And bounding from a brushy ledge’s brow,
It barely grazed the buttocks of a cow
And made a moment’s eddy where it struck.

In peevish wrath Hugh cursed his evil luck,


And seizing rubble, gave his fury vent
By pelting bison till his strength was spent:
So might a child assail the crowding sea!
Then, sick at heart and musing bitterly,
He shambled down the steep way to the creek,
And having stayed the tearing buzzard beak
With breadroot and the waters of the rill,
Slept till the white of morning o’er the hill
Slept till the white of morning o er the hill
Was like a whisper groping in a hush.
The stream’s low trill seemed loud. The tumbled brush
And rumpled tree-tops in the flat below,
Upon a fog that clung like spectral snow,
Lay motionless; nor any sound was there.
No frost had fallen, but the crystal air
Smacked of the autumn, and a heavy dew
Lay hoar upon the grass. There came on Hugh
A picture, vivid in the moment’s thrill,
Of martialed corn-shocks marching up a hill
And spiked fields dotted with the pumpkin’s gold.
It vanished; and, a-shiver with the cold,
He brooded on the mockeries of Chance,
The shrewd malignity of Circumstance
That either gave too little or too much.

Yet, with the fragment of a hope for crutch,


His spirit rallied, and he rose to go,
Though each stiff joint resisted as a foe
And that old hip-wound battled with his will.
So down along the channel of the rill
Unto the vale below he fought his way.
The frore fog, rifting in the risen day,
Revealed the havoc of the living flood—
The river shallows beaten into mud,
The slender saplings shattered in the crush,
All lower leafage stripped, the tousled brush
Despoiled of fruitage, winter-thin, aghast.
And where the avalanche of hoofs had passed
It seemed nor herb nor grass had ever been.
And this the hard-won paradise, wherein
A food-devouring plethora of food
Had come to make a starving solitude!

Yet hope and courage mounted with the sun.


Surely, Hugh thought, some ill-begotten one
Of all that striving mass had lost the strife
And perished in the headlong stream of life—
A feast to fill the bellies of the strong,
That still the weak might perish. All day long
He struggled down the stricken vale, nor saw
What thing he sought. But when the twilight awe
Was creeping in, beyond a bend arose
A din as though the kiotes and the crows
Fought there with shrill and raucous battle cries.

Small need had Hugh to ponder and surmise


What guerdon beak and fang contended for.
Within himself the oldest cause of war
Brought forth upon the instant fang and beak.
He too would fight! Nor had he far to seek
Amid the driftwood strewn about the sand
For weapons suited to a brawny hand
With such a purpose. Armed with club and stone
He forged ahead into the battle zone,
And from a screening thicket spied his foes.

He saw a bison carcass black with crows,


And over it a welter of black wings,
And round about, a press of tawny rings
That, like a muddy current churned to foam
Upon a snag, flashed whitely in the gloam
With naked teeth; while close about the prize
Red beaks and muzzles bloody to the eyes
Betrayed how worth a struggle was the feast.

Then came on Hugh the fury of the beast—


To eat or to be eaten! Better so
To die contending with a living foe,
Than fight the yielding distance and the lack.
Masked by the brush he opened the attack,
And ever where a stone or club fell true,
About the stricken one an uproar grew
About the stricken one an uproar grew
And brute tore brute, forgetful of the prey,
Until the whole pack tumbled in the fray
With bleeding flanks and lacerated throats.
Then, as the leader of a host who notes
The cannon-wrought confusion of the foe,
Hugh seized the moment for a daring blow.

The wolf’s a coward, who, in goodly packs,


May counterfeit the courage that he lacks
And with a craven’s fury crush the bold.
But when the disunited mass that rolled
In suicidal strife, became aware
How some great beast that shambled like a bear
Bore down with roaring challenge, fell a hush
Upon the pack, some slinking to the brush
With tails a-droop; while some that whined in pain
Writhed off on reddened trails. With bristled mane
Before the flying stones a bolder few
Snarled menace at the foe as they withdrew
To fill the outer dusk with clamorings.
Aloft upon a moaning wind of wings
The crows with harsh, vituperative cries
Now saw a gray wolf of prodigious size
Devouring with the frenzy of the starved.
Thus fell to Hugh a bison killed and carved;
And so Fate’s whims mysteriously trend—
Woe in the silken meshes of the friend,
Weal in the might and menace of the foe.
But with the fading of the afterglow
The routed wolves found courage to return:
Amid the brush Hugh saw their eye-balls burn;
And well he knew how futile stick and stone
Should prove by night to keep them from their own.
Better is less with safety, than enough
With ruin. He retreated to a bluff,
And scarce had reached it when the pack swooped in
And scarce had reached it when the pack swooped in
Upon the carcass.
All night long, the din
Of wrangling wolves assailed the starry air,
While high above them in a brushy lair
Hugh dreamed of gnawing at the bloody feast.

Along about the blanching of the east,


When sleep is weirdest and a moment’s flight,
Remembered coextensive with the night,
May teem with hapful years; as light in smoke,
Upon the jumble of Hugh’s dreaming broke
A buzz of human voices. Once again
He rode the westward trail with Henry’s men—
Hoof-smitten leagues consuming in a dust.
And now the nightmare of that broken trust
Was on him, and he lay beside the spring,
A corpse, yet heard the muffled parleying
Above him of the looters of the dead:
But when he might have riddled what they said,
The babble flattened to a blur of gray—
And lo, upon a bleak frontier of day,
The spent moon staring down! A little space
Hugh scrutinized the featureless white face,
As though ‘twould speak. But when again the sound
Grew up, and seemed to come from under ground,
He cast the drowse, and peering down the slope,
Beheld what set at grapple fear and hope—
Three Indian horsemen riding at a jog!
Their ponies, wading belly-deep in fog,
That clung along the valley, seemed to swim,
And through a thinner vapor moving dim,
The men were ghost-like.
Could they be the Sioux?
Almost the wish became belief in Hugh.
Or were they Rees? As readily the doubt
Withheld him from the hazard of a shout.
t ed o t e a a d o a s out
And while he followed them with baffled gaze,
Grown large and vague, dissolving in the haze,
They vanished westward.
Knowing well the wont
Of Indians moving on the bison-hunt,
Forthwith Hugh guessed the early riders were
The outflung feelers of a tribe a-stir
Like some huge cat gone mousing. So he lay
Concealed, impatient with the sleepy day
That dawdled in the dawning. Would it bring
Good luck or ill? His eager questioning,
As crawling fog, took on a golden hue
From sunrise. He was waiting for the Sioux,
Their parfleche panniers fat with sun-dried maize
And wasna! From the mint of evil days
He would coin tales and be no begging guest
About the tribal feast-fires burning west,
But kinsman of the blood of daring men.
And when the crawler stood erect again—
O Friend-Betrayer at the Big Horn’s mouth,
Beware of someone riding from the South
To do the deed that he had lived to do!

Now when the sun stood hour-high in the blue,


From where a cloud of startled blackbirds rose
Down stream, a panic tumult broke the doze
Of windless morning. What unwelcome news
Embroiled the parliament of feathered shrews?
A boiling cloud against the sun they lower,
Flackering strepent; now a sooty shower,
Big-flaked, squall-driven westward, down they flutter
To set a clump of cottonwoods a-sputter
With cold black fire! And once again, some shock
Of sight or sound flings panic in the flock—
Gray boughs exploding in a ruck of birds!
What augury in orniscopic words
Did yon swart sibyls on the morning scrawl?

Now broke abruptly through the clacking brawl


A camp-dog’s barking and a pony’s neigh;
Whereat a running nicker fled away,
Attenuating to a rearward hush;
And lo! in hailing distance ‘round the brush
That fringed a jutting bluff’s base like a beard
Upon a stubborn chin out-thrust, appeared
A band of mounted warriors! In their van
Aloof and lonely rode a gnarled old man
Upon a piebald stallion. Stooped was he
Beneath his heavy years, yet haughtily
He wore them like the purple of a king.
Keen for a goal, as from the driving string
A barbed and feathered arrow truly sped,
His face was like a flinty arrow-head,
And brooded westward in a steady stare.
There was a sift of winter in his hair,
The bleakness of brown winter in his look.
Hugh saw, and huddled closer in his nook.
Fled the bright dreams of safety, feast and rest
Before that keen, cold brooder on the West,
As gaudy leaves before the blizzard flee.
‘Twas Elk Tongue, fighting chieftain of the Ree,
With all his people at his pony’s tail—
Full two-score lodges emptied on the trail
Of hunger!
On they came in ravelled rank,
And many a haggard eye and hollow flank
Made plain how close and pitilessly pressed
The enemy that drove them to the West—
Such foeman as no warrior ever slew.
A tale of cornfields plundered by the Sioux
Their sagging panniers told. Yet rich enough
Th d t hi h t h d th f th bl ff
They seemed to him who watched them from the bluff;
Yea, pampered nigh the limit of desire!
No friend had filched from them the boon of fire
And hurled them shivering back upon the beast.
Erect they went, full-armed to strive, at least;
And nightly in a cozy ember-glow
Hope fed them with a dream of buffalo
Soon to be overtaken. After that,
Home with their Pawnee cousins on the Platte,
Much meat and merry-making till the Spring.
On dragged the rabble like a fraying string
Too tautly drawn. The rich-in-ponies rode,
For much is light and little is a load
Among all heathen with no Christ to save!
Gray seekers for the yet begrudging grave,
Bent with the hoeing of forgotten maize,
Wood-hewers, water-bearers all their days,
Toiled ‘neath the life-long hoarding of their packs.
And nursing squaws, their babies at their backs
Whining because the milk they got was thinned
In dugs of famine, strove as with a wind.
Invincibly equipped with their first bows
The striplings strutted, knowing, as youth knows,
How fair life is beyond the beckoning blue.
Cold-eyed the grandsires plodded, for they knew,
As frosted heads may know, how all trails merge
In what lone land. Raw maidens on the verge
Of some half-guessed-at mystery of life,
In wistful emulation of the wife
Stooped to the fancied burden of the race;
Nor read upon the withered granddam’s face
The scrawled tale of that burden and its woe.
Slant to the sagging poles of the travaux,
Numb to the squaw’s harsh railing and the goad,
The lean cayuses toiled. And children rode
A-top the household plunder, wonder-eyed
T ld fl b ith id
Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.

More than just a book-buying platform, we strive to be a bridge


connecting you with timeless cultural and intellectual values. With an
elegant, user-friendly interface and a smart search system, you can
quickly find the books that best suit your interests. Additionally,
our special promotions and home delivery services help you save time
and fully enjoy the joy of reading.

Join us on a journey of knowledge exploration, passion nurturing, and


personal growth every day!

ebookbell.com

You might also like