How fast would a computer do this?

  • Thread starter disregardthat
  • Start date
  • Tags
    Computer
In summary: The computer can handle this quite easily. However, the more functions you have to calculate at all times, the slower the computer will be. If you want to speed up the process, you can try to use a software that can do the calculations for you, or you could try to find a faster computer.
  • #1
disregardthat
Science Advisor
1,866
34
Hi, I have little experience with computer and programming (just a little on my calc) and I wonder how fast a computer really is. Would it be a problem for a computer to "graph", that will say calculate several expression frequently for different inputs at once?

I have about 40 expressions kind of like this:

[tex]f(x)=([A_1x+B_1+C_1sin(D_1(x-E_1)]^2+[A_2x+B_2+C_2sin(D_2(x-E_2)]^2)^{\frac{1}{2}}[/tex]

[tex]A_k,B_k,C_k[/tex] and [tex]D_k[/tex] are constants.

And if a computer were to graph these at all times, how well would it handle it?

I know of course that the speed depends on the frequency of the calculations, but I want it fairly high, much higher than the calculator graph the curves.
 
Technology news on Phys.org
  • #2
Depends on the optimization of the program, processor speed, background processes, amount of RAM...
 
  • #3
Probably the speed of a well written computer program will make your calculator look like a snail compared to it :smile: To get more specific information, you should be more clear about where the data come from, how you want to plot it, which program you have in mind, etc.

PS I just did a little test: in a very ugly hack-like first approximation, it takes me about 5 seconds to plot 40 of them with random [itex]A_k, B_k, C_k, D_k[/itex] simultaneously (and plotting consecutively makes it about 5x faster).
 
  • #4
Thanks for the replies.

I have as previously said very little experience with programming.

But I am trying to make this:

We specify coordinates to two rectangles, and the speed of rotation and the speed and direction of the centre.

Now, I have made out purely by vectors and their properties an algorithm of knowing when the rectangels hit each other, and how they shall bounce off each other.

I have:

Four vectorfunctions which describe the positions for each corner in each rectangle which is in this form:

[tex]\vec{r}(x)=[A_1x+B_1+C_1sin(D_1(x-E_1)),A_2x+B_2+C_2sin(D_2(x-E_2))][/tex]

That makes eight functions to graph at all times.

Now I have defined the radius of the rotation circle of each rectangle to be R and R'. Now I have also made a similar vectorfunction for the positions of the centres S and S' in each rectangle, and when |\vec{SS'}| <= R+R', (the distance between the centers is less than the radius of each rotation circle) then I want several calculations to be made:

I want to calculate several distance formulas from each corner in one rectangle to every other point in the other rectangle. I use a method by using vector dot-product to see when a corner of one rectangle is on the edge of the other rectangle, basically when they touch each other. But this requires many functions to calculate at all times, e.g. the distance functions from the points. When I sum they up, there are about 40-80 of these functions that I want to be calculated at all times, and when a specific value appears, I want the "collision" stage start. Which will make several differences in the path and rotation speed of the rectangles.

Perhaps a bit babbly, but I hope you see what I mean. As you obviously can see, this won't work on a calculator, I need a computer, but first I want to know if this is possible.

Thanks
 
Last edited:
  • #5
Remember computers are fast. If it takes a couple of 1000 calculations to find a hit then you can still do 1million/sec! Especially since the amount of memory used if very small and so will fit in cache.
There are a lot of tricks to speed-up collision algorithms - they are very heavily used in games. For more complicated shapes your graphics card probably has hardware to do it for you.
 
  • #6
Just eyeballing it it doesn't look too bad at all. You would want to use something like http://www.wolfram.com/products/mathematica/index.html" for this.

If there's a university or college with a Mathematics or Physics department near you they may have computer labs with one of these programs available that you can just walk in and use.
 
Last edited by a moderator:
  • #7
CaptainQuasar: Can you use Matlab to create such a program? I have heard good things about it.

mgb_phys: I am interested in these methods to speed up collision algorithms, do you have a source of information?
 
  • #8
This site is generally good for games develeopment tutorials http://www.gamedev.net/reference/list.asp?categoryid=199 the link is to list of collision detection articles.

For general geometry algorithms (intersections of lines etc) this site has the clearest descriptions and most readable code http://local.wasp.uwa.edu.au/~pbourke/geometry/

For using graphics cards to do this start with the links on the wikipedia page about physics_engine
 
Last edited by a moderator:
  • #9
Hey, thanks for the links. I wonder though, could you take a look at the ideas I have if I wrote them down in lucid form and tell me if there's something worth trying? You seem to know this stuff. I have never done anything like this, or read anything about it. It will only be a few pages.
 
Last edited:
  • #10
Jarle said:
CaptainQuasar: Can you use Matlab to create such a program? I have heard good things about it.

Matlab etc. wouldn't create a program. Those programs are themselves like graphing and symbolic calculators.
 
  • #11
Do you know of a program which is much like the calculator Texas's way of programming? It's the only programming language I know of. I have made a sketch on how the program should be now, so I really just need something to program it into.
 
  • #12
Jarle said:
Do you know of a program which is much like the calculator Texas's way of programming? It's the only programming language I know of. I have made a sketch on how the program should be now, so I really just need something to program it into.

No, you would probably have to learn to program / write commands for whatever software you're using. But if you're going to continue with math in school it's well worth it to spend the time learning, these programs can do amazing things. My favorite is Mathematica. When I was in school I always dreamed about buying a palmtop computer like the http://www.oqo.com/products/index.html" and running Mathematica on it, rather than using a graphing calculator.

Here's an open source one called http://www.gnuplot.info/" . It's probably more difficult to use and less versatile than the commercial ones I mention above but it's free so you can download it and try it out right now. But also, if you're willing to spend some money and you're a student you probably can qualify for a student discount of one of the commercial ones, which would probably put it between US$100-US$200.
 
Last edited by a moderator:
  • #13
CaptainQuasar said:
you're a student you probably can qualify for a student discount of one of the commercial ones
If you're a student, first check with your local computing department if they don't have it available for you. At my university, we can just go and get a Mathematica installation CD and we are allowed to you the program for free (of course, the license is only valid while you are actually registered as a student).
 
  • #14
Each evaluation requires getting 4 constants from memory and doing maybe 10 bit operations (6 additions, 2 subtractions, 2 for some kind of shuffling around with registers), 8 multiplications, a square root, and two sines. If the sines and roots take 60 cycles and the multiplications take 10, and the floating point ops can run side-by-side with the integer ops, then you're talking at least 180 cycles, and possibly as many as 300 if everything is blocking and there's a lot of shuffling needed.

If you're varying the x coordinates and keeping the constants, um, constant, then each graph takes 8 * (180 to 300) * number of x points total cycles. For a thousand points that would be 1.4 to 2.4 million cycles; for ten thousand that would be 14 to 24 million. If you do nothing else, a 1 GHz processor core could do 416 to 714 (thousand) or 41 to 72 (ten thousand) refreshes per second. With a fast lookup table for sines and such this could be lower.

If you use the packed SSE instructions you could probably get a factor of 2 speedup as well.
 
  • #15
Hey, thanks for the information. Now I think I can lower the equations to about 16 of these:

f(x)=Asin[B(x-D)]+E+Fx

I found a much better idea to find when each collision occur. Instead of calculating each step to see if a point is touching a side, I can rather calculate WHEN it will occur, and at that t, the collision stage begin. So it's basically just those mentioned above, plus 32 equations which will only be calculated once. I think I could do it on my graphics calculator too (kind of slow though), if I only had two more spots for parameterised curves :\ I only have 6 spots, and I need 8.

I wonder, is there any way to get more variables than A to Z and theta? And I'd appreciate if someone told me how to get more spots on parameterised curves. I have a TI-84 Texas.
 
Last edited:

Related to How fast would a computer do this?

1. How fast can a computer process data?

The speed at which a computer can process data depends on several factors, such as the processor's clock speed, the amount of RAM, and the type of tasks it is performing. Generally, modern computers can process data at a rate of billions of operations per second.

2. How long does it take for a computer to complete a task?

The time it takes for a computer to complete a task varies depending on the complexity of the task and the capabilities of the computer. Simple tasks, such as basic calculations, can be completed in milliseconds, while more complex tasks, such as rendering graphics or running simulations, can take hours or even days.

3. Can a computer process data faster than a human?

In most cases, yes. Computers are designed to process data quickly and efficiently, while humans have limitations in terms of processing speed and capacity. However, there are certain tasks that humans can perform faster than computers, such as recognizing patterns or interpreting emotions.

4. How does the speed of a computer affect its performance?

The speed of a computer is a crucial factor in its overall performance. A faster computer can process data and complete tasks more quickly, resulting in improved efficiency and productivity. However, other factors such as memory, storage, and software also play a role in determining a computer's performance.

5. Can the speed of a computer be increased?

Yes, the speed of a computer can be increased by upgrading its hardware components, such as the processor, RAM, and storage. Software optimization and regular maintenance can also help improve a computer's speed and performance.

Similar threads

  • Programming and Computer Science
Replies
30
Views
4K
Replies
26
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
1
Views
826
  • Advanced Physics Homework Help
Replies
1
Views
993
  • Precalculus Mathematics Homework Help
Replies
3
Views
1K
  • Calculus and Beyond Homework Help
Replies
14
Views
2K
Replies
6
Views
1K
Replies
10
Views
1K
  • Special and General Relativity
Replies
8
Views
2K
Back
Top