0
Upcoming SlideShare
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Standard text messaging rates apply

# Math hquickissential

532

Published on

Published in: Education, Technology
0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total Views
532
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
46
0
Likes
0
Embeds 0
No embeds

No notes for slide

### Transcript

• 1. Math.h <ul><li>Math.h is a header file declared before using basic mathemical operation such as </li></ul><ul><ul><li>Power (Squareroot, power) </li></ul></ul><ul><ul><li>Trigonometric(Sine, cosine, tangent) </li></ul></ul><ul><ul><li>Exponential and logarithmic (Log, exponential) </li></ul></ul><ul><ul><li>Rounding, Absolute value </li></ul></ul><ul><ul><li>Etc etc </li></ul></ul>
• 2. Power <ul><li>Power </li></ul><ul><ul><li>Example : x^y should be written as power(x,y); </li></ul></ul><ul><ul><li>Example in coding: </li></ul></ul><ul><li>#include &lt;stdio.h&gt; </li></ul><ul><li>#include &lt;math.h&gt; </li></ul><ul><li>int main (){ </li></ul><ul><li>printf (&amp;quot;7 ^ 3 = %lfn&amp;quot;, pow (7,3)); </li></ul><ul><li>printf (&amp;quot;4.73 ^ 12 = %lfn&amp;quot;, pow (4.73,12)); </li></ul><ul><li>printf (&amp;quot;32.01 ^ 1.54 = %lfn&amp;quot;, pow (32.01,1.54)); </li></ul><ul><li>return 0; </li></ul><ul><li>} </li></ul>
• 3. Power <ul><li>Squareroot </li></ul><ul><ul><li>Example : x^y should be written as power(x,y); </li></ul></ul><ul><ul><li>Example in coding: </li></ul></ul><ul><li>#include &lt;stdio.h&gt; </li></ul><ul><li>#include &lt;math.h&gt; </li></ul><ul><li>int main (){ </li></ul><ul><li>double param, result; </li></ul><ul><li>param = 1024.0; </li></ul><ul><li>result = sqrt (param); </li></ul><ul><li>printf (&amp;quot;sqrt(%lf) = %lfn&amp;quot;, param, result ); </li></ul><ul><li>return 0; </li></ul><ul><li>} </li></ul>
• 4. Trigonometric <ul><li>Sine </li></ul><ul><ul><li>Sin() </li></ul></ul><ul><ul><li>Example: result = sin (param*PI/180); </li></ul></ul><ul><li>Cosine </li></ul><ul><ul><li>cos() </li></ul></ul><ul><ul><li>Example : result = cos (param*PI/180); </li></ul></ul><ul><li>Tangent </li></ul><ul><ul><li>Tan() </li></ul></ul><ul><ul><li>Example: result = tan (param*PI/180); </li></ul></ul>
• 5. Sine exaple <ul><li>#include &lt;stdio.h&gt; </li></ul><ul><li>#include &lt;math.h&gt; </li></ul><ul><li>#define PI 3.14159265 </li></ul><ul><li>int main () </li></ul><ul><li>{ </li></ul><ul><li>double param, result; </li></ul><ul><li>param = 30.0; </li></ul><ul><li>result = sin (param*PI/180); </li></ul><ul><li>printf (&amp;quot;The sine of %lf degrees is %lf.n&amp;quot;, param, result ); </li></ul><ul><li>return 0; </li></ul><ul><li>} </li></ul>
• 6. cosine <ul><li>#include &lt;stdio.h&gt; </li></ul><ul><li>#include &lt;math.h&gt; </li></ul><ul><li>#define PI 3.14159265 </li></ul><ul><li>int main () </li></ul><ul><li>{ </li></ul><ul><li>double param, result; </li></ul><ul><li>param = 60.0; </li></ul><ul><li>result = cos (param*PI/180); </li></ul><ul><li>printf (&amp;quot;The cosine of %lf degrees is %lf.n&amp;quot;, param, result ); </li></ul><ul><li>return 0; </li></ul><ul><li>} </li></ul>
• 7. Tangent <ul><li>#include &lt;stdio.h&gt; </li></ul><ul><li>#include &lt;math.h&gt; </li></ul><ul><li>#define PI 3.14159265 </li></ul><ul><li>int main () </li></ul><ul><li>{ </li></ul><ul><li>double param, result; </li></ul><ul><li>param = 45.0; </li></ul><ul><li>result = tan (param*PI/180); </li></ul><ul><li>printf (&amp;quot;The tangent of %lf degrees is %lf.n&amp;quot;, param, result ); </li></ul><ul><li>return 0; </li></ul><ul><li>} </li></ul>
• 8. Log <ul><li>Example : </li></ul><ul><li>#include &lt;stdio.h&gt; </li></ul><ul><li>#include &lt;math.h&gt; </li></ul><ul><li>int main (){ </li></ul><ul><li>double param, result; </li></ul><ul><li>param = 5.5; </li></ul><ul><li>result = log (param); </li></ul><ul><li>printf (&amp;quot;ln(%lf) = %lfn&amp;quot;, param, result ); </li></ul><ul><li>return 0; </li></ul><ul><li>} </li></ul>
• 9. Exponential <ul><li>Example : </li></ul><ul><li>#include &lt;stdio.h&gt; </li></ul><ul><li>#include &lt;math.h&gt; </li></ul><ul><li>int main (){ </li></ul><ul><li>double param, result; </li></ul><ul><li>param = 5.0; </li></ul><ul><li>result = exp (param); </li></ul><ul><li>printf (&amp;quot;The exponential value of %lf is %lf.n&amp;quot;, param, result ); </li></ul><ul><li>return 0; </li></ul><ul><li>} </li></ul>
• 10. Absolute value <ul><li>Example: </li></ul><ul><li>#include &lt;stdio.h&gt; </li></ul><ul><li>#include &lt;math.h&gt; </li></ul><ul><li>int main (){ </li></ul><ul><li>printf (&amp;quot;The absolute value of 3.1416 is %lfn&amp;quot;, fabs (3.1416) ); </li></ul><ul><li>printf (&amp;quot;The absolute value of -10.6 is %lfn&amp;quot;, fabs (-10.6) ); </li></ul><ul><li>return 0; </li></ul><ul><li>} </li></ul>
• 11. <ul><li>QUESTION? </li></ul>
• 12. Log and exponential <ul><li>Example : </li></ul><ul><li>#include &lt;stdio.h&gt; </li></ul><ul><li>#include &lt;math.h&gt; </li></ul><ul><li>int main (){ </li></ul><ul><li>double param, result; </li></ul><ul><li>param = 5.5; </li></ul><ul><li>result = log (param); </li></ul><ul><li>printf (&amp;quot;ln(%lf) = %lfn&amp;quot;, param, result ); </li></ul><ul><li>return 0; </li></ul><ul><li>} </li></ul>
• 13. Log and exponential <ul><li>Example : </li></ul><ul><li>#include &lt;stdio.h&gt; </li></ul><ul><li>#include &lt;math.h&gt; </li></ul><ul><li>int main (){ </li></ul><ul><li>double param, result; </li></ul><ul><li>param = 5.5; </li></ul><ul><li>result = log (param); </li></ul><ul><li>printf (&amp;quot;ln(%lf) = %lfn&amp;quot;, param, result ); </li></ul><ul><li>return 0; </li></ul><ul><li>} </li></ul>