<< Chapter < Page Chapter >> Page >

The JavaScript Math.pow method

Listing 3 calls a built-in JavaScript method that I have not used before: Math.pow . This method is called to raise a value to a power. It requires two parameters. The first parameter is the valuethat is to be raised to a power and the second parameter is the power to which the value is to be raised.

The method returns the method raised to the power.

Fractional exponents

Although this topic is not directly related to the discussion on proportionality, as long as I am introducing the method named Math.pow , I will point out the it is legal for the exponent to be a fraction. The last little bit of code in Listing 3 raises the value 8 tothe 1/3 power. This actually computes the cube root of the value 8. As you should be able to confirm in your head, the cube root of 8 is 2, because tworaised to the third power is 8.

Output from the script

When you open the script shown in Listing 3 in your browser, the text shown in Figure 3 should appear in your browser window.

Figure 3 . Screen output for Listing #3.
r =10, A = 314.1592653589793 r =20, A = 1256.6370614359173r =15, A = 706.8583470577034 Cube root of 8 = 2

An examination of the first three lines of text in Figure 3 should confirm that they satisfy the proportionality rules for the square of theradius described earlier .

The last line of text in Figure 3 confirms that the Math.pow method can be used to compute roots by specifying fractional exponents as thesecond parameter.

Run the scripts

I encourage you to run the scripts that I have presented in this lesson to confirm that you get the same results. Copy the code for each script into atext file with an extension of html. Then open that file in your browser. Experiment with the code, making changes, and observing the results of your changes. Makecertain that you can explain why your changes behave as they do.

Resources

I will publish a module containing consolidated links to resources on my Connexions web page and will update and add to the list as additional modulesin this collection are published.

Miscellaneous

This section contains a variety of miscellaneous information.

Housekeeping material
  • Module name: Scale Factors, Ratios, and Proportions
  • Revised: 09/30/15
  • File: Phy1030.htm
  • Keywords:
    • physics
    • accessible
    • blind
    • graph board
    • protractor
    • screen reader
    • refreshable Braille display
    • JavaScript
    • trigonometry
    • scale
    • factor
    • ratio
    • proportion
    • Google calculator
Disclaimers:

Financial : Although the openstax CNX site makes it possible for you to download a PDF file for the collection that contains thismodule at no charge, and also makes it possible for you to purchase a pre-printed version of the PDF file, you should beaware that some of the HTML elements in this module may not translate well into PDF.

You also need to know that Prof. Baldwin receives no financial compensation from openstax CNX even if you purchase the PDF version of the collection.

In the past, unknown individuals have copied Prof. Baldwin's modules from cnx.org, converted them to Kindle books, and placed them for sale on Amazon.com showing Prof. Baldwin as the author.Prof. Baldwin neither receives compensation for those sales nor does he know who doesreceive compensation. If you purchase such a book, please be aware that it is a copy of a collection that is freelyavailable on openstax CNX and that it was made and published without the prior knowledge of Prof. Baldwin.

Affiliation : Prof. Baldwin is a professor of Computer Information Technology at Austin Community College in Austin, TX.

-end-

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Accessible physics concepts for blind students. OpenStax CNX. Oct 02, 2015 Download for free at https://legacy.cnx.org/content/col11294/1.36
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Accessible physics concepts for blind students' conversation and receive update notifications?

Ask