Paul Hartrick dot comポールHartrickドットコム






The First Program I Ever Wrote最初のプログラムI以来書いた

Feb 7th 2008 2008年2月7日
4 Comments 4コメント
235 views 235件
respond応答
trackbackトラックバック

Todays post is in response to a good friend of mine always asking about the “Mumbo Jumbo” that I talk about or create during the course of my job.今日のポストは良い友達に応答して、私のは、常に"無意味な言動"は、私の仕事のコースについて、または作成中に、話を求めています。 “Mumbo Jumbo” is actually “Japanese English” for technical talk according to some. "無意味な言動"実際には"一部によると、技術的な話を聞いて日本語英語"です。 I have to take you all back to when I was about 14 years old, this is when I purchased my first computer.私は、すべてのバックアップ時には約14歳の時に連れて行くには、このとき、私が最初にコンピュータを購入しています。 My first computer wasn't an IBM 486 or 386, or even a 286, my first computer was a Casio PB-100.私の最初のコンピュータではなかったIBMの486または386、あるいは286、私の最初のコンピュータは、カシオの鉛100歳だった。

Here are the details of my first PC.ここに私の最初のPCの詳細です。

カシオ鉛100

The PB-100 represents Casio's step towards “real” pocket computers.は、PB - 100本物の"ポケットコンピュータ"に向かっカシオのステップを表します。 While its ancestor, the一方、その祖先は、 FX-702P外為- 702P , was still called “Programmable Calculator”, the PB-100 proudly bears the title “Personal Computer”.は、まだ"プログラマブル電卓"は、PB呼ばれていた- 100誇らしげに、タイトルは"クマパーソナルコンピューター"。

In its standard version, it is equipped with 1 KB of RAM which results in only 544 bytes for BASIC, which is really limiting.その標準的なバージョンでは、RAMの1 KBのBASICは、これは非常に制限されますのみを544バイト単位での結果を備えています。 At least, with the memory module OR-1, it can be upgraded to 1568 bytes of user memory, so it begins to make sense that BASIC memory can be subdivided into 10 independent program areas.少なくとも、またはメモリモジュールと- 1は、ユーザメモリの1568バイトなので、という意味で基本的なメモリ10の独立したプログラムの領域に分割することができますように始まるアップグレードすることができます。

The main circuits of the PB-100 are basically made up of two chips. PBの主回路- 100は基本的に2つのチップで構成されます。 Processor logics, ROM, display driver, and keyboard controller are integrated in a single CMOS VLSI chip HD61913, which has an external 4-bit bus.プロセッサの論理は、ROM、ディスプレイドライバ、およびキーボードコントローラは、外部の4ビットバスを備え、単一のCMOS VLSIチップHD61913に統合されます。 The second main component is a HD61914, which is a 8192-bit static RAM organized as 2048 words by 4 bits. 2番目の主要なコンポーネントは、8192ビットのスタティックRAMを4ビットで2048ワードのように構成されているHD61914です。

I had the lot, 1k ram upgrade for a total of 1.5k of ram, thermal printer and tape drive, needless to say it want a very powerful PC, but you would be surprised what could be done with such an underpowered PC, keep reading….私は、1.5kのRAMの合計、熱プリンタやテープドライブ、それは非常に強力なPCを望むことは言うまでもないの1kラムアップグレードは、たくさんあったけど、あなた何なパワー不足のPCで読み続けて行われる可能性が驚かれるだろうか...。

My first program was written in BASIC, and could calculate the Factorial of any number you like.私の最初のプログラムはBASICで書かれた階乗するように、任意の数を計算することができます。 What is Factorial ?何乗ですか? In mathematics, the factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n.数学では、禁煙の階乗、負の整数nについて、nで表さ!、すべての正の整数の製品よりも小さいか、nに等しい For example, 5!たとえば、5! = 1 x 2 x 3 x 4 x 5 = 120 and 6! = 1 × 2 × 3 × 4 × 5 = 120 6! = 1 x 2 x 3 x 4 x 5 x 6 = 720. = 1 × 2 × 3 × 4 × 5 × 6 = 720。 As you can imagine the numbers get very large very quickly.このように数字を想像することができます非常に非常に迅速に大きくなる。 Most calculators, even today, can only manage 69!, this is the point where the exponent exceeds 99.ほとんどの計算機でも、今日、唯一の69を管理することができます!、これは指数99を超えると、ポイントです。

So I had a problem I want to solve, what is the factorial of 1 million, 1,000,000!だから私は解決したい問題を抱えて、何が1億5000万ドルの階乗1,000,000です! logarithms to the rescue.救助する対数。 What is a 14 year old boy doing researching logarithms you ask?どのような14歳の少年をお願い対数の研究をしている? I guess thats a story for another post.多分別のポストの話thats。 After a few hours of reading a book, yes a book!( no internet in those days) I was able to establish that product of integers is the sum of their logs.本を読んでから数時間後、当時の私は整数の製品を確立することができた、yesをご予約ください!(インターネット接続なし)は、ログの合計です。

so 1 * 2 * 3 * 4 * 5 … is equal to exp( log(1) + log(2) + log(3)+ log(4) + log(5) )ので、1 * 2 * 3 * 4 * 5 ... expに((1)+ログ(2)+ログ(3)+ログ(4)+ログ(5))のログと同じです

Easy right… yeah right!簡単に右...ええね!

So I embarked on my first programming task.だから、私は最初のプログラミング作業に着手した。 I was able to come up with a simple routine that broke the calculation down into small chunks easily handled by any programmable calculator or PC.私は、下の小さな塊を簡単に任意のプログラマブル電卓やPCでの処理に計算した単純なルーチンを用意することができた。

10 input x 10入力x
20 for a = 1 to x 20 = 1からx
30 b = b + log10(a) 30のB = bの+ log10(1)
40 next a 40次の
50 c = b – frac(b) 50℃= bの- (イ)フラクショナル
60 d = b – c 60開発= bの- Ĉ
70 e = 10 ^ d 70電子= 10 ^ dが
80 print e , “E+” , c 80印刷メール、"メール+"、Ĉ

Certainly not the best way to achieve the result by todays standards, and faced with many command restrictions,  still not to bad for a 14 year old boy.今日の基準での結果を達成するためには確かではない最良の方法だと、多くのコマンドの制限に直面して、まだ悪くしないように14歳の少年。

You can still use this program today, go and downloadあなたは今、このプログラムを使用することができます移動し、ダウンロード small basic基本的な小 and copy/paste the code and give it a try.コピー/コードを貼り付けしてお試しください。 It took more than 12 hours on my PB-100 to calculate 1,000,000!, now it takes about 1 second, I can now appreciate how much performance my laptop has, however my little program still beats the WindowXP calculator at Factorial..これは12時間以上も私の鉛になった- 100 1000000を計算する!、今では約1秒かかります、私は今私のラップトップがどれだけの性能を味わうことができるしかし、私の小さなプログラムはまだ乗..でWindowXP電卓ビート try it and see.それを参照してみてください。

So what is 1 million Factorial?それでは、1000000乗ですか? 1,000,000! 1,000,000! = 8.263930499EXP5565708, that 5.5 million zeros, give or take a few. = 8.263930499EXP5565708は、550万人のゼロ、あきらめるか、またはいくつかを取る。

Now for all the other math heads who read this, I know it is an approximation as I am only using 16 significant digits, and there are more accurate ways to do this, blah blah blah, please remember I was only 14 at the time.他のすべての数学の今の人は、この読み取りヘッド、私は私は16桁を使用してその近似され、知っているがこれを行うには、何とか何とか何とか、下記を覚えて私はわずか14時間では、より正確な方法があります。

If you have managed to maintain interest and get to the end of this post, maybe your the type who can impress their friends with some geeky code.場合、金利を維持するため、この記事の最後に取得管理している、おそらくあなたのタイプはいくつかのこっけいなコードとその友達を感心することができます。

To get new stuff automatically subscribe to my自動的にサブスクライブ新しいものを得るために私 RSS feed RSSフィード .
For a more personal insight Follow me onもっと個人的な洞察力で私に従っについて Twitter Twitterの .


This post is taggedこのポストはタグ付けされ , , ,

4 Comments 4コメント

  1. Gil HartrickギルHartrick

    Pauly, do you remember where you got the workings from ?…… It was me who brought the Swinburne Uni PC's to a grinding hault in the early eighties with this Factorial Formulae on PUNCH CARDS… YES!パウリは、どこからの働きだ?覚えていますか... ...それは私たちスウィンバーンユニパソコンもたらされたこの階乗計算式のパンチカードで... YESと80年代前半に研削haultするには! punch card programming LOLパンチカードのプログラミング大爆笑だ

    Reply To This Commentこのコメントに返信する

  2. Gil HartrickギルHartrick

    Remember my Casio Calculator the FX-602P??は、FX - 602P私カシオ電卓覚え?? It computed 1,000,000 factorial in 4 minutes flat, not bad for a meek calculatorこれは1000000 4分フラット、柔和な電卓は悪くないの階乗を計算

    Reply To This Commentこのコメントに返信する

  3. CA PappasカナダPappas氏

    Thanks!ありがとう! Believe it or not, I was actually trying to solve 1000000!信じられないかもしれない、私は実際には1000000を解決しようとしていた! , but, yes, my sci calculator was only good for 69!しかし、唯一の69の良い、はい、私の科学計算されました! . My windows sci calculator was much better.私の窓の計算科学はかなりマシだった。 It took me up to (10^5)!それは(10 ^ 5)私をした! , but it wouldn't give me (10^6)!しかし、それは私(10 ^ 6)をしないと! .
    I tried some online calculators , but they couldn't even come close to the windows sci calculator.私はいくつかを計算しようとしたが、それも窓の近くに来ることができなかった計算機科学。 For now, and for my purposes, all I needed was that answer.今のところは、私の目的とは、すべて私が必要との答えだった。 I'll search for a calculator later.私は、電卓の後に検索されます。 Thank you, again, you have saved me a lot of search time.もう一度ありがとう、あなたは私の検索に多くの時間を保存している。 As I am rural, I only have dial-up.私が農村部の、私だけダイヤルアップしている。 Yes, it only feels like it would be faster to just 1 x 2 x 3 x 4 x 5 x ………….with pencil and paper (how many life-times????).はい、それだけを感じているようなことになるだろう高速わずか1 × 2 × 3 × 4 × 5 × ... ... ... ... ...紙と鉛筆(どのように多くの生命と何度????). than to search for the answer.答えを検索するよりも。 and wait for the snail-speed downloads!!!!とカタツムリのように高速ダウンロードされるまで待つ!!

    Appreciatively,楽しんでいるよう、
    Chris Aristides PappasクリスアリスティデスPappas氏

    Reply To This Commentこのコメントに返信する

    -Paul ポール Reply:返信:

    I'm glad you found it useful.私はあなたに役に立つがうれしいです。 I'm also glad I'm not the only geek who has an interest in factorial of large numbers.私も、私の唯一の人に関心を持ってオタクではないができて嬉しい、多数の要因。

    Reply To This Commentこのコメントに返信する

Incoming Links着信リンク

    Leave a Reply返信コメントを残す