Tuesday, August 31, 2010

PHP Exponential Decay Calculator


I've searched the web for hours looking for any kind of PHP scripts that calculate exponential decay. I was surprised not to find any, so I've written one up quickly. It's not very advanced, but it gets the job done, and it does what I need it for. It includes a simple form to enter values, and displays the result once the form is submitted. I will supply the script here for anyone to take and use. If you modify or add to it, please supply me with the new code and I will update it here for others to use as well. The formula used is:
N(t) = N0e-kt
For more help on exponential decay, I found these links to be useful to me:
How to use - If you know the quantity for a time, this script will solve for k. Enter the initial time t, and the quantity k (for example, .5 for half-life), then enter the initial time and quantity for which you want to solve.

Source Code:
<!-- // exponential decay calculator // Original Author: Mike Burch // Created: 29 July 2010 // Description: A simple form and script to calculate exponential decay. --> <h2>exponential decay calculator</h2> Formula: <b><i>N(t) = N<sub>0</sub>e<sup>-kt</sup></i></b><br> <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="POST"> <table> <tr><td><b><i>t</i></b> (Initial Time)</td> <td><input type="text" name="ti" value="<?php echo @$_POST['ti']; ?>"></td></tr> <tr><td><b><i>k</i></b> (Quantity)</td> <td><input type="text" name="k" value="<?php echo @$_POST['k']; ?>"></td></tr> <tr><td><b><i>t</i></b> (New Time)</td> <td><input type="text" name="t" value="<?php echo @$_POST['t']; ?>"></td></tr> <tr><td><b><i>N<sub>0</sub></i></b> (Initial Quantity)</td> <td><input type="text" name="N0" value="<?php echo @$_POST['N0']; ?>"></td></tr> <tr><td colspan="2" align="right"><input type=submit name="calc" value="Calculate"> </td></tr> </table> </form> <?php if (isset($_POST['calc'])) { $k = $_POST['k']; $ti = $_POST['ti']; $t = $_POST['t']; $N0 = $_POST['N0']; $k = log($k) / $ti; $k = -$k * $t; $N = pow(2.718281828, -$k) * $N0; echo "Result: <b>$N</b>"; } ?> <p>How to use: If after <i><b>t</b></i> (initial time) there is <i><b>k</b></i>  quantity left, how<br> much will be left after <i><b>t</b></i> (new time), with an initial quantity of  <b><i>N<sub>0</sub></i></b>?</p> 

exponential decay calculator

Using VoiceThread with MEC

VoiceThread is particularly useful for preparing students for the speaking part of the Cambridge Suite of exams (KET to Proficiency), in the section where candidates are asked to describe/compare photographs.

If you let students to choose the photos they like best for the task, they are much more likely to be enthusiastic about what they have to say: an important learning experience that they can carry forward to the exam.

Here's an example of a VoiceThread from a post FCE student:



You can also use VoiceThread with your stude! nts for making presentations, storytelling, anecdotes and giving directions.

VoiceThread is very teacher-friendly. It has privacy controls, comment moderation, and a system of identities that allows all students in a class to work within one account.

Again you'll need a microphone attached to the computer(s) that you're going to use.

Creating an account with VoiceThread
  • Fill in your details and click on register.
  • VoiceThread offers you a series of tutorials to help you out.
  • As a teacher, you have the option to register for a special K-12 educator's account which gives you all the features of a paid Pro account. If you're interested, click on Go Pro! at the top of the page.
  • Now click on K-12 Educators click here.
  • Fill in your school's details and VoiceThread will send you an email confirming your Educator's account.
  • When you want your students to use VoiceThread, get them to sign in using your account login (see creating separate identities for them below).

Configuring your account

  • On your My Account page, you can add a picture
  • And add a new identity for each of your students to use when they create a new VoiceThread.

Creating a VoiceThread

1. Selecting and uploading photos
  • When you or your students want to start a new VoiceThread, click on Create
  • You and them can upload photos, videos or documents from an individual computer or from Flickr (if you already have an account there containing photos).
  • The method I prefer is to use FlickrStorm which s! earches through all the photos on Fli ckr. (You can also use Google Image Search but the quality of the photos often isn't so good.)
  • Open FlickrStorm and write the topic of the photos you want to search for in the box provided .
  • Click on Advanced and select Search Creative Commons photos - which means that the photos you fi! nd will be of free copyright (as long as you are not going to use them for commercial purposes).
  • Now click on search, and after a few seconds you will get results like these.
  • Click on the photos you like and then Add To Tray.
  • Your students will only need to select 2 when practising for the Cambridge speaking exams.
  • Now click on the Download & link to your tray button.
  • This will take you to a page like this. Save it using the Save as option on your web browser's menu.
  • The photos will be downloaded to your computer in a folder and each will be in .jpg format. It's a good idea to change their titles to something comprehensible.
  • Now you're ready to upload them to VoiceThread. Click on Upload From My Computer.
  • First select the folder where your photos are, then each of the photos and finally, click on Select.
  • Give your VoiceThread a description.

  • 2. Recording a comment
    • Click on Comment
    • If you have created separate identities for your students, you and them can switch between them when recording a comment by clicking on the icon below the photo.
    • Click on record and this dialogue box will appear. Click on Allow.
    • As soon as you've clicked on Allow, recording begins, so make sure you're ready!
    • When you click on Stop, your recording is automatically replayed to you so you can decide whether to Save or Cancel it.
    • To continue recording your comment on the same photo, just click on record again.
    • If at any time you decide you don't like what you've said, you can delete the entire comment by clicking on the bin icon.
    • Another interesting feature of VoiceThread, that's particularly useful for presentations, is the doodling tool. Click on the series of coloured circles that are visible when you are recording and you can signal what you're focussing on.

    3. Sharing your VoiceThread
    • You have com! plete co ntrol over who can see and comment on your VoiceThread. You can make it public or private and decide to allow all comments or to moderate them.

    • To include your VoiceThread on your class blog, copy the code that's displayed when you click on the Embed button.
    • Paste to code into your blog posting (remember to click first on the Edit Html tag).

    Here are the results that you can expect.






    As with Vokis, your student's VoiceThreads provide a record of your students' speaking skills that you can share and comment on with them and also use for assessment purposes.

    embedded questions exercises

    Mr. Giraffe Solves Your Linear Algebra Problems

    Please Note: If I made any mistakes in this test, perhaps this picture of a giraffe will convince otherwise.


    answers for algebra

    Chapter 5: Summary

    Hubbard presents a condensed version of the last four chapters complete with a mathematical equation for the potential value of an individual.

    The summary with a description of the four dynamics for survival: sex, self, mankind, and group. As I have just written about them here, I will not go over them again.

    Hubbard then lists the "fundamental axioms of Dianetics". It would be worth reproducing these in full, but they cover 4 pages. I will instead quote the important ones and briefly address most the others, reminding you of my previous interpretations in brackets.

    The Fundamental Axioms of Dianetics

    Man's "dynamical principle of existence is survival." [This was an unsupported assertion.]

    There are four dynamics to survival! : sex, self, mankind, and the group. [These were said to fit some "equation" that was never presented. It is my belief that Hubbard mostly likely found these to be a solution to a thought experiment (I use experiment very loosely here.) and not scientific equations.]

    The absolute goal of survival is immortality or infinite survival.
    [This again is just an assertion.]
    ...the purpose of perceptions, retention, concluding and resolving problems is to direct its own organism and symbiotes and other organisms and symbiotes along the four dynamics toward survival.
    ...
    The dynamics ["the tenacity of life and vigor and persistence in survival"] are inhibited by engrams, which lie across them and disperse life force.

    Intelligence is inhibited by engrams which feel! false or improperly graded data into the analyzer ["the analy! tical mi nd"]
    [The definition of engram was very muddled and the existence of engrams was asserted, not proven.]

    The analytical mind thinking is terms of comparisons; the reactive mind "things only in identities"; and the somatic mind "places solutions into effect on the physical level. [arbitrary definitions]

    Engrams cause aberrations.
    Psychosomatic ills are caused by engragms [which are the only source of aberrations].
    [Proof is needed.]

    Engrams are only received when unconscious.
    The engram is a moment of "unconsciousness" containing physical pain or the painful emotion and all perceptions, and is not available to the analytical mind as experience.
    [See above brackets.]

    And most interestingly,
    The potential value of an individual or a group may be expressed by the equation
    PV=IDx
    where I is Intelligence and D is Dynamic.

    The worth of an individual is computed in
    terms of the alignment, on any dynamic, of his potential value with optimum survival along that dynamic. A high PV may, by reversed vector [Vector is defines as "a physical quantity with both magnitude and direction, such as a force of velocity". The phrase "by reversed vector" is meaningless.], result in a negative worth as in some severely aberrated persons. A high PV on and dynamic assures a high worth only in the unaberrated persons.
    This equation is what I would like to focus on for the remainder of this post as there are a number of points to address. First of all, there are no units mentioned in w! hich to measure any of the variables. What are potential value! , intell igence and dyamic measured in? Engrams? More importantly, what is x? It is an entirely undefined variable. Is x the worth a man or species? If it is, why does worth only increase dynamic and not intelligence, or are there missing parentheses? Also, how does high PV make worth both negative and positive according the this equation? Which variable accounts for aberrations? This equation is beyond meaningless. It's only purpose on the page is so Hubbard can point to it and say how he's scientific because there is a mathematical equation in his book. It's pathetic, scientifically pathetic.

    Words defined: analyzer, attenuate, vector

    Next: Book 2: Chapter 1: The Analytical Mind and the Standard Memory Banks

    Note: All quotes are from
    Hubbard, L. Ron. Dianetics. Los Angeles, CA: Bridge Publications, Inc, 1986, unless noted otherwise.

    Question for the Reader
    : I would like to take this moment to ask if you, the reader would like to see anything different from these posts. The next chapters are much longer than these of the introductory book, and with the next semester starting soon, I will not be able to keep up the pace and detail of these previous posts. Also, I believe Dianetics has amply demonstrated it's absurdity. The following chapters are much more detailed, and it seems it will take me some research into neurology and psychology to be able to fully address Hubbard's claims. I guess what I am asking is, are you enjoying these summaries, and do you think it's worth my time to continue? There is still a long way to go. Thanks for sticking with me!


    all but my life chapter summaries

    How To Sketch Trigonometric Graph

    There are times when we are required to sketch trigonometric waveform given the mathematical expression. By understanding the mathematical principle explained below, you can be rest assured that sketching the graphs is a breeze. Here we go .....

    Trigonometric function relies on 3 parameters to define its shape (or graph).

    They are :

    1. Amplitude

    2. Period

    3. Phase shift


    Thus, the trigonometric expression can be represented by y = a sin (bA - c), where y and A are the variables.

    In this post, a step-by-step explanation is done.

    Let's take a reference sine wave as starting point.

    The reference graph of y = sin A is shown below.



    Diag 1: Sine wave (reference)

    Here the amplitude is "1", period is 3600 and phase shift is 00.
    The period is defined as the total angle taken to complete one full cycle.
    Phase shift is the amount of angle shift from the starting 00.


    Now, what happen when we increase the amplitude by 2.
    Y = 2 sin A



    Diag 2: Amplitude increased

    Here, we can see that the height or amplitude of the reference sine wave is increased from 1 to 2, with all else remaining the same.

    Next, let us change the period parameter and see what happen ==> y = sin 2A.

    NOTE: The formula to compute the ! numerica l value of period of a sine or cosine wave is
    PERIOD = 3600 / b, where "b" is the coefficient next to the angle A in "sin bA".


    Diag 3: The compressed sine wave y = sin 2A.

    What happened in Diag 3 is that when we increased the sin A to sin 2A, the period to have a complete cycle reduces by half or by 1/ b.

    If the trigonometric expression is y = sin 3A, that is b = 3, the new period would then be reduced to 1/3 the original ( or 360 / 3 = 120 degree).

    Let's change the last parameter, the Phase Shift.
    y = sin (A - 200) ==> an addition of "- 200".

    What is the sine wave like?



    Diag 4: The shifted reference sine wave by positive 200.

    NOTE: The formula to calculate the phase shift is

    PHASE SHIFT = - c / b,

    with "c" and "b" being the parameters represented in the generic sine wave expression
    y = a sin (bA - c).

    Another point and a common mistake by learners, is to take the number "c" as the actual phase shift angle. It is wrong!

    The number "c" has to be divided by the angle coefficient "b" before the actual phase shift can be obtained. And note the sign "-" also!

    Look closely at the angle of shift. The sine wave is shifted right (or positvely) by 2! 00, even though the expression is "- 200! ".

    Why so?

    The y = sin (A - 200) means that to achieve the same amplitude as the reference sine wave at 00, A has to be at +200. Therefore A has to be at + 200 away from the origin. Understand?

    Let's look at the final composite sine wave with all parameters changed.
    y = 2 sin (2A - 200).



    Diag 5: Composite sine wave y = 2 sin (2A - 200).

    From diag 5, we can see that the phase shift is 100 only, with the period reduced by half. The amplitude is also increased to 2 as in the trigonometric equation.

    I have finished my explanation of getting the sine w! ave sketched given a trigonometric expression. You can see that it is not that difficult. What is needed is the 3 simple steps of defining the amplitude , period and phase shift, taking care of the sign.

    As long as we understand the meaning of the parameters in defining trigonometry graphs, the principle of sketching them is straight-forwardly easy. Do you agreed?

    .

    Trigonometric Equations

    June 8, 09

    Today was a work period in preparation for the exam, where Mr. Max was sitting in a the back of the room and whoever had a question could go there and ask him.
    Only one more week to go and the semester is over :D

    happy studying ;)

    Sequences and Series Help

    All Grades TAKS Math Charts

    No matter what grade you are in, check out each Math chart, starting with 3rd grade. As you will see, each year the chart grows and with that the expectation that each previous year's formulas are added to new concepts that will be tested on for that year's test. As a teacher, I've found that the students are not spending enough time using the chart and therefore don't value using it during the actual test. If you're in middle school, take a look at the high school chart. When you get to high school, please know that you'll be expected to know all middle school TAKS Math concepts from the 8th grade chart, which take care of 3rd-8th Math concepts.
    Wishing you all the best!!

    9th, 10th and Exit Level TAKS Math Chart
    8th Grade TAKS Math Chart
    7th Grade TAKS Math Chart
    6th Grade TAKS Math Chart
    5th Grade TAKS Math Chart
    4th Grade TAKS Math Chart
    3rd Grade TAKS Math Chart

    5th grade algebra problems