The Novels

Sociology 500, a Romance (Second Draft) -- The first book in the Economics 101 Trilogy.
Karel and Dan, former American football teammates and now graduate students, meet fellow graduate students Kristie and Bobbie, and the four form a steady study group.

Economics 101, a Novel (Rough Draft) -- My first sustained attempt at a novel, two-thirds finished in rough draft, and heading a little too far south.
What would you do if you and your study partner, with whom you had been seriously discussing marriage, suddenly found yourselves all alone together on a desert island?

Featured Post

Sociology 500, a Romance, ch 1 pt 1 -- Introducing Bobbie

TOC Well, let's meet Roberta Whitmer. Bobbie entered the anthropology department office and looked around. Near the receptionis...

Tuesday, April 25, 2017

RFQ3: Ch. 2, The Framing Story -- the Pilots and the Island

(Yet another false start:)
Foreword


The Framing Story -- the Pilots and the Island


"Your doctoral thesis plan looks good, but you'll need to do some on-location research." Professor White was busy, so Professor MacVittie was helping Karel review his plans.

Karel Pratt nodded his agreement. "I guess I should have said that in the plan? Should I revise the plan to say something about needing the fieldwork, but not yet knowing when and where?"

Professor MacVittie nodded in half agreement. "Well, you could, but I think you know enough to be somewhat specific already. You should be able to name several islands as possibilities."

Karel scratched his head behind his ear. "I guess I can say I'm looking at a few locations, but don't know which, yet?"

"Sounds reasonable." The professor paused to think. "Say, do you know Roberta Whitmer?"

"Not really. I think I've met her. She calls herself Bobbie, right? And she's in the anthropology program, too?"

"Yes, that would be her. Her thesis seems like it could complement yours. Professor White and I were thinking you might want to talk with her. Just a suggestion, of course, but it often helps to have someone you can work with."

"Uhmm, ... okay." Karel nodded hesitantly. "I'll talk with her and see."



"You two never seem to get together anywhere but in my office."

"We meet at the library, too." Bobbie looked a little taken aback.

"Once a month?"

"Once a week."

"Was my suggestion about backing each other up during the fieldwork phase a bad suggestion?"

"No." Karel shook his head. "It's a great idea. We're working together on the schedule and the plans for traveling. But we find our theses different enough that we really don't have that much to coordinate besides the time we'll be in the islands and the flight schedule and such." He shrugged.

"We went to the airport together to find the closest flights," Bobbie ventured.

Karel continued: "And we've been working together to contact the consulates and get names of charter companies and independent pilots to work with. We've even talked with travel agents who have put us in touch with people in New York who handle tours of our islands."

"The travel agents kept asking us if this is our honeymoon. Silly people." Bobbie grinned.

"Not so silly if they've never met you two. Okay, so you're ahead of me on setting up your plans."

"Not really," said Karel. "We needed to talk with you about the flight information we've found so far, and we would definitely appreciate it if we could have you check our plans over. Which is why we are here, now."



In the end, the faculty and Sister MacVittie decided it would be best for Professor MacVittie to accompany them for the first two weeks. That way he could help them solve the early problems. He could also make contacts in the islands for the university.

Sister MacVittie was especially excited to go along, and to take their youngest son, who was preparing to go on his mission.

(If you are wondering, the university is a Church-sponsored school, but Sister MacVittie is not a nun. She is Professor MacVittie's wife. In their beliefs, God is the Father of all, so everyone in the Church is called brother or sister.

The son's mission? Yes, E-P-ism is a proselyting religion.

Names? I'm translating the names mostly by meaning and history rather than sound.)

Bobbie and Karel chose four islands where they could both do fieldwork, and they lengthened their planned schedule to allow a month on each of the islands. They wanted to give themselves time to find opportunities for volunteer service work, in the expectation that the service work would help them get to know the islanders and their culture better. Good relationships with the islanders would be essential for obtaining meaningful research results.

Ultimately, things went well for the four months, and we are not interested in the details in this novel. If this were a normal novel, we would be interested, but it's just the framing story for our thought experiments.

Where things get interesting for us again is towards the end of the last month, in the small airport on the main island, in the small room that Wycliffe and Zedidiah, the charter pilots who had taken them around from island to island, borrowed for an office.



Wycliffe sat on their desk and picked up their schedule. "Hey, Zed. Look what we got this week."

Zedidiah looked up. "Yeah, I see that. Them two grad students from that Apist school. Come to study ant rope loggies. Native cul-ture and all that. And do busybody serve ice pro jets. Straight as two rulers. Even the natives are laughing behind their backs."

"Yeah," agreed Wycliffe. "You know, I think they need help studying natural island nature, way up close. And help seeing just how Apist they are. And help growing up."

"Heh heh. Hey. Wait. They're paying passengers. Don't do anything stupid on me, okay? Just fly in and get them and fly them back here."

"What, me? Would I deliberately sabotage my own plane to strand them on a desert island to test their morals?"

"Depends on how drunk you've been this week."

"Heh heh."

"Okay, that does it. I own half of that plane. I'm flying this one."

"Ten hour flight? The longest you've flown is four hours, and you almost got lost that time. And you accuse me of plotting to strand them."

"That wasn't my fault. Sudden storm."

"Naw, I'm just kidding around. I'll bring them back safe and sound."



I really hate to tell stories about bad people.

But, Wycliffe really wasn't a bad person, just a little mixed up. He had been himself converted to E-P-ism at some point, in love with a good E-P-ist woman. And maybe she was insecure, or maybe she just didn't realize what a great guy he was. Or maybe she knew she wasn't strong enough to be his wife, in particular. Anyway, she ditched him.

And that was part of the reason he was in the islands, trying to escape from himself and his memories, blaming the E-P religion for his sorrows.

E-P. Perhaps I should explain a little about that?

This is an abbreviation of "Eyeni Phuel," but the "ph" is an aspirated bilabial plosive, not a labiodental fricative.

Interestingly, the meaning of "Eyeni" is "progress", and "Phuel" is "eternally", so name of the ancient prophet after whom the book of scripture was named meant, "Eternally Progress," in the old language.

It's a complete coincidence, and begs the question of what the language Karel and Bobbie speaks really looks like. But I will dodge that question for the present.


 
About three hours after picking our two heroes up, already way off his flight plan, he started deliberately running the engine lean.

Karel listened to the sound of the engine. "What's wrong?" he asked. "It sounds a little irregular."

Bobbie was also concerned. "Sounds like it's missing a stroke every now and then. Maybe vapor in the fuel lines?"

Wycliffe shook his head. "No problem. Sometimes engines get finicky."

"Are we in trouble?"

"Well, if we have to ditch in the water, I do pack a dinghy. But my baby'll be okay." And he ran the mixture back to normal.

About an hour later, in a lull in the conversation, he asked, "Well, you know something? I was bettin' my partner that you two would be, like, an item by this time. I guess I lost?"

Bobbie muttered a few expressions of disgust. Then she said, "Everyone seems to think that a single woman and a single man who work okay together and get to be good friends should jump into bed with each other. You don't have to get married to everyone you love, you know."

"You love each other?"

Karel nodded. "Like brother and sister. We believe we are, because of our religion, if not just by being human."

"Well, what have you got against each other?"

Bobbie answered: "Nothing in particular. But we don't want to spend all of our evenings the rest of our lives talking shop at home."

Karel added, "Professional interests can sometimes get in the way of other kinds of interests."

"Okay, so you don't want to be arguing about work at home. I guess I could see how that wouldn't necessarily be too great."

Then he leaned out the fuel mixture again and pretended to nurse it. "C'mon baby keep with us." And returned the fuel mix to normal again.

"There you go," he said as the engine's rhythm restored itself. And, turning back to his passengers, "So, this wonderful, romantic view up here is just wasted on you two?

Bobbie leaned back. "I wouldn't say that. The ocean's beautiful. And romantic. But you know, romance is about adventure. There are many kinds of adventure other than getting married kinds of adventure -- adventures that people who are just friends can share."

Wycliffe almost found himself persuaded, but he was too far off the flight path and into his own plan to back out. Gone too far to back up and admit to them that he was taking them away from their destination, or to admit to himself why it was wrong.

He was repeating the game with the engine as a desert island came into view over the horizon.

"Maybe we'd better put down on that island and look at the engine."

Put yourselves in Karel's and Bobbie's shoes. What would you have them do? Pray? Of course pray.

But how were they supposed to know that Wycliffe was planning to leave them on an uninhabited island for a few days?

Well, both of them prayed in their hearts, but God, for some reason, didn't tell them one way or the other.

Karel looked at Bobbie and she nodded. "Well, if that's the safest route, then go ahead," he said. "Maybe I can help with the engine."

"Do you know anything about engines?" Wycliffe wondered whether they were onto his game.

"I know a little about car engines. But at least I can use a wrench or hold things for you or something. Bobbie is no stranger to engines, either, I think?"

"Actually, I'm certified to fly. I should have mentioned that earlier, but sea flight is not something I've done yet. I've worked on airplane engines, too, but not this kind." She stopped to listen to the engine again. "It does sound like something is making it run lean. Let's put it down."

So Wycliffe landed the plane on the beach and radioed Zedidiah and told him they were on an island they were not on, several hundred miles away.

To get at the tools, they had to unload the luggage and the emergency supplies.

After an hour of fiddling with the engine, Wycliffe said, "I need to take her up and see how she's running. It'll take me about ten minutes of circling the island, and if there aren't any problems, we can fly on."

They both volunteered to help with the test flight, but Wycliffe made an excuse about needing the plane to be light. Once up, he circled twice, brought the airplane down as if to land, and then shouted out at them, "I'll be back when you two have had a chance to grow up!" and flew out.

Neither Karel nor Bobbie heard what he said over the engine noise. So they sat on the beach, said a prayer together for Wycliffe, for the airplane, for themselves, and for getting home, and waited for him to come back.



Now, as I explained in the foreword, I'm just setting up this simplified experiment in economics. If this were a regular novel, we would want to know why Wycliffe never came back.

In fact, there are many things we would want to know ...

... what Wycliffe and Zedidiah were doing in the islands, and whether they were real no-gooders or just having good fun;

... why Wycliffe died and what he did after he died, and how he managed to do so much in apparently so little time after he died (Is time for the dead the same as for us, the living?);

... what Zedidiah did after Wycliffe died;

... how the police and others on the islands got involved; and, hey, what Bobbie and Karel's professors, family, friends, the school, and the Church all did when our co-protagonists failed to return; ....

But, mostly, our focus would be on Karel and Bobbie, since they are the lab subjects of our little experiment.


Foreword Table of Contents Next



[No edit history yet.]



[In the 1st draft.]
[In the 2nd draft.]
[4th draft Economics 101

Monday, April 24, 2017

RFQ3: Table of Contents -- Title Page

(Yet another false start:)

Economics 101, a Novel

Written by Joel Matthew Rees, Amagasaki, Japan.
Copyright 2016, 2017 Joel Matthew Rees
All rights reserved.




Table of Contents

  1. Author's Forward
    in which I try to excuse myself for imposing this overlong rant on the world.
  2. The Framing Story -- the Pilots and the Island
    -- in which two graduate students who have been doing research together find themselves suddenly alone on a desert island.
  3. Priorities Begin to Change
    -- in which Karel and Bobbie discover that they will have more time to explore their desert island.
  4. Wycliffe's Sacrifice
    in which we get to know Wycliffe better just before we lose him.
  5. A Little Cosmology
    -- in which I pretend to have something profound to say about the meaning of God and prayer in Bobbie and Karel's world.
  6. Chapter
    in which .
  7. Chapter
    in which .
  8. Chapter
    in which .
  9. Chapter
    in which .
  10. Chapter
    in which .
  11. (placeholder)
    (placeholder)



This novel is an extract and adaptation of two drafts, which are found in my Freedom Is Not Free and Fantasy Economics blogs.

[1st draft table of contents]
[2nd draft Economics 101 table of contents]
[2nd draft Sociology 500 table of contents]
[4th draft Economics 101]

RFQ3: Forewarned, I mean, Foreword

(Yet another false start:)


Excuses, Excuses


When trying to decipher the physical laws of the universe, we find it easier to start with a simplified model. For example, when describing the flight of a cannonball, we start by ignoring air friction and wind. That makes the math simple enough for one person to handle without a computer in many cases, and the calculated results are close to the actual flight in the common cases.

Economics is not as easily simplified as physics. In physics, we can see, or at least measure the interactions, even when there are interactants we don't directly see, like wind, or electric or magnetic fields.

Of course, gunpowder is not very simple, but we might instead use a catapult or trebuchet to launch the cannonball. We can see what happens, we can measure and time the acceleration paths, etc. And we can compare our results with the path and timing of a dropped cannonball or a cannonball rolling on a slope.

In economics, we deal with complex interactants and abstract interactions. Some of the elements are fairly straightforward, like food, fuel, and housing. Some, like value, are so abstract that we can't safely define them once and expect them not to change.

Some elements of economics, like money, are deceptive simplicities hiding complex and abstract qualities whose continual, often hidden variations play directly into the math.

We need simplifications to be able to work with economics, even with help from computers. But economic interactions are difficult to simplify.

Complex mathematics looks a lot like literature, abstract mathematics even more so.

So, I'll take a hint from the math and make a small logical leap and construct this informal thesis on the fundamentals of economics as a set of thought experiments in the form of a novel.

I'll need a framing story. A good simulation game always has a good framing story, and this is (pretty much) a mental simulation game.

But I need an uncharted, uninhabited island. Such islands no longer exist.

That is, Google took the final steps to eliminating uncharted islands when they introduced their map service.

So I want to set the framing story about fifty or so years ago, when uninhabited islands still seemed like they might stay undiscovered for a while. But some of the simulations won't work in our history, so I'll have to move the story to a different world, far, far away. I'll tell you about that world as we go.

How we get to that world and back to tell the tale, in this universe limited by the speed of light, is a topic I won't address in this novel. (Maybe some day.)

Joel Matthew Rees




Table of Contents Framing Story



[No edit history yet for the 3rd draft.]



[In the 1st draft.]
[In the 2nd draft.]
[4th draft Economics 101

Tuesday, April 11, 2017

Sociology 500, a Romance, ch 3 pt 10 -- Computers

Previous




"Thank you, Karen and Georgia, for volunteering to do the typing." Professor Billings turned back to Ted. "It looks like you've got your chart ready."

"Of course it's just like the first year from the computer generated chart, but it's a little more readable."
      Month   Length Sum    End 
Time-division:  30    30   29.39
Deep-winter:    29    59   58.78
War-time:       30    89   88.18
Thaw-time:      29   118  117.57
Rebirth:        29   147  146.96
Brides-month:   30   177  176.35
Imperious:      29   206  205.75
Glorious:       30   236  235.14
False-summer:   29   265  264.53
Harvest:        29   294  293.92
Gratitude:      30   324  323.31
Winter-month:   29   353  352.71

(You'll notice that some of the names of their months parallel ours and some don't. Winter solstice was usually the first day of Time-division, so that month started earlier than January starts for us.)

"I think I would show this chart to young students instead of the computer generated charts, or at least show it first. And I think it'd work best to have the students help me put the chart up -- ask about each month, add things up, and so forth."

"Sounds good," Professor Billings agreed.

Merill asked, "Is there a reason you didn't have the computer put the names of the months in the computer chart?"

"I was focusing on the math. Eventually, as Professor Billings suggested, I want to use double integers in the sums so I can print out a listing up to the present and beyond. But I haven't written all the double length integer routines yet."

"Can your computer do that?" asked the professor.

"Shouldn't be a problem. It's just a few more functions."

Ultimately, it wasn't a problem for him, and it's only a problem for us if we try to run the code below on an old eight or sixteen bit processor.

"So how much of a problem would it be to have the computer print the names of the months, too?"

Ted laughed. "Not too much. But there are several ways to do it, and I have a bad habit of trying to make the program too general, which means I tend to do things the hard way." Ted did not elaborate. I might explain later.

But I have the same bad habit. Come to think of it, so did Mr. Mon, whom we have heard a little about, 'though not yet by name.

"Nice chart," the professor complimented him.

"Yeah. But I want to write a program to print out a regular calendar for any month of any year, too."

Carl was the one to ask, "You can do that?"

"It should be possible, just a matter of the time to write the program. I should be able to show the phases of the moons, as well."

Georgia asked, with just a little acid in her tone, "So, you just happened to bring this printout today?"

Ted laughed a little shyly, "Not really. I read in the syllabus that we would be studying skip years, and started working on this program Saturday night."

The professor frowned in concern. "Please don't let this put a crimp in your social life."

Ted shrugged.

Mark asked, "So is there a way we could bring this whiz-bang computer into a classroom for students to, I don't know, interact with?"

Ted opened his mouth as if to say, "Sure!", but then he closed it without saying anything. He looked at Dan, as if looking for help.

Dan raised his hands in a hands-off gesture. "Don't look at me."

Ted mumbled, "Maybe, ... maybe not ..."

Dan face showed a bit of consternation. He said, "I'm trying to do what the judge said, too, although you know I don't think he had any authority to put a gag on me."

The classroom was suddenly dead quiet. All ears listened.

Dan continued, "Anyway, sorry, Mark, but Ted can't even say he can't talk about that. And, theoretically, I was not supposed to say what I just said." Dan's expression changed from irritation to amusement. "And I can't believe I just actually used the word, 'theoretically'. And I can't believe I'm going to ask everyone to forget you heard any of this." Chuckling, he shook his head.

There was scattered nervous laughter.

Kristie felt indignant that her friends would be so imposed upon. But, not knowing about the non-disclosure agreement, she didn't know what to think. In fact, this was the first indication she had that Ted and Dan knew each other very well.

Bess spoke up. "My dad is actually working on a device to let computers print things to a television screen. That would be really useful in a classroom. He thinks they will one day be cheap enough to have in regular elementary school classrooms, too."

Dan rolled his eyes, and Ted showed his surprise.

But Dan bit his tongue. Instead of commenting on the futility of non-disclosure agreements, he said, "Really? That's way cool. Does he think the prices of computers themselves will drop, too?"

Now Ted was indignant, but he also held his tongue.

Bess said, excitedly, "Yes, he does. He says according to his calculations, they could eventually be cheap enough and small enough for ordinary people to own."

Many of the students began to talk excitedly about the possibility of having a computer, and about what they might do with one.

Then Professor Billings noticed the clock and said, "Oh. Look at the time. We're done for today."

As the students left, a number of them gathered around Bess and Professor Billings to talk about the possibility of schools being able to afford a computer.

Merill left quietly.

Ted and Dan stayed away from the group and talked in low voices.

"Karel is right," Dan said. "Your old boss ought to be sharing his stuff, not trying to keep it secret so he can patent it all and have a monopoly."

"The more time passes, the more I agree with Karel. Maybe I should have just let the computer go to junk instead of signing the NDA so I could bid on it."

Kristie listened quietly.

"Would it have made any difference about the court order not to talk?"

"I don't know. Karel thought my signature gave weight to Mr. Mon's arguments."

"It puts you and Karel and Merill in a tough spot. Me too, even though I only heard a few things about it from Karel before the gag order was set."

"Sorry about that."

"I'd have gone to have a little talk with that judge, but Dad told me to forget it."

"I couldn't just let the computer go to scrap. All the work we put into it. And the programming system would have just been lost."

"I was wondering about that."

"No, Mr. Mon said we could let people see the high-level code, just not the parts that would be needed to build the system. I think he thought rumors would be good advertising."

"If we were allowed to talk, there'd be even better advertising."

The professor joined them, and asked, "Will what happened now cause trouble for you guys?"

"I don't think so," Ted replied. "I said nothing, and Dan can claim best effort."

Kristie spoke up. "We were going to meet Karel and Bobbie for lunch."

"Ah. Gotta go."

"Me, too."

And they gathered their books and said goodbye to the professor and left.



So, while they go to meet Bobbie and Karel, should we take a look at Ted's work?



( Forth code for calculating idealized lengths of months )
( relative to skip years in the world of )
( Bobbie, Karel, Dan, and Kristi, Sociology 500, a Novel. )

( by Ted Turpin, of the Union of Independent States, Xhilr )
( Earth Copyright 2017, Joel Matthew Rees )

( Permission granted to use for personal entertainment only. )

( -- If you need it for other purposes, rewriting it yourself is not that hard, )
( and the result will be guaranteed to satisfy your needs much more effectively. )



( You can save it as something like "econmonths.fs". )
( In gforth and most modern or emulated environments, )
( just paste it into the terminal of a running Forth session. )

( Run it with

 7 SHOWIDEALMONTHS

  for seven years, etc. )


( Uses integer math throughout. )
( Forth expression syntax is mostly postfix. )
( Only the definition syntax is prefix or infix. )
( I've added some comments with equivalent infix expressions )
( to help those unfamiliar with Forth. )


( Using baroque identifiers for ancient Forths. )
( fig-Forth used first three character + length significance in symbol tables. )


( UM*, FM/MOD, and S>D are already there in most modern Forths. )
( These definitions are only for ancient Forths, )
( especially pre-1983 fig and bif-c. )
( Un-comment them if you see errors like )
( UM* ? err # 0 )
( from PRMONTH or thereabouts. )

( : UM* U* ; ) ( modern name for unsigned mixed multiply )

( This is a cheat! Behavior is not well defined for negative numbers, )
( but we don't do negatives here. )
( So this is just sloppy renaming in a sloppy fashion: )
( : FM/MOD M/MOD DROP ; ) ( unsigned division with modulo remainder )

( : S>D S->D ; ) ( Modern name for single-to-double. )

( Showing the above in infix won't help. )

SP@ SP@ - ABS CONSTANT CELLWIDTH
( Infix won't help here, either, but I can try to explain: )
( CELLWIDTH = absolute-value-of difference-between SP-without-pointer and SP-with-pointer.  )

( Semi-simulate local variables with the ability to fetch and store relative to top of stack. )

( Infix will be confusing here, too. )
: LC@ ( index -- sp[ix] ) ( 0 is top. PICK is available on many modern Forths. )
  1 + CELLWIDTH *  ( Skip over the stack address on stack. )
  SP@ + @  ( Assumes push-down stack. Will fail on push-up. )
;

( Infix will be confusing here, too. )
: LC! ( n index -- ) ( 0 is top. Just store. This is not ROLL. )
  2 + CELLWIDTH *  ( Index and stack address are extra on stack during calculation. )
  SP@ +  ( Assumes push-down stack. )
  ! ( *** Will fail in MISERABLE ways on push-up stacks! *** )
;

( Make things easier to read. )
( Infix will be confusing here, too. )

: PRCH EMIT ;

: COMMA 44 PRCH ;
: COLON 58 PRCH ;
: POINT 46 PRCH ;
: LPAREN 40 PRCH ;
: RPAREN 41 PRCH ;

( No trailing space. )
: PSNUM ( number -- )
 0 .R ;


( Do it in integers! )

( Watch limits on 16 bit processors! )

7 CONSTANT SCYCLE ( years in short cycle )
( SCYCLE = 7 )

7 2 * CONSTANT SPMCYC ( short cycles in medium cycle )
( SPMCYC = 7 × 2 )

SCYCLE SPMCYC * CONSTANT MCYCLE ( years in medium cycle, should be 98 )
( MCYCLE = SCYCLE × SPMCYC )

7 7 * CONSTANT SPLCYC ( short cycles in single long cycle )
( SPLCYC = 7 × 7 )

SCYCLE SPLCYC * CONSTANT LCYCLE ( years in single long cycle, should be 343 )
( LCYCLE = SCYCLE × SPLCYC )

7 CONSTANT MP2LCYC ( medium cycles in double long cycle )
( MP2LCYC = 7 )
( MPLCYC would not be an integer: 3 1/2 )

MCYCLE MP2LCYC * CONSTANT 2LCYCLE ( years in double long cycle, should be 686 )
( 2LCYCLE = MCYCLE × MP2LCYC )

352 CONSTANT DPSKIPYEAR ( floor of days per year  )


5 CONSTANT RDSCYCLE ( remainder days in short cycle )

DPSKIPYEAR SCYCLE * RDSCYCLE + CONSTANT DPSCYCLE ( whole days per 7 year cycle )
( DPSCYCLE = DPSKIPYEAR × SCYCLE + RDSCYCLE )
( DPSCYCLE SPMCYC * CONSTANT DPMCYCLE )
( DPMCYCLE = DPSCYCLE × SPMCYC )
( DPMCYCLE MP2LCYC * CONSTANT DP2LCYCLE )
( DP2LCYCLE = DPMCYCLE × MP2LCYC )
( DPMCYCLE and DP2LCYCLE would overflow on 16 bit math CPUs. )
( No particular problem on 32 bit CPUs.

RDSCYCLE SPMCYC * 1 - CONSTANT RDMCYCLE ( remainder days in medium cycle )
( RDMCYCLE = RDSCYCLE × SPMCYC - 1 )

RDMCYCLE MP2LCYC * 2 + CONSTANT RD2LCYCLE ( remainder days in double long cycle -- odd number )
( RD2LCYCLE = RDMCYCLE × MP2LCYC + 2 )
( RD2LCYCLE / 2LCYCLE is fractional part of year. )
( Ergo, length of year is DPSKIPYEAR + RD2LCYCLE / 2LCYCLE, )
( or 352 485/686 days. )

12 CONSTANT MPYEAR ( months per year )

DPSKIPYEAR MPYEAR /MOD CONSTANT FDMONTH ( floor of days per month )
( FDMONTH = DPSKIPYEAR / MPYEAR )
CONSTANT FRMONTH ( floored minimum remainder days per month )
( FRMONTH = DPSKIPYEAR MOD MPYEAR )

2LCYCLE MPYEAR * CONSTANT MDENOMINATOR ( denominator of month fractional part )
( MDENOMINATOR = 2LCYCLE × MPYEAR  )

FRMONTH 2LCYCLE * RD2LCYCLE + CONSTANT MNUMERATOR ( numerator of month fractional part )
( MNUMERATOR  = FRMONTH × 2LCYCLE + RD2LCYCLE )
( Ergo, length of month is FDMONTH + MNUMERATOR / MDENOMINATOR, )
( or 29 3229/8232 days. )

MDENOMINATOR 2 / CONSTANT MROUNDFUDGE

( Infix will be confusing below here, as well. )
( Hopefully, the comments and explanations will provide enough clues. )

( Sum up the days of the months in a year. )
: SU1MONTH ( startfractional startdays -- endfractional enddays )
  FDMONTH + ( Add the whole part. )
  SWAP ( Make the fractional part available to work on. )
  MNUMERATOR + ( Add the fractional part. )
  DUP MDENOMINATOR < ( Have we got a whole day yet? )
  IF
    SWAP ( No, restore stack order for next pass. )
  ELSE
    MDENOMINATOR - ( Take one whole day from the fractional part. )
    SWAP 1+ ( Restore stack and add the day carried in. )
  ENDIF
;

: PRMONTH ( fractional days -- fractional days )
  SPACE DUP PSNUM POINT ( whole days )
  OVER 1000 UM* ( Fake three digits of decimal precision. )
  MROUNDFUDGE 0 D+ ( Round the bottom digit. )
  MDENOMINATOR FM/MOD ( Divide, or evaluate the fraction. )
  S>D <# # # # #> ( Formatting puts most significant digits in buffer first. )
  TYPE ( Fake decimal output. )
  DROP SPACE
;

: SH1IDEALYEAR ( year daysmemory fractional days -- year daysmemory fractional days )
  CR
  12 0 DO
    3 LC@ PSNUM SPACE ( year )
    I PSNUM COLON SPACE
    SU1MONTH
    DUP 3 LC@ - ( difference in days )
    2 LC@ ( ceiling ) IF 1+ ENDIF
    DUP PSNUM SPACE ( show theoretical days in month )
    3 LC@ + ( sum of days )
    LPAREN DUP PSNUM COMMA SPACE
    2 LC! ( update )
    PRMONTH RPAREN CR
  LOOP
;

: SHOWIDEALMONTHS ( years -- )
  >R
  0 0 0 0 ( year, daysmemory, fractional, days )
  R> 0 DO
    CR
    SH1IDEALYEAR
    3 LC@ 1+ 3 LC!
  LOOP
  DROP DROP DROP DROP
;

  0 CONSTANT SKMONTH
  1 CONSTANT SK1SHORTCYC
  4 CONSTANT SK2SHORTCYC
 48 CONSTANT SKMEDIUMCYC
186 CONSTANT LPLONGCYC  ( Must be short1 or short2 within the seven year cycle. )

( Since skipyears are the exception, )
( we test for skipyears instead of leapyears. )
( Calendar system starts with year 0, not year 1. )
( Would need to check and adjust if the calendar started with year )
: ISKIPYEAR ( year -- flag )
  DUP MCYCLE MOD SKMEDIUMCYC =
  IF DROP -1  ( One specified extra skip year in medium cycle. )
  ELSE
    DUP SCYCLE MOD DUP
    SK1SHORTCYC =
    SWAP SK2SHORTCYC = OR  ( Two specified skip years in short cycle, but ... )
    SWAP LCYCLE MOD LPLONGCYC = 0= AND ( not the specified exception in the long cycle. )
  ENDIF
;


( At this point, I hit a condundrum. )
( Modern "standard" Forths want uninitialized variables, )
( but ancient, especially fig-Forths want initialized variables. )
( The lower-level <BUILDS DOES> for fig is only partially part of the modern standard. )
( And CREATE is initialized as a CONSTANT in the fig-Forth, )
( but has no initial characteristic code or value in modern standards. )
( So. )
( On ancient Forths, VARIABLE wants an initial value. We give it a zero. )
( The zero stays around forever on modern Forths, or until you drop it. )
0 VARIABLE DIMARRAY  ( Days In Months array )
   30 DIMARRAY !  ( 1st month )
   29 ,
   30 ,
   29 ,
   29 ,
   30 ,
   29 ,
   30 ,
   29 ,
   29 ,
   30 ,
   29 ,
   0 ,

: DIMONTH ( year month -- days )
  DUP 0 < 0=
  OVER MPYEAR < AND 0=
  IF
    DROP DROP 0  ( Out of range. No days. )
  ELSE
    DUP CELLWIDTH * DIMARRAY + @  ( Get the basic days. )
    SWAP SKMONTH =  ( true if skip month )
    ROT ISKIPYEAR AND  ( true if skip month of skip year )
    1 AND - ( Subtrahend is 1 only if skip month of skip year. )
  ENDIF
;
   
: SH1YEAR ( year daysmemory fractional days -- year daysmemory fractional days )
  CR
  12 0 DO
    3 LC@ PSNUM SPACE ( year )
    I PSNUM COLON SPACE
    SU1MONTH  ( ideal month )
    3 LC@ I DIMONTH  ( real month )
    DUP PSNUM SPACE ( show days in month )
    3 LC@ + ( sum of days )
    LPAREN DUP PSNUM COMMA SPACE
    2 LC! ( update )
    PRMONTH RPAREN CR
  LOOP
;

: SHOWMONTHS ( years -- )
  >R
  0 0 0 0 ( year, daysmemory, fractional, days )
  R> 0 DO
    CR
    SH1YEAR
    3 LC@ 1+ 3 LC!
  LOOP
  DROP DROP DROP DROP
;



Copying and pasting from here doesn't work very well. You can download the source code from
https://osdn.net/users/reiisi/pastebin/4990
You can save the file as something like "econmonths.fs".

In most modern Forths, you can just paste it into a running Forth session, and run it with
7 SHOWIDEALMONTHS
to show the ideal months that Ted talks about here, or
7 SHOWMONTHS
to show the months by the skip years, according to their calendar. You can compare the two, to see how their skip years keep the slippage minimal, restoring to no slippage at all after six hundred eight-six years.

If you need a Forth to run it on, you can find gforth at
<https://www.gnu.org/software/gforth/>.
You can also find it in the packages of most modern OS distributions and in many application stores. (It is Android's store, but not in iOS's, at least, not at the time I wrote this.) For MSWindows, you can download Cygwin at <https://www.cygwin.com/> and get gforth through the Cygwin packages.

If you like to compile things like this yourself, I guess I won't need to tell you how.

HTML documentation can be found on the web at <http://www.complang.tuwien.ac.at/forth/gforth/Docs-html/>, which includes a tutorial for experienced programmers. An easier tutorial can be found in the book, Starting Forth, which can be found here: <https://www.forth.com/starting-forth/>.

Gforth is not the only Forth which will work, I think most modern Forths will run the code without modification.

The newsgroup comp.lang.forth, which can be accessed through newsreaders and various web interfaces is a good source of amusing and sometimes informative conversation about Forth.

If you like compiling things to play with, I have my own Forth, written in C, which you can find here: <http://bif-c.sourceforge.net/>. You'll want to look at the wiki, too: <https://sourceforge.net/p/bif-c/wiki/Home/>.

If Forth's postfix syntax is uncomfortable, I wrote similar programs in the Basic Calulator utility, bc, which is generally part of most modern operating system distributions without having to get it from packages. (You can get it as a package through Cygwin if you are running one of Microsoft's OSses.)

Just run "bc" from the command line and paste in the bc code, which you can get here: <https://osdn.net/users/reiisi/pastebin/4988>.

And, as I suggest in the code comments, you might modify the code to see how well your own leap year system works for your world. (Pretty well, really.)



You may have noticed, their calendar includes zeros. Years, months, days, all start with the zeroeth. That's a little different from us, isn't it?

And you're probably wondering about hours and minutes at this point. Similar to the way it happened in our world, the 12 constellations that represented the months also represented the hours of the night. Day and night were divided into four watches, and the night had three constellations per watch, so the day did, too.

Then some bright soul recognized that day and night varied in length, and instead of tying the hours to dawn or sunset, tied them to noon. And the royalty of his country liked it and it stuck for the more progressive parts of the world.

Sixty minute hours were derived from twelves, to give sixty minute hours and sixty second minutes. And that's convenient for us, because we could get confused if they used hundreds or forty-nines or base two.

(I really would have liked to show Ted's original programs. But I would have to write the emulator for the hardware he used, write the assembler and use it to bootstrap the language interpreter, write tools for converting -- meaningfully -- from their character set to ours, and so on. And I'd want to construct a font for their characters, too. That's a lot of work. Maybe if I ever write a best seller and make a million dollars off of it, I'll be able to break loose the time and hire the employees to do such a thing. ;-)

Previous TOC Next



[Backup and edit history are here: http://joel-rees-economics.blogspot.com/2017/04/backup-soc500-03-10-computers.html.]




[Chapter 3 part 10 is original to the second draft, and is not found in the first draft. Chronologically, it would be placed in chapter five of the first draft: http://free-is-not-free.blogspot.com/2016/05/economics-101-novel-ch05-first-semester.html.]



Backup: Sociology 500, a Romance, ch 3 pt 10 -- Computers

[JMR201704121825: metadata edits -- Title/name.]

Sociology 500, a {replace}Novel{with}Romance{replace.}, ch 3 pt 10 -- Computers

[JMR201704121825: end metadata edit.]


[JMR201704121022: edits -- cleanup.]

"{replace}It's{with}Of course it's{replace.} just like the first year from the computer generated chart, but a little more readable."

---------------

(You'll notice that some of the names of their months parallel ours and some don't. Winter solstice was usually the first day of Time-division, so {replace}it{with}that month{replace.} started earlier than January starts for us.)

---------------

"Shouldn't be a problem. It's just {replace}another function{with}a few more functions{replace.}."

---------------

But I have the same bad habit. Come to think of it, so did Mr. Mon, whom we have heard a little about, {replace}but{with}'though{replace.} not yet by name.

---------------

Dan continued, "Anyway, sorry, Mark, but Ted can't even say he can't talk about that. And, theoretically, I was not supposed to say what I just said." Dan's expression changed from irritation to amusement. "And I can't believe I just actually used the word, 'theoretically'. And I can't believe I'm going to ask everyone to forget you heard any of this."{add} Chuckling, he shook his head.{add.}

---------------

Bess said, {add}excitedly, {add.}"Yes, he does. He says according to his calculations, they could eventually be cheap enough and small enough for ordinary people to own."

---------------

{replace}The{with}Many of the{replace.} students began to talk excitedly about the possibility of having a computer{replace} and{with}, and about{replace.} what they might do with one.

---------------

Then Professor Billings {add}noticed the clock {add.}and said, "Oh. Look at the time. {replace}Class dismissed{with}We're done for today{replace.}."

---------------

"The more time passes, the more I {replace}think Karel was right{with}agree with Karel{replace.}. Maybe I should have just let the computer go to junk instead of signing the NDA so I could bid on it."

---------------

"I'd have gone to {replace}give the judge a piece of my mind{with}have a little talk with that judge{replace.}, but Dad told me to forget it."

---------------

So, while they go to meet Bobbie and Karel, should we take a look at Ted's {replace}programs{with]work{replace.}?

[JMR201704121022: end-edits.]

[JMR201704120928: backup of http://joel-rees-economics.blogspot.com/2017/04/soc500-03-10-computers.html.]
Previous




"Thank you, Karen and Georgia, for volunteering to do the typing." Professor Billings turned back to Ted. "It looks like you've got your chart ready."

"It's just like the first year from the computer generated chart, but a little more readable."
      Month   Length Sum    End 
Time-division:  30    30   29.39
Deep-winter:    29    59   58.78
War-time:       30    89   88.18
Thaw-time:      29   118  117.57
Rebirth:        29   147  146.96
Brides-month:   30   177  176.35
Imperious:      29   206  205.75
Glorious:       30   236  235.14
False-summer:   29   265  264.53
Harvest:        29   294  293.92
Gratitude:      30   324  323.31
Winter-month:   29   353  352.71

(You'll notice that some of the names of their months parallel ours and some don't. Winter solstice was usually the first day of Time-division, so it started earlier than January starts for us.)

"I think I would show this chart to young students instead of the computer generated charts, or at least show it first. And I think it'd work best to have the students help me put the chart up -- ask about each month, add things up, and so forth."

"Sounds good," Professor Billings agreed.

Merill asked, "Is there a reason you didn't have the computer put the names of the months in the computer chart?"

"I was focusing on the math. Eventually, as Professor Billings suggested, I want to use double integers in the sums so I can print out a listing up to the present and beyond. But I haven't written all the double length integer routines yet."

"Can your computer do that?" asked the professor.

"Shouldn't be a problem. It's just another function."

Ultimately, it wasn't a problem for him, and it's only a problem for us if we try to run the code below on an old eight or sixteen bit processor.

"So how much of a problem would it be to have the computer print the names of the months, too?"

Ted laughed. "Not too much. But there are several ways to do it, and I have a bad habit of trying to make the program too general, which means I tend to do things the hard way." Ted did not elaborate. I might explain later.

But I have the same bad habit. Come to think of it, so did Mr. Mon, whom we have heard a little about, but not yet by name.

"Nice chart," the professor complimented him.

"Yeah. But I want to write a program to print out a regular calendar for any month of any year, too."

Carl was the one to ask, "You can do that?"

"It should be possible, just a matter of the time to write the program. I should be able to show the phases of the moons, as well."

Georgia asked, with just a little acid in her tone, "So, you just happened to bring this printout today?"

Ted laughed a little shyly, "Not really. I read in the syllabus that we would be studying skip years, and started working on this program Saturday night."

The professor frowned in concern. "Please don't let this put a crimp in your social life."

Ted shrugged.

Mark asked, "So is there a way we could bring this whiz-bang computer into a classroom for students to, I don't know, interact with?"

Ted opened his mouth as if to say, "Sure!", but then he closed it without saying anything. He looked at Dan, as if looking for help.

Dan raised his hands in a hands-off gesture. "Don't look at me."

Ted mumbled, "Maybe, ... maybe not ..."

Dan face showed a bit of consternation. He said, "I'm trying to do what the judge said, too, although you know I don't think he had any authority to put a gag on me."

The classroom was suddenly dead quiet. All ears listened.

Dan continued, "Anyway, sorry, Mark, but Ted can't even say he can't talk about that. And, theoretically, I was not supposed to say what I just said." Dan's expression changed from irritation to amusement. "And I can't believe I just actually used the word, 'theoretically'. And I can't believe I'm going to ask everyone to forget you heard any of this."

There was scattered nervous laughter.

Kristie felt indignant that her friends would be so imposed upon. But, not knowing about the non-disclosure agreement, she didn't know what to think. In fact, this was the first indication she had that Ted and Dan knew each other very well.

Bess spoke up. "My dad is actually working on a device to let computers print things to a television screen. That would be really useful in a classroom. He thinks they will one day be cheap enough to have in regular elementary school classrooms, too."

Dan rolled his eyes, and Ted showed his surprise.

But Dan bit his tongue. Instead of commenting on the futility of non-disclosure agreements, he said, "Really? That's way cool. Does he think the prices of computers themselves will drop, too?"

Now Ted was indignant, but he also held his tongue.

Bess said, "Yes, he does. He says according to his calculations, they could eventually be cheap enough and small enough for ordinary people to own."

The students began to talk excitedly about the possibility of having a computer and what they might do with one.

Then Professor Billings said, "Oh. Look at the time. Class dismissed."

As the students left, a number of them gathered around Bess and Professor Billings to talk about the possibility of schools being able to afford a computer.

Merill left quietly.

Ted and Dan stayed away from the group and talked in low voices.

"Karel is right," Dan said. "Your old boss ought to be sharing his stuff, not trying to keep it secret so he can patent it all and have a monopoly."

"The more time passes, the more I think Karel was right. Maybe I should have just let the computer go to junk instead of signing the NDA so I could bid on it."

Kristie listened quietly.

"Would it have made any difference about the court order not to talk?"

"I don't know. Karel thought my signature gave weight to Mr. Mon's arguments."

"It puts you and Karel and Merill in a tough spot. Me too, even though I only heard a few things about it from Karel before the gag order was set."

"Sorry about that."

"I'd have gone to give the judge a piece of my mind, but Dad told me to forget it."

"I couldn't just let the computer go to scrap. All the work we put into it. And the programming system would have just been lost."

"I was wondering about that."

"No, Mr. Mon said we could let people see the high-level code, just not the parts that would be needed to build the system. I think he thought rumors would be good advertising."

"If we were allowed to talk, there'd be even better advertising."

The professor joined them, and asked, "Will what happened now cause trouble for you guys?"

"I don't think so," Ted replied. "I said nothing, and Dan can claim best effort."

Kristie spoke up. "We were going to meet Karel and Bobbie for lunch."

"Ah. Gotta go."

"Me, too."

And they gathered their books and said goodbye to the professor and left.



So, while they go to meet Bobbie and Karel, should we take a look at Ted's programs?



( Forth code for calculating idealized lengths of months )
( relative to skip years in the world of )
( Bobbie, Karel, Dan, and Kristi, Sociology 500, a Novel. )

( by Ted Turpin, of the Union of Independent States, Xhilr )
( Earth Copyright 2017, Joel Matthew Rees )

( Permission granted to use for personal entertainment only. )

( -- If you need it for other purposes, rewriting it yourself is not that hard, )
( and the result will be guaranteed to satisfy your needs much more effectively. )



( You can save it as something like "econmonths.fs". )
( In gforth and most modern or emulated environments, )
( just paste it into the terminal of a running Forth session. )

( Run it with

 7 SHOWIDEALMONTHS

  for seven years, etc. )


( Uses integer math throughout. )
( Forth expression syntax is mostly postfix. )
( Only the definition syntax is prefix or infix. )
( I've added some comments with equivalent infix expressions )
( to help those unfamiliar with Forth. )


( Using baroque identifiers for ancient Forths. )
( fig-Forth used first three character + length significance in symbol tables. )


( UM*, FM/MOD, and S>D are already there in most modern Forths. )
( These definitions are only for ancient Forths, )
( especially pre-1983 fig and bif-c. )
( Un-comment them if you see errors like )
( UM* ? err # 0 )
( from PRMONTH or thereabouts. )

( : UM* U* ; ) ( modern name for unsigned mixed multiply )

( This is a cheat! Behavior is not well defined for negative numbers, )
( but we don't do negatives here. )
( So this is just sloppy renaming in a sloppy fashion: )
( : FM/MOD M/MOD DROP ; ) ( unsigned division with modulo remainder )

( : S>D S->D ; ) ( Modern name for single-to-double. )

( Showing the above in infix won't help. )

SP@ SP@ - ABS CONSTANT CELLWIDTH
( Infix won't help here, either, but I can try to explain: )
( CELLWIDTH = absolute-value-of difference-between SP-without-pointer and SP-with-pointer.  )

( Semi-simulate local variables with the ability to fetch and store relative to top of stack. )

( Infix will be confusing here, too. )
: LC@ ( index -- sp[ix] ) ( 0 is top. PICK is available on many modern Forths. )
  1 + CELLWIDTH *  ( Skip over the stack address on stack. )
  SP@ + @  ( Assumes push-down stack. Will fail on push-up. )
;

( Infix will be confusing here, too. )
: LC! ( n index -- ) ( 0 is top. Just store. This is not ROLL. )
  2 + CELLWIDTH *  ( Index and stack address are extra on stack during calculation. )
  SP@ +  ( Assumes push-down stack. )
  ! ( *** Will fail in MISERABLE ways on push-up stacks! *** )
;

( Make things easier to read. )
( Infix will be confusing here, too. )

: PRCH EMIT ;

: COMMA 44 PRCH ;
: COLON 58 PRCH ;
: POINT 46 PRCH ;
: LPAREN 40 PRCH ;
: RPAREN 41 PRCH ;

( No trailing space. )
: PSNUM ( number -- )
 0 .R ;


( Do it in integers! )

( Watch limits on 16 bit processors! )

7 CONSTANT SCYCLE ( years in short cycle )
( SCYCLE = 7 )

7 2 * CONSTANT SPMCYC ( short cycles in medium cycle )
( SPMCYC = 7 × 2 )

SCYCLE SPMCYC * CONSTANT MCYCLE ( years in medium cycle, should be 98 )
( MCYCLE = SCYCLE × SPMCYC )

7 7 * CONSTANT SPLCYC ( short cycles in single long cycle )
( SPLCYC = 7 × 7 )

SCYCLE SPLCYC * CONSTANT LCYCLE ( years in single long cycle, should be 343 )
( LCYCLE = SCYCLE × SPLCYC )

7 CONSTANT MP2LCYC ( medium cycles in double long cycle )
( MP2LCYC = 7 )
( MPLCYC would not be an integer: 3 1/2 )

MCYCLE MP2LCYC * CONSTANT 2LCYCLE ( years in double long cycle, should be 686 )
( 2LCYCLE = MCYCLE × MP2LCYC )

352 CONSTANT DPSKIPYEAR ( floor of days per year  )


5 CONSTANT RDSCYCLE ( remainder days in short cycle )

DPSKIPYEAR SCYCLE * RDSCYCLE + CONSTANT DPSCYCLE ( whole days per 7 year cycle )
( DPSCYCLE = DPSKIPYEAR × SCYCLE + RDSCYCLE )
( DPSCYCLE SPMCYC * CONSTANT DPMCYCLE )
( DPMCYCLE = DPSCYCLE × SPMCYC )
( DPMCYCLE MP2LCYC * CONSTANT DP2LCYCLE )
( DP2LCYCLE = DPMCYCLE × MP2LCYC )
( DPMCYCLE and DP2LCYCLE would overflow on 16 bit math CPUs. )
( No particular problem on 32 bit CPUs.

RDSCYCLE SPMCYC * 1 - CONSTANT RDMCYCLE ( remainder days in medium cycle )
( RDMCYCLE = RDSCYCLE × SPMCYC - 1 )

RDMCYCLE MP2LCYC * 2 + CONSTANT RD2LCYCLE ( remainder days in double long cycle -- odd number )
( RD2LCYCLE = RDMCYCLE × MP2LCYC + 2 )
( RD2LCYCLE / 2LCYCLE is fractional part of year. )
( Ergo, length of year is DPSKIPYEAR + RD2LCYCLE / 2LCYCLE, )
( or 352 485/686 days. )

12 CONSTANT MPYEAR ( months per year )

DPSKIPYEAR MPYEAR /MOD CONSTANT FDMONTH ( floor of days per month )
( FDMONTH = DPSKIPYEAR / MPYEAR )
CONSTANT FRMONTH ( floored minimum remainder days per month )
( FRMONTH = DPSKIPYEAR MOD MPYEAR )

2LCYCLE MPYEAR * CONSTANT MDENOMINATOR ( denominator of month fractional part )
( MDENOMINATOR = 2LCYCLE × MPYEAR  )

FRMONTH 2LCYCLE * RD2LCYCLE + CONSTANT MNUMERATOR ( numerator of month fractional part )
( MNUMERATOR  = FRMONTH × 2LCYCLE + RD2LCYCLE )
( Ergo, length of month is FDMONTH + MNUMERATOR / MDENOMINATOR, )
( or 29 3229/8232 days. )

MDENOMINATOR 2 / CONSTANT MROUNDFUDGE

( Infix will be confusing below here, as well. )
( Hopefully, the comments and explanations will provide enough clues. )

( Sum up the days of the months in a year. )
: SU1MONTH ( startfractional startdays -- endfractional enddays )
  FDMONTH + ( Add the whole part. )
  SWAP ( Make the fractional part available to work on. )
  MNUMERATOR + ( Add the fractional part. )
  DUP MDENOMINATOR < ( Have we got a whole day yet? )
  IF
    SWAP ( No, restore stack order for next pass. )
  ELSE
    MDENOMINATOR - ( Take one whole day from the fractional part. )
    SWAP 1+ ( Restore stack and add the day carried in. )
  ENDIF
;

: PRMONTH ( fractional days -- fractional days )
  SPACE DUP PSNUM POINT ( whole days )
  OVER 1000 UM* ( Fake three digits of decimal precision. )
  MROUNDFUDGE 0 D+ ( Round the bottom digit. )
  MDENOMINATOR FM/MOD ( Divide, or evaluate the fraction. )
  S>D <# # # # #> ( Formatting puts most significant digits in buffer first. )
  TYPE ( Fake decimal output. )
  DROP SPACE
;

: SH1IDEALYEAR ( year daysmemory fractional days -- year daysmemory fractional days )
  CR
  12 0 DO
    3 LC@ PSNUM SPACE ( year )
    I PSNUM COLON SPACE
    SU1MONTH
    DUP 3 LC@ - ( difference in days )
    2 LC@ ( ceiling ) IF 1+ ENDIF
    DUP PSNUM SPACE ( show theoretical days in month )
    3 LC@ + ( sum of days )
    LPAREN DUP PSNUM COMMA SPACE
    2 LC! ( update )
    PRMONTH RPAREN CR
  LOOP
;

: SHOWIDEALMONTHS ( years -- )
  >R
  0 0 0 0 ( year, daysmemory, fractional, days )
  R> 0 DO
    CR
    SH1IDEALYEAR
    3 LC@ 1+ 3 LC!
  LOOP
  DROP DROP DROP DROP
;

  0 CONSTANT SKMONTH
  1 CONSTANT SK1SHORTCYC
  4 CONSTANT SK2SHORTCYC
 48 CONSTANT SKMEDIUMCYC
186 CONSTANT LPLONGCYC  ( Must be short1 or short2 within the seven year cycle. )

( Since skipyears are the exception, )
( we test for skipyears instead of leapyears. )
( Calendar system starts with year 0, not year 1. )
( Would need to check and adjust if the calendar started with year )
: ISKIPYEAR ( year -- flag )
  DUP MCYCLE MOD SKMEDIUMCYC =
  IF DROP -1  ( One specified extra skip year in medium cycle. )
  ELSE
    DUP SCYCLE MOD DUP
    SK1SHORTCYC =
    SWAP SK2SHORTCYC = OR  ( Two specified skip years in short cycle, but ... )
    SWAP LCYCLE MOD LPLONGCYC = 0= AND ( not the specified exception in the long cycle. )
  ENDIF
;


( At this point, I hit a condundrum. )
( Modern "standard" Forths want uninitialized variables, )
( but ancient, especially fig-Forths want initialized variables. )
( The lower-level <BUILDS DOES> for fig is only partially part of the modern standard. )
( And CREATE is initialized as a CONSTANT in the fig-Forth, )
( but has no initial characteristic code or value in modern standards. )
( So. )
( On ancient Forths, VARIABLE wants an initial value. We give it a zero. )
( The zero stays around forever on modern Forths, or until you drop it. )
0 VARIABLE DIMARRAY  ( Days In Months array )
   30 DIMARRAY !  ( 1st month )
   29 ,
   30 ,
   29 ,
   29 ,
   30 ,
   29 ,
   30 ,
   29 ,
   29 ,
   30 ,
   29 ,
   0 ,

: DIMONTH ( year month -- days )
  DUP 0 < 0=
  OVER MPYEAR < AND 0=
  IF
    DROP DROP 0  ( Out of range. No days. )
  ELSE
    DUP CELLWIDTH * DIMARRAY + @  ( Get the basic days. )
    SWAP SKMONTH =  ( true if skip month )
    ROT ISKIPYEAR AND  ( true if skip month of skip year )
    1 AND - ( Subtrahend is 1 only if skip month of skip year. )
  ENDIF
;
   
: SH1YEAR ( year daysmemory fractional days -- year daysmemory fractional days )
  CR
  12 0 DO
    3 LC@ PSNUM SPACE ( year )
    I PSNUM COLON SPACE
    SU1MONTH  ( ideal month )
    3 LC@ I DIMONTH  ( real month )
    DUP PSNUM SPACE ( show days in month )
    3 LC@ + ( sum of days )
    LPAREN DUP PSNUM COMMA SPACE
    2 LC! ( update )
    PRMONTH RPAREN CR
  LOOP
;

: SHOWMONTHS ( years -- )
  >R
  0 0 0 0 ( year, daysmemory, fractional, days )
  R> 0 DO
    CR
    SH1YEAR
    3 LC@ 1+ 3 LC!
  LOOP
  DROP DROP DROP DROP
;



Copying and pasting from here doesn't work very well. You can download the source code from
https://osdn.net/users/reiisi/pastebin/4990
You can save the file as something like "econmonths.fs".

In most modern Forths, you can just paste it into a running Forth session, and run it with
7 SHOWIDEALMONTHS
to show the ideal months that Ted talks about here, or
7 SHOWMONTHS
to show the months by the skip years, according to their calendar. You can compare the two, to see how their skip years keep the slippage minimal, restoring to no slippage at all after six hundred eight-six years.

If you need a Forth to run it on, you can find gforth at
<https://www.gnu.org/software/gforth/>.
You can also find it in the packages of most modern OS distributions and in many application stores. (It is Android's store, but not in iOS's, at least, not at the time I wrote this.) For MSWindows, you can download Cygwin at <https://www.cygwin.com/> and get gforth through the Cygwin packages.

If you like to compile things like this yourself, I guess I won't need to tell you how.

HTML documentation can be found on the web at <http://www.complang.tuwien.ac.at/forth/gforth/Docs-html/>, which includes a tutorial for experienced programmers. An easier tutorial can be found in the book, Starting Forth, which can be found here: <https://www.forth.com/starting-forth/>.

Gforth is not the only Forth which will work, I think most modern Forths will run the code without modification.

The newsgroup comp.lang.forth, which can be accessed through newsreaders and various web interfaces is a good source of amusing and sometimes informative conversation about Forth.

If you like compiling things to play with, I have my own Forth, written in C, which you can find here: <http://bif-c.sourceforge.net/>. You'll want to look at the wiki, too: <https://sourceforge.net/p/bif-c/wiki/Home/>.

If Forth's postfix syntax is uncomfortable, I wrote similar programs in the Basic Calulator utility, bc, which is generally part of most modern operating system distributions without having to get it from packages. (You can get it as a package through Cygwin if you are running one of Microsoft's OSses.)

Just run "bc" from the command line and paste in the bc code, which you can get here: <https://osdn.net/users/reiisi/pastebin/4988>.

And, as I suggest in the code comments, you might modify the code to see how well your own leap year system works for your world. (Pretty well, really.)



You may have noticed, their calendar includes zeros. Years, months, days, all start with the zeroeth. That's a little different from us, isn't it?

And you're probably wondering about hours and minutes at this point. Similar to the way it happened in our world, the 12 constellations that represented the months also represented the hours of the night. Day and night were divided into four watches, and the night had three constellations per watch, so the day did, too.

Then some bright soul recognized that day and night varied in length, and instead of tying the hours to dawn or sunset, tied them to noon. And the royalty of his country liked it and it stuck for the more progressive parts of the world.

Sixty minute hours were derived from twelves, to give sixty minute hours and sixty second minutes. And that's convenient for us, because we could get confused if they used hundreds or forty-nines or base two.

(I really would have liked to show Ted's original programs. But I would have to write the emulator for the hardware he used, write the assembler and use it to bootstrap the language interpreter, write tools for converting -- meaningfully -- from their character set to ours, and so on. And I'd want to construct a font for their characters, too. That's a lot of work. Maybe if I ever write a best seller and make a million dollars off of it, I'll be able to break loose the time and hire the employees to do such a thing. ;-)

Previous TOC Next



[Backup and edit history will eventually be here: http://joel-rees-economics.blogspot.com/2017/04/backup-soc500-03-10-computers.html.]




[Chapter 3 part 10 is original to the second draft, and is not found in the first draft. Chronologically, it would be placed in chapter five of the first draft: http://free-is-not-free.blogspot.com/2016/05/economics-101-novel-ch05-first-semester.html.]

[JMR201704120928: end-backup.]

Saturday, April 8, 2017

Backup: Sociology 500, a Novel, ch 3 pt 9 -- Calculating Months in Skip Years

[JMR201704101934: edits -- forgotten structure.]


[Backup and edit history {replace}will eventually be{with}are{replace.} here: http://joel-rees-economics.blogspot.com/2017/04/backup-soc500-03-09-calculating-months-skip-years.html.]

[JMR201704101934: end-edits.]


[JMR201704082007: edits -- minor stuff.]

To which Professor Billings said, "Ted is being kind enough to loan it to the department." The department had had to {replace}scramble{with}scrounge{replace.} for the budget for the electricity, and we'll find out more about that later. The professor {replace}added{with}asked{replace.}, "Do you have the printout with you?"

[JMR201704082007: end-edits.]

[JMR201704081836: backup of http://joel-rees-economics.blogspot.com/2017/04/soc500-03-09-calculating-months-skip-years.html.]
Previous




Ted picked up the model of the solar system and demonstrated the orbit of their planet again. "We should focus the children's attention on the tilt of the earth, as Jack diagrammed. It would probably be good to review the reasons for the seasons."

Georgia asked, "When the north pole is tilted towards the sun, that's summer for us in the northern hemisphere, right?"

Professor Billings asked, "Anyone still not clear on that point? You don't want to find yourself in class, wondering which is which, with students looking at you and expecting you to know all the answers."

Jack asked, "Isn't the physics of the seasons obvious? I mean, we would expect to not even need that model in high school, right?"

Karen complained. "It's obvious to you. I'm still trying to figure it out. Is the sun that much closer to us in summer?"

"Yeah," Jack replied sarcastically. "A fraction of a percent makes that much difference."

"Jack, you'll confuse people." said Merill. "Karen, think of the sun against your car roof. At an angle, the light tends to reflect more."

Jack grumbled. "Maybe, maybe not."

"Okay," Karen said hesitantly. "I can see the angle being important. There was a teacher who explained it to us as distance when I was in elementary school, and I've been confused since then."

Ted said, "Well, it is partly distance, but the distance that is relevant is the distance through the atmosphere due to the angle, not the distance from the sun. But, more basically, like Merill says, the angle reduces the amount of sunlight that reaches the surface. And that's more important." And he drew a diagram on the chalkboard, of sunlight hitting their earth:


Karen still looked puzzled. "I'm not seeing it."

So Kristie stood up and said, "There's another way to draw that diagram that helped me." And she drew a second version of the diagram, using a polygon instead of a circle:



"It helped me see that the deeper angle reduces the amount of sunlight for the same amount of surface area." Then she picked up a textbook and held it in front of a window, rotating it to show the area being struck by sunlight. "Like this."

Karen thought a few moments and said, "Thanks, I think I can see that."

Kristie gave the chalk back to Ted and he started started writing out a chart on the chalkboard.

Dan grumbled. "You and Karel."

Kristie smiled as she sat down, and members of the class who knew our four protagonists laughed.

Karen continued after some thought, "I think I can probably draw diagrams like that in a class."

While Ted wrote, Professor Billings pointed out, "This kind of discussion often does much more than a lecture." He paused. "You may feel a little out of control, during the discussion, but I strongly urge you to learn to use this kind of discussion, in every grade you teach."

Ted turned around. "And if we can get the students to draw the diagrams and write the math on the board themselves, that works even better, right?"

"You've heard it before."

General laughter.

"So," Ted returned to the board, to the left of the chart he had been working on, and said, "if we can satisfy the students about the measured length of the solar year, we can tell them that the length of the year is three hundred fifty-two whole days and four hundred eighty-five six eighty-sixths of a day. But we probably want to show them decimal fractions, too:
1 year: 352 485/686 days (about 352.7070)
Carl asked, "How do we connect that with sevens?"

Dan said, "Write the factors on the board, two times seven cubed."

Ted stopped, and he and many of the students turned to look at Dan.

"What? I didn't say I couldn't do any math at all, just not comfortable with some of it." Dan was grinning sheepishly.

More laughter, which Ted and Dan joined as Ted wrote out the factors on the board:
2 × 7 = 14, 14 × 7 = 98
98 × 7 = 686, 686 ÷ 2 = 343
Dan continued, "And we could work out the decimal fraction, to show how close it is to five sevenths. Should I work that out?"

Professor Billing smiled and held up a piece of chalk, which Dan took to a chalkboard at the side of the room, to show the long division for 5/7 and 485/686:
   0.714287             0.70699
 -----------        -------------
7| 5.0000000     686| 485.0000000
   4.9                480.2
     10                 4.800
     07                 4.116
      30                  6840
      28                  6174
       20                  6660
       14                  6174
        60                  4860
        56   
         40  
         35 
          50
And Dan sat down.

Carl pressed the question. "Is that the closest small fraction?"

Ted said, "Actually, I've got a chart of fractions that I printed up on the computer, where we can get a look at that question."

There were some complaints.

"Braggart."

And, "How come he's so lucky?"

Etc.

To which Professor Billings said, "Ted is being kind enough to loan it to the department." The department had had to scramble for the budget for the electricity, and we'll find out more about that later. The professor added, "Do you have the printout with you?"

"Yeah."

"I'll go get the overhead projector."

"I'll help you," Mark volunteered, and Mark followed the professor into the prep room as Ted went back to writing on the board.

Do you remember those heavy, hot, smelly, fragile overhead projectors we used to use, back in the 1950s and '60s? And big. That was what Mark and the professor emerged carrying. They set it up on a desk in front of a screen and plugged it into the wall to get the lamp warming up while Ted continued his explanation.

"We probably want to ask how many months in a year and show the division:"
1 ideal month: 352.7070 ÷ 12 = 29.39225 days
"Ideal month?" queried the professor.

"We can say it's some crazy professor's idea of a better month, but it isn't a real month."

"That explanation of ideal might work."

Ted continued, "Here's a question I think young kids will find interesting: If we used this exact length for the month, at what hour of the day on January 30th would it become February 1st?" And he showed them where he had written out the math for that, to the side of the still incomplete chart:
0.39225 * 24 = 9.414 hours
0.414 * 60 = 24.84 minutes
Before 9:25 A.M., January 30th.
After 9:25, February 1st.
While the other students absorbed that, he continued, "Then we can ask whether they would think it interesting for January thirtieth to suddenly turn into February first at about nine twenty five in the morning."

Jack suggested, "That's going to get some students excited, maybe too excited."

Dan chuckled. "It's the kind of thing Karel would say just as we split up for our specialty practice. Make sure we had plenty of time to think about it."

Kristie suggested, "Maybe you could save it until just before lunchtime? then the students would have lots of time to talk about it and forget their excitement."

Jack scratched his head. "Maybe, if you could get the timing right."

The professor was chuckling. He suggested, "Ted, let's look at your chart of fractions."

Ted dug a computer printout out of his books and handed it to the professor, who put it on the overhead projector's light stage.



: PRCH EMIT ;

: COMMA 44 PRCH ;
: COLON 58 PRCH ;

( No trailing space. )
: PSNUM ( number -- )
  0 .R ;

: NUMERATORS ( count -- )
DUP 1+ 0 DO
   I PSNUM COLON SPACE
   I 1000 * OVER / PSNUM COMMA ( 1000 times I divided by count )
   SPACE LOOP
DROP ;

: FRACTIONS ( count -- )
CR
1+ 1 DO
   I PSNUM SPACE I NUMERATORS CR
LOOP ;



"What's this?"

"That's the program."

Okay, it isn't exactly the program code he showed. Although the colon and semicolon were similar, most of the characters did not look much like our Latin-based alphabet. And I've translated it into symbols derived from English.

But the postfix grammar was surprisingly similar to the language Forth.

Maybe not so surprising, if we consider what a progressive definition grammar would naturally look like.

I made sure the translation would run in most Forth interpreters, if you are interested in trying it out. It definitely works in gforth, which is relatively easy to get for most PCs and for Android phones. Probably the easiest way to get it on a MSWindows PC is to go to the Cygwin site and install that, then use Cygwin's installer to get gforth. Android's Play Store has it, and, if you are using a Linux OS, it is probably in the packages.

(It also runs in my bif-c interpreter, but that is not easy to get if you aren't into compiling things yourself.)

In our world, it would have been a few more years before Forth became somewhat available, but we'll hear more about that later.

Professor Billings moved the printout down on the staging table to show the chart:


9 fractions                    
1 0: 0, 1: 1000,
2 0: 0, 1: 500, 2: 1000,
3 0: 0, 1: 333, 2: 666, 3: 1000,
4 0: 0, 1: 250, 2: 500, 3: 750, 4: 1000,
5 0: 0, 1: 200, 2: 400, 3: 600, 4: 800, 5: 1000,
6 0: 0, 1: 166, 2: 333, 3: 500, 4: 666, 5: 833, 6: 1000,
7 0: 0, 1: 142, 2: 285, 3: 428, 4: 571, 5: 714, 6: 857, 7: 1000,
8 0: 0, 1: 125, 2: 250, 3: 375, 4: 500, 5: 625, 6: 750, 7: 875, 8: 1000,
9 0: 0, 1: 111, 2: 222, 3: 333, 4: 444, 5: 555, 6: 666, 7: 777, 8: 888, 9: 1000,


He used a pen to trace through the listing. "Okay, these are the first three digits to the right of the decimal point, right?"

"Right. So we can see that 0.714 in the fives column of the sevens row is about the closest fraction less than ten."

Jack was still doubtful. "But seven tenths is closer than five sevenths."

"Well," Carl spoke up again, "When somebody way back there in our history first set up our modern calendar, he wouldn't have even had mechanical calculators, and the numbering system wasn't always base ten. And it took several centuries to get the length of the year accurately measured, didn't it?"

While the rest of the class talked about this, Ted finished his chart on the chalkboard.

"What's this?" Professor Billings asked, as he slid the listing across the stage table so the class could see it:


7 showmonths

0 0: 30 (30,  29.392 )
0 1: 29 (59,  58.784 )
0 2: 30 (89,  88.177 )
0 3: 29 (118,  117.569 )
0 4: 29 (147,  146.961 )
0 5: 30 (177,  176.353 )
0 6: 29 (206,  205.746 )
0 7: 30 (236,  235.138 )
0 8: 29 (265,  264.530 )
0 9: 29 (294,  293.922 )
0 10: 30 (324,  323.315 )
0 11: 29 (353,  352.707 )


1 0: 30 (383,  382.099 )
1 1: 29 (412,  411.491 )
1 2: 29 (441,  440.884 )
1 3: 30 (471,  470.276 )
1 4: 29 (500,  499.668 )
1 5: 30 (530,  529.060 )
1 6: 29 (559,  558.453 )
1 7: 29 (588,  587.845 )
1 8: 30 (618,  617.237 )
1 9: 29 (647,  646.629 )
1 10: 30 (677,  676.022 )
1 11: 29 (706,  705.414 )


2 0: 29 (735,  734.806 )
2 1: 30 (765,  764.198 )
2 2: 29 (794,  793.591 )
2 3: 29 (823,  822.983 )
2 4: 30 (853,  852.375 )
2 5: 29 (882,  881.767 )
2 6: 30 (912,  911.160 )
2 7: 29 (941,  940.552 )
2 8: 29 (970,  969.944 )
2 9: 30 (1000,  999.336 )
2 10: 29 (1029,  1028.729 )
2 11: 30 (1059,  1058.121 )


3 0: 29 (1088,  1087.513 )
3 1: 29 (1117,  1116.905 )
3 2: 30 (1147,  1146.298 )
3 3: 29 (1176,  1175.690 )
3 4: 30 (1206,  1205.082 )
3 5: 29 (1235,  1234.474 )
3 6: 29 (1264,  1263.867 )
3 7: 30 (1294,  1293.259 )
3 8: 29 (1323,  1322.651 )
3 9: 30 (1353,  1352.043 )
3 10: 29 (1382,  1381.436 )
3 11: 29 (1411,  1410.828 )


4 0: 30 (1441,  1440.220 )
4 1: 29 (1470,  1469.612 )
4 2: 30 (1500,  1499.005 )
4 3: 29 (1529,  1528.397 )
4 4: 29 (1558,  1557.789 )
4 5: 30 (1588,  1587.181 )
4 6: 29 (1617,  1616.574 )
4 7: 29 (1646,  1645.966 )
4 8: 30 (1676,  1675.358 )
4 9: 29 (1705,  1704.750 )
4 10: 30 (1735,  1734.143 )
4 11: 29 (1764,  1763.535 )


5 0: 29 (1793,  1792.927 )
5 1: 30 (1823,  1822.319 )
5 2: 29 (1852,  1851.712 )
5 3: 30 (1882,  1881.104 )
5 4: 29 (1911,  1910.496 )
5 5: 29 (1940,  1939.888 )
5 6: 30 (1970,  1969.281 )
5 7: 29 (1999,  1998.673 )
5 8: 30 (2029,  2028.065 )
5 9: 29 (2058,  2057.457 )
5 10: 29 (2087,  2086.850 )
5 11: 30 (2117,  2116.242 )


6 0: 29 (2146,  2145.634 )
6 1: 30 (2176,  2175.026 )
6 2: 29 (2205,  2204.419 )
6 3: 29 (2234,  2233.811 )
6 4: 30 (2264,  2263.203 )
6 5: 29 (2293,  2292.595 )
6 6: 29 (2322,  2321.988 )
6 7: 30 (2352,  2351.380 )
6 8: 29 (2381,  2380.772 )
6 9: 30 (2411,  2410.164 )
6 10: 29 (2440,  2439.557 )
6 11: 29 (2469,  2468.949 )
 ok


"I calculated out a chart to show how the lengths of months would mesh with the lengths of days cumulatively across seven years. It might be useful for demonstrating how variable a calendar would be if we didn't use something like skip years. Typing it up for a duplicator would be a lot of work. But you can see how the first year in that chart looks a lot like the calendar we use."

The professor moved the chart back up to year zero and let the students look it over. Then he asked, "How hard would it be to go to 700 years, so we could get a look at the entire cycle?"

"Waste of paper and ink, I'd say. Also, I'd have to fix part of the program that can only calculate to a bit more than thirty thousand days."

"Oh. So even a hundred years is going to be too many, then?"

"If I don't fix it."

"Well, it would be nice to pass this table out to everyone. Anyone want to type it up for the duplicator?"

Xerography was still too expensive to substitute for stencil or spirits duplicators, so copying out material like this still required a lot of manual labor. Georgia and Karen volunteered to type it up.



And this chapter is getting a bit long, so I'm going to arbitrarily end it here so you and I can take a break.

Previous TOC Next



[Backup and edit history will eventually be here: http://joel-rees-economics.blogspot.com/2017/04/backup-soc500-03-09-calculating-skip-years.]



[Chapter 3 part 9 is original to the second draft, and is not found in the first draft. Chronologically, it would be placed in chapter five of the first draft: http://free-is-not-free.blogspot.com/2016/05/economics-101-novel-ch05-first-semester.html.]
[JMR201704081836: end-backup.] 

Friday, April 7, 2017

Sociology 500, a Novel, ch 3 pt 9 -- Calculating Months in Skip Years

Previous




Ted picked up the model of the solar system and demonstrated the orbit of their planet again. "We should focus the children's attention on the tilt of the earth, as Jack diagrammed. It would probably be good to review the reasons for the seasons."

Georgia asked, "When the north pole is tilted towards the sun, that's summer for us in the northern hemisphere, right?"

Professor Billings asked, "Anyone still not clear on that point? You don't want to find yourself in class, wondering which is which, with students looking at you and expecting you to know all the answers."

Jack asked, "Isn't the physics of the seasons obvious? I mean, we would expect to not even need that model in high school, right?"

Karen complained. "It's obvious to you. I'm still trying to figure it out. Is the sun that much closer to us in summer?"

"Yeah," Jack replied sarcastically. "A fraction of a percent makes that much difference."

"Jack, you'll confuse people." said Merill. "Karen, think of the sun against your car roof. At an angle, the light tends to reflect more."

Jack grumbled. "Maybe, maybe not."

"Okay," Karen said hesitantly. "I can see the angle being important. There was a teacher who explained it to us as distance when I was in elementary school, and I've been confused since then."

Ted said, "Well, it is partly distance, but the distance that is relevant is the distance through the atmosphere due to the angle, not the distance from the sun. But, more basically, like Merill says, the angle reduces the amount of sunlight that reaches the surface. And that's more important." And he drew a diagram on the chalkboard, of sunlight hitting their earth:


Karen still looked puzzled. "I'm not seeing it."

So Kristie stood up and said, "There's another way to draw that diagram that helped me." And she drew a second version of the diagram, using a polygon instead of a circle:



"It helped me see that the deeper angle reduces the amount of sunlight for the same amount of surface area." Then she picked up a textbook and held it in front of a window, rotating it to show the area being struck by sunlight. "Like this."

Karen thought a few moments and said, "Thanks, I think I can see that."

Kristie gave the chalk back to Ted and he started started writing out a chart on the chalkboard.

Dan grumbled. "You and Karel."

Kristie smiled as she sat down, and members of the class who knew our four protagonists laughed.

Karen continued after some thought, "I think I can probably draw diagrams like that in a class."

While Ted wrote, Professor Billings pointed out, "This kind of discussion often does much more than a lecture." He paused. "You may feel a little out of control, during the discussion, but I strongly urge you to learn to use this kind of discussion, in every grade you teach."

Ted turned around. "And if we can get the students to draw the diagrams and write the math on the board themselves, that works even better, right?"

"You've heard it before."

General laughter.

"So," Ted returned to the board, to the left of the chart he had been working on, and said, "if we can satisfy the students about the measured length of the solar year, we can tell them that the length of the year is three hundred fifty-two whole days and four hundred eighty-five six eighty-sixths of a day. But we probably want to show them decimal fractions, too:
1 year: 352 485/686 days (about 352.7070)
Carl asked, "How do we connect that with sevens?"

Dan said, "Write the factors on the board, two times seven cubed."

Ted stopped, and he and many of the students turned to look at Dan.

"What? I didn't say I couldn't do any math at all, just not comfortable with some of it." Dan was grinning sheepishly.

More laughter, which Ted and Dan joined as Ted wrote out the factors on the board:
2 × 7 = 14, 14 × 7 = 98
98 × 7 = 686, 686 ÷ 2 = 343
Dan continued, "And we could work out the decimal fraction, to show how close it is to five sevenths. Should I work that out?"

Professor Billing smiled and held up a piece of chalk, which Dan took to a chalkboard at the side of the room, to show the long division for 5/7 and 485/686:
   0.714287             0.70699
 -----------        -------------
7| 5.0000000     686| 485.0000000
   4.9                480.2
     10                 4.800
     07                 4.116
      30                  6840
      28                  6174
       20                  6660
       14                  6174
        60                  4860
        56   
         40  
         35 
          50
And Dan sat down.

Carl pressed the question. "Is that the closest small fraction?"

Ted said, "Actually, I've got a chart of fractions that I printed up on the computer, where we can get a look at that question."

There were some complaints.

"Braggart."

And, "How come he's so lucky?"

Etc.

To which Professor Billings said, "Ted is being kind enough to loan it to the department." The department had had to scrounge for the budget for the electricity, and we'll find out more about that later. The professor asked, "Do you have the printout with you?"

"Yeah."

"I'll go get the overhead projector."

"I'll help you," Mark volunteered, and Mark followed the professor into the prep room as Ted went back to writing on the board.

Do you remember those heavy, hot, smelly, fragile overhead projectors we used to use, back in the 1950s and '60s? And big. That was what Mark and the professor emerged carrying. They set it up on a desk in front of a screen and plugged it into the wall to get the lamp warming up while Ted continued his explanation.

"We probably want to ask how many months in a year and show the division:"
1 ideal month: 352.7070 ÷ 12 = 29.39225 days
"Ideal month?" queried the professor.

"We can say it's some crazy professor's idea of a better month, but it isn't a real month."

"That explanation of ideal might work."

Ted continued, "Here's a question I think young kids will find interesting: If we used this exact length for the month, at what hour of the day on January 30th would it become February 1st?" And he showed them where he had written out the math for that, to the side of the still incomplete chart:
0.39225 * 24 = 9.414 hours
0.414 * 60 = 24.84 minutes
Before 9:25 A.M., January 30th.
After 9:25, February 1st.
While the other students absorbed that, he continued, "Then we can ask whether they would think it interesting for January thirtieth to suddenly turn into February first at about nine twenty five in the morning."

Jack suggested, "That's going to get some students excited, maybe too excited."

Dan chuckled. "It's the kind of thing Karel would say just as we split up for our specialty practice. Make sure we had plenty of time to think about it."

Kristie suggested, "Maybe you could save it until just before lunchtime? then the students would have lots of time to talk about it and forget their excitement."

Jack scratched his head. "Maybe, if you could get the timing right."

The professor was chuckling. He suggested, "Ted, let's look at your chart of fractions."

Ted dug a computer printout out of his books and handed it to the professor, who put it on the overhead projector's light stage.



: PRCH EMIT ;

: COMMA 44 PRCH ;
: COLON 58 PRCH ;

( No trailing space. )
: PSNUM ( number -- )
  0 .R ;

: NUMERATORS ( count -- )
DUP 1+ 0 DO
   I PSNUM COLON SPACE
   I 1000 * OVER / PSNUM COMMA ( 1000 times I divided by count )
   SPACE LOOP
DROP ;

: FRACTIONS ( count -- )
CR
1+ 1 DO
   I PSNUM SPACE I NUMERATORS CR
LOOP ;



"What's this?"

"That's the program."

Okay, it isn't exactly the program code he showed. Although the colon and semicolon were similar, most of the characters did not look much like our Latin-based alphabet. And I've translated it into symbols derived from English.

But the postfix grammar was surprisingly similar to the language Forth.

Maybe not so surprising, if we consider what a progressive definition grammar would naturally look like.

I made sure the translation would run in most Forth interpreters, if you are interested in trying it out. It definitely works in gforth, which is relatively easy to get for most PCs and for Android phones. Probably the easiest way to get it on a MSWindows PC is to go to the Cygwin site and install that, then use Cygwin's installer to get gforth. Android's Play Store has it, and, if you are using a Linux OS, it is probably in the packages.

(It also runs in my bif-c interpreter, but that is not easy to get if you aren't into compiling things yourself.)

In our world, it would have been a few more years before Forth became somewhat available, but we'll hear more about that later.

Professor Billings moved the printout down on the staging table to show the chart:


9 fractions                    
1 0: 0, 1: 1000,
2 0: 0, 1: 500, 2: 1000,
3 0: 0, 1: 333, 2: 666, 3: 1000,
4 0: 0, 1: 250, 2: 500, 3: 750, 4: 1000,
5 0: 0, 1: 200, 2: 400, 3: 600, 4: 800, 5: 1000,
6 0: 0, 1: 166, 2: 333, 3: 500, 4: 666, 5: 833, 6: 1000,
7 0: 0, 1: 142, 2: 285, 3: 428, 4: 571, 5: 714, 6: 857, 7: 1000,
8 0: 0, 1: 125, 2: 250, 3: 375, 4: 500, 5: 625, 6: 750, 7: 875, 8: 1000,
9 0: 0, 1: 111, 2: 222, 3: 333, 4: 444, 5: 555, 6: 666, 7: 777, 8: 888, 9: 1000,


He used a pen to trace through the listing. "Okay, these are the first three digits to the right of the decimal point, right?"

"Right. So we can see that 0.714 in the fives column of the sevens row is about the closest fraction less than ten."

Jack was still doubtful. "But seven tenths is closer than five sevenths."

"Well," Carl spoke up again, "When somebody way back there in our history first set up our modern calendar, he wouldn't have even had mechanical calculators, and the numbering system wasn't always base ten. And it took several centuries to get the length of the year accurately measured, didn't it?"

While the rest of the class talked about this, Ted finished his chart on the chalkboard.

"What's this?" Professor Billings asked, as he slid the listing across the stage table so the class could see it:


7 showmonths

0 0: 30 (30,  29.392 )
0 1: 29 (59,  58.784 )
0 2: 30 (89,  88.177 )
0 3: 29 (118,  117.569 )
0 4: 29 (147,  146.961 )
0 5: 30 (177,  176.353 )
0 6: 29 (206,  205.746 )
0 7: 30 (236,  235.138 )
0 8: 29 (265,  264.530 )
0 9: 29 (294,  293.922 )
0 10: 30 (324,  323.315 )
0 11: 29 (353,  352.707 )


1 0: 30 (383,  382.099 )
1 1: 29 (412,  411.491 )
1 2: 29 (441,  440.884 )
1 3: 30 (471,  470.276 )
1 4: 29 (500,  499.668 )
1 5: 30 (530,  529.060 )
1 6: 29 (559,  558.453 )
1 7: 29 (588,  587.845 )
1 8: 30 (618,  617.237 )
1 9: 29 (647,  646.629 )
1 10: 30 (677,  676.022 )
1 11: 29 (706,  705.414 )


2 0: 29 (735,  734.806 )
2 1: 30 (765,  764.198 )
2 2: 29 (794,  793.591 )
2 3: 29 (823,  822.983 )
2 4: 30 (853,  852.375 )
2 5: 29 (882,  881.767 )
2 6: 30 (912,  911.160 )
2 7: 29 (941,  940.552 )
2 8: 29 (970,  969.944 )
2 9: 30 (1000,  999.336 )
2 10: 29 (1029,  1028.729 )
2 11: 30 (1059,  1058.121 )


3 0: 29 (1088,  1087.513 )
3 1: 29 (1117,  1116.905 )
3 2: 30 (1147,  1146.298 )
3 3: 29 (1176,  1175.690 )
3 4: 30 (1206,  1205.082 )
3 5: 29 (1235,  1234.474 )
3 6: 29 (1264,  1263.867 )
3 7: 30 (1294,  1293.259 )
3 8: 29 (1323,  1322.651 )
3 9: 30 (1353,  1352.043 )
3 10: 29 (1382,  1381.436 )
3 11: 29 (1411,  1410.828 )


4 0: 30 (1441,  1440.220 )
4 1: 29 (1470,  1469.612 )
4 2: 30 (1500,  1499.005 )
4 3: 29 (1529,  1528.397 )
4 4: 29 (1558,  1557.789 )
4 5: 30 (1588,  1587.181 )
4 6: 29 (1617,  1616.574 )
4 7: 29 (1646,  1645.966 )
4 8: 30 (1676,  1675.358 )
4 9: 29 (1705,  1704.750 )
4 10: 30 (1735,  1734.143 )
4 11: 29 (1764,  1763.535 )


5 0: 29 (1793,  1792.927 )
5 1: 30 (1823,  1822.319 )
5 2: 29 (1852,  1851.712 )
5 3: 30 (1882,  1881.104 )
5 4: 29 (1911,  1910.496 )
5 5: 29 (1940,  1939.888 )
5 6: 30 (1970,  1969.281 )
5 7: 29 (1999,  1998.673 )
5 8: 30 (2029,  2028.065 )
5 9: 29 (2058,  2057.457 )
5 10: 29 (2087,  2086.850 )
5 11: 30 (2117,  2116.242 )


6 0: 29 (2146,  2145.634 )
6 1: 30 (2176,  2175.026 )
6 2: 29 (2205,  2204.419 )
6 3: 29 (2234,  2233.811 )
6 4: 30 (2264,  2263.203 )
6 5: 29 (2293,  2292.595 )
6 6: 29 (2322,  2321.988 )
6 7: 30 (2352,  2351.380 )
6 8: 29 (2381,  2380.772 )
6 9: 30 (2411,  2410.164 )
6 10: 29 (2440,  2439.557 )
6 11: 29 (2469,  2468.949 )
 ok


"I calculated out a chart to show how the lengths of months would mesh with the lengths of days cumulatively across seven years. It might be useful for demonstrating how variable a calendar would be if we didn't use something like skip years. Typing it up for a duplicator would be a lot of work. But you can see how the first year in that chart looks a lot like the calendar we use."

The professor moved the chart back up to year zero and let the students look it over. Then he asked, "How hard would it be to go to 700 years, so we could get a look at the entire cycle?"

"Waste of paper and ink, I'd say. Also, I'd have to fix part of the program that can only calculate to a bit more than thirty thousand days."

"Oh. So even a hundred years is going to be too many, then?"

"If I don't fix it."

"Well, it would be nice to pass this table out to everyone. Anyone want to type it up for the duplicator?"

Xerography was still too expensive to substitute for stencil or spirits duplicators, so copying out material like this still required a lot of manual labor. Georgia and Karen volunteered to type it up.



And this chapter is getting a bit long, so I'm going to arbitrarily end it here so you and I can take a break.

Previous TOC Next



[Backup and edit history are here: http://joel-rees-economics.blogspot.com/2017/04/backup-soc500-03-09-calculating-months-skip-years.html.]



[Chapter 3 part 9 is original to the second draft, and is not found in the first draft. Chronologically, it would be placed in chapter five of the first draft: http://free-is-not-free.blogspot.com/2016/05/economics-101-novel-ch05-first-semester.html.]