Out in the backyard: the tutor reflects

The tutor comments on another Sunday afternoon out in the backyard.

We’ve been in a cold snap lately, with temperatures dropping -5°C to -8°C since perhaps last Monday. This afternoon I thought I’d get outside, breathe some fresh air, work a little off the burn pile, and reconnect with the yard.

A Greek friend of mine told me that, commonly in rural Greece, the orchard prunings are used to heat the homes through winter. With only a few trees in our yard, we don’t quite follow that tradition. However, the prunings, fallen branches, and cones (we have a 70-year-old Douglas fir in our yard) are adequate to feed a few backyard fires. With that in mind, I headed out today.

I got outside around 4pm to a cold, still, grey afternoon. The temp was probably around 1°C; water was dripping from the Douglas fir, even though we haven’t had rain for a week. I started the fire with some old phone book pages and cardboard, then turned to the ground for twigs and larger branches. I spent the next 25 minutes running around, grabbing up fuel, bringing it to the fire, then repeating the process. Finally the fire was strong enough to accept some larger rounds. I placed some half-burned wood from last fire on it, then turned to the burn pile. Afterward, I continued picking up twigs and branches from the yard, though at a more leisurely pace.

With the fire well established, I started adding cones from the Douglas fir. They burn slowly, but keep the fire stable once it’s strong. I’d say I put hundreds of cones in it.

I ran the fire for three hours; the last hour, cones were the dominant fuel. I’d guess the fire might have received about a pound of fuel every ten minutes. It was a good cleanup, but I wouldn’t be surprised if we could do the same again next month.

In a future post I’ll hopefully consider the heat output of the fire, given the fuel it received.

BTW: I saw one flying insect outside, even after a week of nighttime freezes. That’s the west coast for you!

Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.

Perl: some explanation of yesterday’s command-line cube root program

The tutor offers a few points of clarification.

In yesterday’s post I showed a Perl program, called from the command line with the input value, to find the cube root of a number. Here are some points to help a casual reader understand it:

$ARGV[0] refers to the first command-line argument. Let’s imagine the program is stored as cuberoot.txt. If the user wants the cube root of -64, the program will be called from the command line as follows:

perl cuberoot.txt -64

The if statement checks for negativity; my version of Perl isn’t happy to exponentiate a negative number by 1/3. I just make $input positive, take that cube root, then multiply the answer by negative 1. Later I change $input back to negative so it’s correct in the answer statement printed to the screen.

printout is a subroutine listed at the bottom of the program. It’s called by &printout. To my knowledge, a subroutine is called using an ampersand in front of its name.

HTH:)

Source:

McGrath, Mike. Perl in easy steps. Southam: Computer Step, 2004.

Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.

Perl: a command-line cube root program

The tutor shows an example program with a few facets to discuss.

So far as I know, to find the cube root in Perl, you need use the principle

    \[\sqrt[c]{a}^b=a^{\frac{b}{c}}\]

Specifically for the cube root,

    \[\sqrt[3]{x}=x^{\frac{1}{3}}\]

The following program calculates the cube root of a number given with the command-line function call:


$input=$ARGV[0];

if($input<0){
$input*=-1; #changes value to positive
$out=-1*$input**(1/3);
$input*=-1; #restores original value
}

else{
$out=$input**(1/3);
}
&printout;

sub printout{
print “The cube root of $input is $out\n\n”;
}

I’ll be explaining some ins and outs of this program next post:)

Source:

McGrath, Mike. Perl in easy steps. Southam: Computer Step, 2004.

perlmonks.org

Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.

Calculator usage: Sharp EL-520W: multiplication in the denominator

The tutor shares a recent discovery.

Imagine you want to calculate

    \[\frac{8}{2 \times 4}\]

The answer should be 1, of course: in a fraction, there are unwritten brackets around the numerator and around the denominator.

Unless you have a calculator that accepts up-and-down fraction input (such as a Sharp WriteView or a Casio Natural Display), your calculator needs to be told what’s in the numerator versus what’s in the denominator. Of course, this can be done using brackets: the written calculation

    \[\frac{8}{2 \times 4}\]

can safely be entered as

    \[8 \div (2 \times 4)\]

but typically not

    \[8 \div 2 \times 4\]

In the last case, the calculator (including the Sharp EL-520W) will likely divide 8 by 2, then multiply by 4, giving 16.

However, the Sharp EL-520W seems to perceive

    \[8 \div 2(4) \]

as meaning that the 4 is in the denominator: it gives the answer 1.

So, to the Sharp EL-520W, 8÷2×4 is not the same as 8÷2(4). Beware: not all calculators share this opinion. With the EL-520W, Sharp perhaps tries to anticipate the user’s intention rather than just taking the entry literally.

HTH:)

Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.

English: Reading: Short Horror: H.P. Lovecraft’s “The Tomb”

The tutor shares some thoughts about Lovecraft’s short story “The Tomb.”

“The Tomb” is classic Lovecraft. First, it centres on an abandoned location connected with former greatness. Second, its narrator develops a connection to the supernatural world. Finally, the narrator’s exposure to that other world consumes him, so he cannot return to normal life.

In my experience, Lovecraft focuses on setting more than character development, which I appreciate. I read more for setting than any other facet of a story. In “The Tomb”, the narrator is irresistibly attracted to a wooded area, once part of the estate of a great family that returned to Europe after a tragedy. There the narrator finds the tomb.

Spending time around the tomb, the narrator has a supernatural experience whence he learns how he can enter it. The narrator’s experiences in the tomb cause him to prefer it to the everyday world. He comes to feel he belongs therein.

Eventually, the narrator casts his fate with the perished occupants of the tomb. He rejects normal life, seeking to be “reunited” with them. He suggests he may be a reincarnation of one of them who, mysteriously, never wound up in the tomb.

Three focuses I’ve noticed of Lovecraft’s stories:

  1. The supernatural world is much bigger than our own and surrounds us.
  2. The supernatural world can be entered surprisingly easily, either purposefully or by accident.
  3. Once a person enters the supernatural world, they may not be able to return.

Source:

Padgett, JoAnn, et al (editors). Classic Tales of Horror. San Diego: Canterbury
  Classics, 2015.

Algebra: solving when x is on the bottom

The tutor covers a day-to-day issue in high school algebra.

Consider the following problem:

    \[14=\frac{5}{3x}\]

Solution:

First, multiply both sides by 3x:

    \[3x(14)=(\frac{5}{3x})3x\]

The right side is now both divided and multiplied by 3x, so they cancel there:

    \[3x(14)=5\]

On the left, we simplify:

    \[42x=5\]

Next, we divide both sides by 42:

    \[\frac{42x}{42}=\frac{5}{42}\]

    \[x=\frac{5}{42}\]

HTH:)

Source:

Travers, Kenneth et al. Using Advanced Algebra. Toronto: Doubleday, 1977.

Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.

Perl: regular expression explanation

The tutor follows up on his post about the variable password checker.

In my Nov 18 post I show a short script that checks a three-digit entry for a match with the pattern m[any character]m. The entry m4m is a match, for example. However, m4mi is not a match (too long). Neither is tom; it doesn’t follow m[character]m.

The code that can distinguish the pattern

m[any character]m

is

if ($word=~/^n.n$/){
print “correct”;
}

The =~ means “contains match”. The period in the middle means “any single character”. The ^ means the match must occur at the beginning of $word, while the $ means it must occur at the end. Therefore, the string can only be three characters long.

HTH:)

Source:

McGrath, Mike. Perl in easy steps. Southam: Computer Step, 2004.

Robert’s Perl tutorial

Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.

Biology: differences between DNA and RNA

Heading into another biology conference, the tutor offers a prelude about DNA vs RNA.

DNA stands for deoxyribonucleic acid; RNA indicates ribonucleic acid. Not surprisingly, both types of molecules are classified as nucleic acids. What are they used for, and what are their differences?

In the human body, DNA stores the genetic code – the blueprints of how to build the proteins of the body. Except for eggs and sperm, each body cell contains a complete set of DNA for that person, aka, that person’s genome.

RNA, on the other hand, is used in various ways to manufacture proteins from the blueprints found in the DNA.

Some chemical differences between DNA and RNA:

  1. DNA contains the sugar deoxyribose, while RNA contains ribose.
  2. RNA substitutes the base uracil for DNA’s thymine.
  3. DNA is double-stranded; RNA, single.
  4. DNA has the famous helix shape; RNA doesn’t.

I’ll be talking more about nucleic acids in a coming post:)

Source:

Mader, Sylvia S. Inquiry into Life, 9th Ed. Toronto: McGraw-Hill, 2000.

Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.

Perl: a password (sort of) using regular expression (regex) power

The tutor shows off some of Perl’s pattern matching (aka regex) talents.

Let’s imagine you have a laptop you share with a friend for project work. They’re not million-dollar secrets you’re keeping, but on the other hand, you don’t want just anyone reading those files. At the same time, your friend is very forgetful, likely not to remember a typical password.

To accommodate your friend, while keeping out the casual snoops, you settle on a three-character password with a variable middle character. Let’s imagine the password is n[any character]n. Then, nan or n@n will succeed, but nano won’t (too long). Of course, the first and third characters must both be n.

Pattern matching is done using regular expressions, or regex.

Here is the Perl code that can accept the entry, then decide if it matches:

print “Enter your password, please.\n\n”;

$word=<STDIN>;

if ($word=~/^n.n$/){  #the regex line
print “Correct.\n”;
}

else{
print “Incorrect password; access denied.\n”;
}

I’ll be explaining some nuts and bolts of the regex line in a coming post:)

Source:

McGrath, Mike. Perl in easy steps. Southam: Computer Step, 2004.

Robert’s Perl tutorial

Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.

Math: more about angles in standard position and reference angles

The tutor talks more about how to find the angle in standard position from the reference angle.

For my introductory post about this, see here.

Let’s imagine you know the reference angle is 71°, but the actual angle is in QIV. The reference angle always extends from the x-axis into the quadrant of interest. From the illustration you can see the way to the angle in standard position:

In each case, the reference angle should be drawn in its quadrant. From the drawing it’s then obvious whether to add or subtract the reference angle, and to or from what number, in order to find the angle in standard position. However, here is a guide of how to arrive at the angle in standard position from a reference angle:

QII: 180° – ref angle.

QIII: 180° + ref angle.

QIV: 360 – ref angle.

HTH:)

Source:

Travers, Kenneth J. et al. Using Advanced Algebra. Toronto: Doubleday, 1977.

Jack of Oracle Tutoring by Jack and Diane, Campbell River, BC.