EZ Math Movie, Tutorials, Powers and Square Root


ab

Suppose you wanted to raise the value a to the exponent b. Then suppose you wanted to assign that value to c. Normal math notation for this would look like this:

c = ab

Here is how to do the same thing using EZ Math Movie's power command:

c = power(a, b);

The values for a and b work like this:

  1. They can be integers or numbers with decimals.
  2. b, the exponent, can be positive or negative.
  3. a should be positive, but if it is negative, it must be an integer.

If the third rule is broken, that is, if a is negative and has a decimal, power will not return a number. It will return NaN. 'NaN' means 'not a number'. The demonstration program below demonstrate this.

Square root

Let's say we wanted to take the square root of 5. One way to do this would be to raise 5 to an exponent of 1/2 or 0.5. Setting a variable named x to this value could look like this:

x = power(5, 0.5);

However, square roots are used so frequently that EZ Math Movie has a special command for it. The command sqrt does that, and it looks like this:

x = sqrt(5);

Running the example program

This example program runs through all the combinatios of positive and negative bases and exponents for the power command. Note that the last two do not work.

The program also shows how to use the sqrt command.

Remember, 'NaN' means 'not a number', and that signals an error in this program.


The example program

0ptions
Angle measurement: Degrees Radians

Go on input

Bounds:
Sorry, apparently this browser does not support HTML 5 canvas tag graphics.
Printer

Edit: Runtime          View: Starter Suggestion

To runtime:

Storage:

Editor width: Normal Wide


		

	


		

	


		

	

And....

Next tutorial: Increment, decrement


All contents of EZ Math Movie are copyrighted: Copyright 2011, Edward A. Zobel. All rights reserved.



Other sites you may find interesting

Zona Land Education Like Math and Physics?

Zona Land Education offers explanations, diagrams, and animations on these topics.
And it is all presented in a clear and casual manner.

Here is the link: zonalandeducation.com




EZ Programing Demos Want to learn about programing computers?

EZ Programing Demos has an animated, slow motion, interactive programing language demonstrator.
The site presents basic ideas at a beginner's level.

Here is the link: ezprogramingdemos.com



Custom Search

Name:
Domain:

Name
0


Name:
Name
0