Jump to content

[SOLVED] "for" loops and "sin()"


PEF524

Recommended Posts

hey...

 

im trying to make a loop using all of the degrees 0-360 and displaying with the Sine of each of those is EX) 

Angle  Sin

  0      0

  1    .01745

  2    .0349

etc etc

 

... this is what im doing and it is not working, can anyone help?

 

<?php

$sin=sin($i);

$i=deg2rad($i);

for($i=0; $i<=360; $i=$i+1)

echo "$sin";

?>

 

thanks!

 

 

Link to comment
Share on other sites

What happens if you just do:

print sin(deg2rad(1));

Does that work?

 

The sin of 1 degree, is very small, right, it's almost 0, yeah? (or is that cos?)

So it should print a very small number. You may have to format it in order to get it to look right.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.