Make a Spreadsheet for Homework: Cos & Sin Graphs

  • Thread starter Thread starter fk378
  • Start date Start date
AI Thread Summary
The discussion focuses on creating a spreadsheet to graph cosine and sine functions by integrating their respective equations. Users are attempting to implement the formulas for c(t) and s(t) based on initial conditions and changes defined in the homework statement. There is confusion regarding the correct formulas to input into the spreadsheet, particularly how to calculate the values for each subsequent row based on the changes in c and s. The conversation highlights the need for numerical integration to approximate the sine and cosine curves, with some users noting that their results do not oscillate as expected. The final point emphasizes the connection between the graph's behavior and the estimation of pi through the zero crossings of the cosine function.
fk378
Messages
366
Reaction score
0

Homework Statement


Make a spreadsheet with a dimensionless column marked "t" that goes from 0 to 20 in units of 0.05. Now make columns marked "c" and "s". Integrate the functions c(t) and s(t) with the properties that:

1) c(0)=1
2) s(0)=0
3) Change in c= -s*(change in t)
4) Change in s= c*(change in t)

Make a graph of c vs t and s vs t. Remind you of anything?

The Attempt at a Solution


I know it's supposed to look like cos and sin curves, but what is the formula I'm supposed to input into the cells? I tried to integrate the equations and for 3) I got c= -s*(t2-t1)
and for 4) I got s=c*(t2-t1)

But my values get more and more negative and the graphs don't look like the cos and sin curves.
 
Last edited:
Physics news on Phys.org
Hi fk378,

fk378 said:

Homework Statement


Make a spreadsheet with a dimensionless column marked "t" that goes from 0 to 20 in units of 0.05. Now make columns marked "c" and "s". Integrate the functions c(t) and s(t) with the properties that:

1) c(0)=0

Should this be c(0)=1?

2) s(0)=0
3) Change in c= -s*(change in t)
4) Change in s= c*(change in t)

Make a graph of c vs t and s vs t. Remind you of anything?


The Attempt at a Solution


I know it's supposed to look like cos and sin curves, but what is the formula I'm supposed to input into the cells? I tried to integrate the equations and for 3) I got c= -s*(t2-t1)
and for 4) I got s=c*(t2-t1)

What is the exact formula you are typing in the cells? (For example, if c and s are in columns B and C, what is the formula entered in B2 and C2?)

Is it updating correctly over all 401 rows?
 
alphysicist said:
Should this be c(0)=1?
Yes, thank you. I just edited it.

alphysicist said:
What is the exact formula you are typing in the cells? (For example, if c and s are in columns B and C, what is the formula entered in B2 and C2?)

Is it updating correctly over all 401 rows?

It is updating, I believe. Well B2 and C2 are just the initial conditions so I have c=1, s=0 in those. In B3 I have (-C2)*(A3-A2) where time is in the A column. In C2 I have (B2)*(A3-A2).
 
fk378 said:
Yes, thank you. I just edited it.



It is updating, I believe. Well B2 and C2 are just the initial conditions so I have c=1, s=0 in those. In B3 I have (-C2)*(A3-A2) where time is in the A column. In C2 I have (B2)*(A3-A2).

I believe that is not correct. Those values -s*(change in t) and c*(change in t) from the original problem are the changes, not the values themselves.

So for example, you have B2=1 and C2=0. What is B3? The quantity (-C2)*(A3-A2) tells you how much that the B-column function changes in going from B2 to B3 (not the value of B3 itself). So what would the formula for B3 be?



(After you finish this step, are you supposed to find ways to make it closer to a sine and cosine function?)
 
Well, I mean what I did was "integrate" the original equations we were given. So for equation (3), after integrating the change in c, I just get c. Then integrating the right hand side of the equation, I get integral of (-s)*(change in t) which just yields (-s)*(t2-t1).

If that is not correct, am I just supposed to rearrange the equation and then for example for equation (3) get:
-s=(change in c)*(change in t) ??
 
fk378 said:
Well, I mean what I did was "integrate" the original equations we were given. So for equation (3), after integrating the change in c, I just get c. Then integrating the right hand side of the equation, I get integral of (-s)*(change in t) which just yields (-s)*(t2-t1).

If that is not correct, am I just supposed to rearrange the equation and then for example for equation (3) get:
-s=(change in c)*(change in t) ??

The way I read the problem, is that you use the (3) and (4) directly to give the change from one cell to the next one--you would not alter them at all, just use them as they are as part of your cell formula.

The process of adding these cells one at a time would be a type of numerical integration to get the values at t=20 (not a very accurate one, but enough to see the similarities to a sine and cosine curve). So when they talk about integrating, they mean numerical integration and are just referring to the process of adding up all of these small changes.
 
Okay, I did do that now...but I still get the same problem---the values toward the end of the graph are just zero because the values keep getting more negative throughout the spreadsheet.
 
Maybe it is supposed to be this way though because the second part of the question asks:

(b) Make an extended graph in the region 1.5<t<1.6 and look where the curve crosses zero. Multiply your answer by 2 and you have an estimate of pi. Why does that work?

If i do this for the cosine curve, I get 1.55. Then 1.55*2=3.1 which is approx pi. Any idea on why this would work?
 
fk378 said:
Okay, I did do that now...but I still get the same problem---the values toward the end of the graph are just zero because the values keep getting more negative throughout the spreadsheet.

I'm not sure what you mean; do you mean the curves are heading downwards and never oscillate back upwards?

If you can, let me know what formulas you are using for B3,B4,C3,C4, because I am getting this:

http://img263.imageshack.us/img263/1183/spreadsheetfe9.jpg

The curves are getting larger with time because the approach here is not very careful; are you getting something very different? If so, can you upload a picture, or describe it more fully?

fk378 said:
Maybe it is supposed to be this way though because the second part of the question asks:

(b) Make an extended graph in the region 1.5<t<1.6 and look where the curve crosses zero. Multiply your answer by 2 and you have an estimate of pi. Why does that work?

If i do this for the cosine curve, I get 1.55. Then 1.55*2=3.1 which is approx pi. Any idea on why this would work?

The curve you are looking at there is supposed to be similar to the cosine function. At what (first) value of t does cos(t)=0? (in radians, of course)
 
Last edited by a moderator:
Back
Top