# Ideas for Math/Computer Project

1. Mar 17, 2004

### recon

Hi guys, I'm in need of a topic to do for my math project. What's difficult about the project is that I need to demonstrate the power of mathematics through using the computer. I have no access to supercomputers, so any ideas that would involve a normal home computer would be great. I need to do the project at a high school level, but would be willing to do any project requiring higher skills if it is feasible. Alas, I have no programming skills, and I only have a rudimentary idea of C++ and BASIC from a few years back! If it helps, I do have the mathematica software.

The project is due in 1 month, but I need to inform the teacher of what my topic is going to be about 2 weeks from now.

Edit: My math teacher suggested devising teaching aids, but it sounds dull as hell to me. Perhaps some of you may be able to come up with some fresh ideas. I tried but I can't.

Last edited: Mar 17, 2004
2. Mar 17, 2004

### Damned charming :)

Can you tell the exact question and the level of maths you are at.

you can use microsoft excel to show that
$$\frac{d^2x}{dt^2} =- kx$$
like in the case of a springs

you can use some logic and the identity
$$\cos(\frac{\theta}{2}) = \sqrt{ \frac{ \cos ( \theta)+1}{2}}$$
to calculate pi using excel.

Last edited: Mar 17, 2004
3. Mar 17, 2004

### recon

I am now in what would be equivalent of the American 10th Grade. I do well in mathematics at school, and am picking up calculus and trigonometry pretty quickly. However, I do not understand the significance of the equations you have written yet. I have a book about logic that is very interesting, but I gave up reading it as I did not have the time. I would be very much interested in looking into your suggestion, so could you please elaborate? Thank you once again.

4. Mar 17, 2004

### Damned charming :)

1) Are you aware of the rate of change of displacement is velocity?
i.e. v = dx/dt
2) Are you aware of the rate of change of velocity is accelation?
i.e a = dv/dt = d^2x/dt^2
3) Are you aware that force is proportional to accelatrion?
4) Are you aware that the force that a spring exerts is proportional to how much you pull.
5) Can you combine these facts to give that if x is the displacemnt on a weight on a spring then

$$\frac{d^2 x}{ dt^2} = -kx$$

After a 2 pages of work you can show that after two pages of work you can show that $$x=A\sin( \sqrt{k} t)$$ however using excel you can quickly get a nice looking sin curve by getting it to take many tiny intervals of time and estimate things using equations 1 to 5.

5. Mar 17, 2004

### Chen

Actually it's:

$$\Sigma F = m\vec a = -k\vec x$$

That gives:

$$\vec a = \frac{d^2\vec x}{dt^2} = -\frac{k}{m}\vec x$$

Which results in:

$$\vec x = A\cos(\omega t)$$

When:

$$\omega = \sqrt\frac{k}{m}$$

6. Mar 17, 2004

### Damned charming :)

@recon Chens comment and my reply to him will have no direct connection to your problem and you can ignore them if you don't follow them.

@Chen
that is indeed what is in a physics textbook, but my treatment is still correct if you treat k as a constant of proportionality. I don't think the thread author is sitting a physics exam anytime soon.

and bye the bye the complete solution is actually
$$x =a cos ( \omega t) + bcos( \omega t) =A sin (\omega t + \phi)$$ where $$\phi$$ is the phase shift.
A phase shift is clearly necessary because the equation

$$x = A cos ( \omega t)$$ then x must be A when t=0.

7. Mar 17, 2004

### Chen

Not if you assume that the weight started its movement in one of the amplitudes of its motion, which is how it would work if you were to conduct this experiment in the lab. Whether the system was laid out horizontally or vertically, you would need to give the weight an inital (potential) energy and the best simple way to do that would be to pull the spring, thereby causing the weight to be at the amplitude at $$t = 0$$.

And by the way, Recon, if you need to prove that these formulas are correct as part of the project, just making the graph in Excel is not enough. :)

8. Mar 17, 2004

### recon

Yes, very throughly.

Actually, yes to all. I see what you mean now.

But, here's where you lose me.

9. Mar 17, 2004

### recon

Damned charming :), I am really ingratiated to all you've come up with up to this point. But right now, I am really sifting through all the potential topics for my project. I would be glad if you could tell me more about the logic and identity idea above. Is there a webpage you could refer me to for that harmonic motion thingy or for anything else? It sounds exciting and I would love to know more about it.

To Chen and anyone else, keep those ideas coming please. Thanks!

10. Mar 17, 2004

### recon

Please explain. What could I do to rectify the situation?

11. Mar 17, 2004

### Damned charming :)

O.K. An actual school teacher liked this example and yours might as well.

For estimating pi you could use a hexagon and find the area. It would be more accurate to use an octogon, and a 100 sided polygon would even be more accurate. To calcuate the area of a polygon you can calculate the area of a triangles (6 in a hexagon, 8 in a octogon etc)
you can use the formula area = 1/2*a*b*sinC = 1/2r^2 sin C. If you want accurate measurements for pi you need to get sin of a small angle. Now if you can find cos of small angles that is easily manipulated to give sin of a small angle. And the identy I mentioned
give
$$cos(15) = \sqrt{ \frac{ cos(30) + 1 }{2}$$
once you have cos(15) you can find cos(7.5) with

$$cos(7.5) = \sqrt{ \frac{ cos(15) + 1 }{2}$$

then you could find cos(3.75) etc etc, you can automate the process and get a very good approximation of pi.

OK I have done the excel file for my calculus question and
I can email it to you if you pm me you email address. (I cannot attach it). As chen points out it is not a proof but it is crude example of numerical integration which is something engineers actually use.
I suppose Chen will point out the following information which is not useful to you. My guess is Chen would want to say " you should you numerically integrate something that you can solve directly, and you should use the Runge Kutta method".

12. Mar 17, 2004

### Chen

You would have to develop the equations and show that the harmonic motion indeed adheres to the formula of $$\vec x$$ that Charming posted.

One of the ways to do that is by comparing the simple harmonic motion to the uniform circular motion:
But this doesn't have much to do with computers.

Why don't you try to prove that every map can be colored with just 4 colors? ;)
http://www.cs.uidaho.edu/~casey931/mega-math/gloss/math/4ct.html

Last edited by a moderator: Apr 20, 2017
13. Mar 17, 2004

### Damned charming :)

@recon
I have sent you an excel file where you use the computer to numerically integrate
$$\frac{d^2x}{dt^2} = -x$$ and you get an x= cos(t) curve.

I like it because computers can't calculate something
like cos(0.92) ( get calculator in rad mode) directly they have to use multiplication and division. My method shows that gets cos(0.92) correct to 3 decimal places and only uses multiplication and addition and can clearly be made more accurate to produce a higly accurate x=cos(t) curve.

It works by assuming x is initially 1, v is 0 (the spring is fully stretched), and acceleration is -1. After 0.001 of a second
new value of x $$\approx$$ oldvalue of x + 0.001 old value of v

new value of v $$\approx$$ old value of v + 0.001 old value of a

new value of a = -new value of x

you start with the original value, use this to get the second value
use the second value to get the third value the third value to get the fourth etc.

Now why the teacher may like because it draws a cos curve only by
using addition and multiplication and you can also go to physics site
and copy and paste the formal proof. You can point out that the computer does many calculations whereas and the formal proof predicts these calculations.

Last edited: Mar 17, 2004
14. Mar 18, 2004

### recon

Thanks for the excel file. I am not an expert of Excel, so I don't know how you generated so many lines. They weren't typed out individually, were they? Also, what physics site are you referring me to above?

15. Mar 18, 2004

### Damned charming :)

In excel you can highlight a pattern, then click on the bottom right
corner of the screen then drag things down and it will continue the pattern. For example you could open excel and type in 2,4,6 in the cells (rectangles) A1,A2,A3. Then you could highlight cells A1,A2,A3
and click and hold the little black square on the bottom corner of cell A3. You must keep holding the mouse button down you can select cells A1,A2,A3,...,A10. If you let the mouse button go cells A1,A2,..A10 will contain the information 2,4,6,8,....,20.
This is fairly common knowledge so if you know anyone good with computers they should be able to help you. You can of course search the web for introduction to excel.
http://www.unt.edu/training/Office2000/Excel2000.pdf seemed ok.

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.

16. Mar 18, 2004

### recon

No, this is the part where I don't understand. I did a google search of generating the cos curve using multiplication and substraction only and found nothing. I want to know a proof or explanation for it.

17. Mar 18, 2004

### NateTG

I think a good project might be to do something involving computational complexity. It's one of a few situations where computers and mathematics typically intersect, but you really want to be aware of Taylor/McLaurin series first.

In a more general sense, computers are excellent numerical tools, but not really that great for mathematics, and it's difficult to understand what "demonstrate the power of mathematics" means.

P.S.

The usual modern method for calculating $$\cos(x)$$ ,where $$x$$ is in radians, is to use the Taylor series:
$$\cos(x)=\sum_{i=0}^\infty\frac{(-1)^ix^{2i}}{(2i)!}$$
with the undstanding that $$0^0$$ is one in this case

18. Mar 18, 2004

### recon

Thanks for your reply NateTG. But it seems to me that the Taylor Series goes on forever without converging (is that the word?) for most values of x. It feels very inconvenient but is that what Damned Charming :) meant when he said 'multiplication and addition only'?

Last edited: Mar 18, 2004
19. Mar 18, 2004

### Chen

Actually, it does converge. Since X can only be between 0 and 2PI, 2i! grows larger much faster than X^2i, so at some point the series does converge.

20. Mar 18, 2004

### matt grime

The power series converges for all x, and very quickly too.

21. Mar 18, 2004

### matt grime

Why must x only lie between 0 and 2pi? What do you mean by 'at some point ... does converge'? Is the point x, or, do you mean, after some number of terms in the summation it 'suddenly' converges? Neither is accurate: it converges for all points x, meaning given any e>0, there is an N such that the absolute value of the difference between any of the partial sums of p and q terms, for p and q larger than N is at most e.

22. Mar 18, 2004

### recon

I just did a bit of googling, and computational complexity seems to involve quite a bit of computing skills which, if you've read my thread-opener, I don't have that much of. What I found interesting about computational complexity is that it is used in analysing Games and Puzzles by analysing the efficiency of algorithms. Are there simple situations where computational complexity can be demonstrated.

23. Mar 18, 2004

### NateTG

Understanding what computational complexity is does not require much computer sophistication.

A classic example of computational complexity is generation of Finonacci (not sure of spelling) numbers:

Fibonacci numbers are defined as follows:
$$F_0=1$$
$$F_1=1$$
$$F_n=F_{n-1}+F_{n-2}$$

This leads to a naive implementation of the fibbonacci number function:
Code (Text):

int fib(int n) {
if(n<0) {
fprintf(STDERR,"Unexpected argument to fib\n");
exit 1;
}
if(n<2) {
return 1;
}
return (fib(n-1)+fib(n-2);
}

This is a relatively 'slow' way to generate Fibonacci number, since it generates the n'th Fibonacci number in O(2^n) steps.

A better way to do this is:
Code (Text):

int fib(int n) {
int i=0,j=0,k=1,l=0;
for(i=0;i<n;i++) {
l=j+k;
j=k;
k=l;
}
return k;
}

Which generates the n'th fibonacci number in O(n) steps.

Of course, if you're sophisticated, you can do even better:

Code (Text):

int fib(int n) {
return ( (1.6180339)^n-(-0.6180339)^n)/(2.236067977))
}

or something similar using Binet's formula. For small n, this takes constant time (actually O(log n) or so).

For a wider spectrum of performance, you can use different methods for generating the digits of &pi;

24. Mar 18, 2004

### Damned charming :)

@recon
I will explain a crucial part about my excel program, if you understand it go and show your teacher the program and discuss it.

We can be a bit inaccurate and say. Don't worry the
errors will only occur in the third decimal place.
$$a \approx \frac{ \delta v}{ \delta t} = -x$$

rearranging gives$$\delta v = -x \delta t$$
This is saying the small change in v after a small change in time
is equal to -x * change in time.

So velocity after t+ 0.001 seconds $$\approx$$ velocity
at t seconds -x* 0.001.

so if we know a,x and v at time 0 , we can use thes to get a good estimate of a,x, and v at time 0.001. We can then use the estimates at time 0.001 to estimate the values at time 0.002, and so on and so forth. This is a very very crude form of a useful topic called numerical integration, but it gives you the basic idea that if you know a particles acceration and initial condition you can use a computer to predict were it goes. Obviously our simple example can be done by many other methods but if acceleration is a very difficult function of x and v then our numerical method shows you roughly how an actual computer would predict how the particle moves over time.

Last edited: Mar 19, 2004
25. Mar 18, 2004

### recon

Sorry, I'm just reposting it and recorrecting your [/tex] because I don't understand Latex yet and consequently can't visualise the formula in its [edit: raw] Latex form.

Last edited: Mar 18, 2004