Ideas for Math/Computer Project

  • Thread starter Thread starter recon
  • Start date Start date
  • Tags Tags
    Ideas Project
Click For Summary
SUMMARY

The forum discussion revolves around selecting a math project that demonstrates the intersection of mathematics and computer science, specifically for a high school student with limited programming skills. Suggestions include using Microsoft Excel to visualize simple harmonic motion through the equation d²x/dt² = -kx and employing the identity cos(θ/2) = √((cos(θ)+1)/2) to approximate π. The conversation highlights the importance of numerical integration and the use of Excel for creating graphs and simulations, emphasizing the need for a solid understanding of calculus and trigonometry.

PREREQUISITES
  • Basic understanding of calculus, including derivatives and integrals.
  • Familiarity with Microsoft Excel for data visualization and numerical calculations.
  • Knowledge of simple harmonic motion and related equations.
  • Introduction to Taylor series for approximating functions.
NEXT STEPS
  • Learn how to implement numerical integration techniques in Excel.
  • Explore the concept of simple harmonic motion and its mathematical representation.
  • Study the Taylor series and its applications in approximating trigonometric functions.
  • Investigate computational complexity and its relevance in mathematics and computer science.
USEFUL FOR

High school students, educators, and anyone interested in bridging mathematics with computer applications, particularly in the context of project-based learning.

  • #31
Originally posted by recon
Excel does have a cosine function, and I generate the same graph as you (at least on a large scale)using that. As you say, computers calculate cos(x) indirectly, so how does Microsoft Excel go about doing that? Is it more accurate than our way of doing it? Does it use methods like the ones you said Chen would suggest using earlier, i.e. Range-Kutta? Is that how calculators generate cos(x) as well?
Runge-kutta is generally used if you want many points on a curve, and you when have the rate of change initialy but not many inital values on the curve.

To find a single value of cos(x) a calculator would use taylor series.
cos(x) = 1 -x^2/2 + x^4/(4*3*2*1) -x^6/(6*5*4*3*2*1)+...
The +... means that the series goes on for ever however it can be shown it is enough to use the first few terms. I suppose your project how many of these terms you need. I doubt it is more than 6 in old calculators because they produced an error when you tried to take the cos of 10^20.



The basic idea about how this formula was found is easy understand in laymans terms, a formal proof is obviously more tricky.


It is reasonable to assume that cos(x) is can be represented by a polynomial with infinitely many terms.

So
cos(x) = a + bx + cx^2 + dx^3+ ...

now how would you find a? well sub in x=0 and you get
cos(0) = a + b*0 + c*0^2+...
so a = cos(0)=1

to find b differentiate both sides of the polynomial to get
-sin(x) = b + 2x+ 3dx^2+...
sub in x=0 and get
b= -sin(0) = 0

You can continue to keep finding the coefficents and come up with
cos(x) = 1 -x^2/2 + x^4/(4*3*2*1) -x^6/(6*5*4*3*2*1)+...
 
Physics news on Phys.org
  • #32
The error term in an alternating series that converges is always less that the last term - if you pair off the following terms, you can see that the total, if it exists, is smaller than the term that was added.

Another usefull thing to note about the Taylor series is that it represents a sequence of improving approximations - first a linear approximation, then a quadratic, cubic, etc..

Regarding calculators:
Considering the number of digits that \frac{(10^20)^4}{4!} has, it's harldy surprising that you would get an overflow error. A naive taylor series method for generating the cosine would involve roughly 20 terms to start getting reasonable accuracies.
 
  • #33
Originally posted by NateTG
... the probability that x^2+y^2>1 is \frac{\pi^2}{4}, so you could take that approach to finding \pi.
Actually, the probability of that is \frac{4 - \pi}{4}. Similarly, the probability that x^2+y^2 \leq 1 is \frac{\pi}{4}.
 
Last edited:
  • #34
Originally posted by Chen
Actually, the probability of that is \frac{4 - \pi}{4}. Similarly, the probability that x^2+y^2 \leq 1 is \frac{\pi}{4}.

Right. One of these days I'll figure out this math thing ;)
 
  • #35
I used the method to calculate \pi on my computer today, the result was 3.1403104. About 0.04% off the real value of it, not so bad I guess considering I took only 5 million random points.
 
  • #36
The ideas posted so far are great, so thanks a lot guys. However, I'm wondering if there is anyway I can use simple methods for factoring large numbers in computers?
 
  • #37
Originally posted by recon
The ideas posted so far are great, so thanks a lot guys. However, I'm wondering if there is anyway I can use simple methods for factoring large numbers in computers?

Ah, of course -- cryptography. Computational complexity is, of course, a real issue here. You might as well use a naive approach. I think the current best approach is 'eliptical factoring' or something similar. Certainly not all that great.
 
  • #38
Originally posted by Damned charming :)

I page that formaly proves that x = cos(t) when k/m = 1 would be
http://www.upei.ca/~physics/polson/course/P112/notes/ch13/ch13.pdf
If you don't like it google search " simple harmonic motion proof" from a different page.

I have read the physics lecture about simple harmonic motion (at least the first 8 pages). I think you assume the phase constant to be zero. What is a phase constant?
 
  • #39
According to this formula:
x = A cos ( \omega t)
The object is at the amplitute when the time starts. However, according to this formula:
x = A sin ( \omega t)
The object is at the middle of its motion when the time starts. Both are true, but they apply to different cases (which differ in when you start to measuring the time).

To solve this we add a phase shift, \phi to the formulas. This constant basically tells you were the object was when you started to measure time. If we consider this formula: (and again, both sin and cos can be used; they will just have a different phase shift constant)
x_{(t)} = A\sin (\omega t + \phi)
Then if \phi = 0, the object was in the middle when time started. However if \phi = \pi / 2 then the object was in one of the amplitudes when time started. These are the obvious numbers, but if for example \phi = \pi / 6 you need to find x(t) for t = 0:
x_{(t = 0)} = A\sin (\omega t + \frac{\pi}{6}) = A\sin (\frac{\pi}{6}) = \frac{A}{2}
Therefore if \phi = \pi / 6 the object is halfway between the amplitude and the middle when time started.
 
  • #40
The phase constant is easy to understand if you know that
" out of phase" means "out of synchronization"

If I started playing a song over and over and 20 seconds later
you started playing the same song over and over we would 20 seconds out of phase

I will give a numerical example that you could check using Chen's
method of exactly deriving the equation.
( please note that w is supposed to be omega but my keyboard cannot type the code for omega at the moment).

If you had two identical springs and stretched the first at time 0 and let it go then the displacement of the first spring is given by
x_1 = A cos(w t)


if you waited 20 second and stretched the other spring at let go
its displacement would be
x_2 = A cos(w (t-20)) = A cos(wt - w20)

Notice that and the springs are out of phase by 20 seconds and the phase constant is w20.
 
Last edited:
  • #41
Might be easiest to understand the nature of \phi by seeing how the simple harmonic motion related to the uniform circular motion:
http://www.phy.ntnu.edu.tw/java/shm/shm.html
\phi is the simply the angle between the horizontal-left radius of the circle and the inital position of the black ball. In that Java applet, \phi = 0.
 
Last edited by a moderator:
  • #42
So, for calculating cos(t) it doesn't really matter what \phi is (or where the object started oscillating), but we keep the value to 0 or 2\pi because cos(t) has a cycle of 2\pi?
 
  • #43
I don't really follow but I am assuming you are pointing out that
cos(t - pi/4) looks exactly the same as cos(t) just shifted over, and if you are interested in how a spring moves with time it simplifies things a bit if you set t=0 to be a case where x=A.
this makes the equation x= cos(t) not something like cos(t-pi/4).
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
560
  • · Replies 5 ·
Replies
5
Views
4K
Replies
4
Views
2K
  • · Replies 8 ·
Replies
8
Views
5K
  • · Replies 35 ·
2
Replies
35
Views
8K
Replies
1
Views
2K
  • · Replies 18 ·
Replies
18
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 7 ·
Replies
7
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K