|
maybe was for the OP...wasn't it?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
There was me talking about linear regression and trend lines
|
|
|
|
|
Frank Kerrigan wrote: Grady Booch: I told Google to their face...what you need is some serious adult supervision.
|
|
|
|
|
I hate to admit that you don't get the best advice here, but if you google "Gateway Arch in St. Louis equation" and take the first hit....
Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."
|
|
|
|
|
I'm interested in earth map programming .
For instance , on a rectangular projected earth map ,
its easy to place cities by lat & long ,
but harder to draw great & small earth circles
like sunlight perimeters .
Also for earth pictures taken from space :
? what is "map" projection
? math for lat&long points
? math for earth circles
Please recommend good sphere math book for this .
Thanks , Jim D
|
|
|
|
|
|
I disagree. Well, not completelly, but suficiently.
In a growing civilization we are bound to always find people ready to go beyond. Their number will never reach zero. And I propose that the ability to solve problems and imagine solutions to problems is increasing not because people are becoming smarter but, instead, because generation upon generation we are allowed to build where others left off.
My proposition is not a simple one. Even the definition of "smartness" (is this a word??) is hard to define in this context. We need not only traditional "smartness" but also large amounts of memory, speed of reasoning, ability to correlate the uncorrelated, and (depending on the area of interest) a close contact to physics and the real world or the largest possible distance from it. We also need to find science interesting, and very often we have to be "smart enough" to select the right topic to research on.
Anyway, my proposition implies that as science (including mathematics) becomes more complex, we will always find people that are able to understand it and expand it. This is simple, we just have to start where others left off and resist the temptation of understanding everything from scratch. Many are good at that. This makes me confident that science as an art is not destined to disapear.
However, science as an art is becoming less and less important in our society. Today I see a booming necessity for the pragmatics. I call them that because they are people who know enough to get things to work, have a very developed intuition about where to focus their attention, and an extremely important ability to take complex abstract results that others developed and strip them down to the point where it becomes practical to do something with them (this strip down is an expansion in knowledge, not a reduction).
Please note that what I meant is that science as an art will probably never disapear, but there will be a breed that will be ready to take control of the progress of our civilization by using scientific results and findings and expanding them to aplicability.
Anyway, even if you (or your source) were right, if science as an art disapeared that would simply mean that it had become useless and uninteresting to absolutely everyone. That has not happened yet to the disco sound, so what is the real possibility of science as an art becoming useless and uninteresting to absolutely everyone?
Rilhas
|
|
|
|
|
I don't think I confused anything... you meant continuous [number system] as oposed to discrete [number system], right? If so then I stand by my argument. I don't think it is destined to come to an end, and I don't say that only about mathematics but about science in general (I was just trying to make a "larger" point).
Discrete mathematics has its own dificulties, it just avoids the problem of the "infinitely small". Who will address those issues if not continuous mathematics? Will someone ever say "I've reached the infinitely small, and now I find it boring... I'll just stop ellaborating on it". I don't think so, unless we find that the universe is not continuous. That could make continuous mathematics come to a halt when it reaches "that minimum". Do you believe that?
Although the first few words of your post address the issue of continuity, all the remaining text addresses the issue of exagerated complexity as a "show stopper". Even the conclusion of the message sugests that it is meant to be applied to mathematics as a whole. Anyway, I thought you were posting your message as a means of exchanging ideas, and not of publicizing books (please take no ofense). So I think that this is where I confused your post, since I didn't realize that your post was confined to continuity (for me there is no real issue there).
Anyway, I'm not a mathematician, just a guy sharing his thoughts.
Rilhas
|
|
|
|
|
guys, is there a function in C++ that shifts the elements of an array? lets say that i have an array of 20 elemetns and i need to shift it by one element to the right, then the last element should become the first and the first one will be the second and so on.....am not sure if its called circular shift or rotation or something like that. sorry
if there is no function, then how would you go about it? you need to save memory and processing time on small controllers.. thanks!!!
|
|
|
|
|
Hi,
AFAIK there is no such function available in the standard libraries.
The operation should be called rotation.
A buffer that gets used from 0 till dim-1 then back to 0 etc is called a circular
buffer.
Are you sure you need to move the data around, a circular buffer is used for
many purposes (e.g. between a producer and a consumer, using a put and a get pointer);
circular buffers may be optimized by using a dimension that equals a power of two
(so you dont need to test for wrapping around, you simply mask away the overflowing
bit).
If you must move the data over an arbitrary shift amount, you could use an existing
copy function twice:
-once for the part that moves to the right, and once for the part that moves to
the left; since source and destination overlap, you would need a temp buffer for
one of the moves.
Moving over only one position only needs one memcpy or similar, and one temp variable.
|
|
|
|
|
std::rotate from <algorithm>.
Steve
|
|
|
|
|
If U want to save memory and processing time,U should not shift the entire array.
Instead U can have a variable say idxStart.It must be first set to ZERO.
If U want to shift to the right do like this:
idxStart=(--idxStart+arrayLength)%arrayLength;
While referring the array elements always refer like:
for(i=0;i<arrayLength;i++)
cout<<array[(i+idxstart)%arraylength];
hope, this="" will="" help="" u.
=""
=""
<div="" class="ForumSig">Regards,
Arun Kumar.A
|
|
|
|
|
// CommandLine.cpp : Defines the entry point for the console application.
//
#include "StdAfx.h"
#include <iostream>
#include <algorithm> // for 'std::rotate' and 'std::copy'
#include <iterator> // for 'ostream_iterator'
int main()
{
using namespace std;
int numbers[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
int *pOnePastEnd = numbers + sizeof(numbers)/sizeof(numbers[0]);
cout << "Before rotate:" << endl;
copy(numbers, pOnePastEnd, ostream_iterator<int>(cout, " "));
cout << endl;
// Rotate left.
rotate(numbers, numbers+1, pOnePastEnd);
cout << "After rotate left:" << endl;
copy(numbers, pOnePastEnd, ostream_iterator<int>(cout, " "));
cout << endl;
// Rotate right.
rotate(numbers, pOnePastEnd-1, pOnePastEnd);
cout << "After rotate right:" << endl;
copy(numbers, pOnePastEnd, ostream_iterator<int>(cout, " "));
cout << endl;
return 0;
}
Steve
|
|
|
|
|
Thank you all for all the responses.. much appreciated..
I think i'll go with Arun's method of changing the index. Steve, i got a question.. how do i know about the functions in a library? dumb question, sorry! but not evrything is mentioned in the documentation. oh, yeah and thanks for the code...
|
|
|
|
|
I read a book on the STL. You could also look through the <algorithm> header file. C++ programmers should get acquainted with STL. I also recommend studying the Boost libraries.
Steve
|
|
|
|
|
will do.... thanks man. I've just started with C++. from engineering days, am used to matlab.. but i think its always good to add other languages too..
|
|
|
|
|
Sorry to butt in here, but I'd recommend the book "The C++ Standard Template Library: A Tutorial and Reference" by Josuttis for exactly that purpose. There are several chapters you can skim and get a good sense pretty quickly as to what's in the STL, without being bored to tears.
It also has lots of good examples and discussions and things like that. I've looked into a couple books in the past, trying to do exactly what you're talking about, and that one towers over the rest, IMHO. Excellent stuff.
|
|
|
|
|
There was a Project Meeting of the Star Wars Program (in the 80's) and the Project Manager stood up and said, I've got bad news about the Particle Beam Weapon. Our engineers calculate that the Particle Beam Weapon will require 10 to the 20th power watts, and we've only been able to supply 10 to the 10th power watts. So a member of the audience piped up, 'Hey great, we're half way there!'. Probably a lawyer.
|
|
|
|
|
I have devised an infinite series based on the Golden Ratio which converges to ln(x) (natural logarithm. Can somone check my work and comment? I would like to know its origin. Is there a friendly grad student in a math department at some university who would be interested? thanks, Joeinorange2@aol.com
Joe Sharp
|
|
|
|
|
Can you post it somewheres?
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
We can clearly see that the only sources of true
random numbers lie in nature. Nowhere else.
But then again, is nature truly random? or is God just joking with us? Let's say God
thinks and put numbers into nature. We then really need to analyze God's brain and
thinking patterns, because that's where the real generation algorithm will lie.
Various factors like emotions, mood, stress etc. will have to quantitatively dealt
with, and one will need to see how each of those factors relate to the numbers God
churns out into nature.
In a similar light, we ourselves are the true source of random numbers. When we
think of random numbers, they really are random. Truly random. And the functioning
of the human brain (how it related to the numbers we think of), is beyond the
analysis abilites of science today.
If that sounded crazy, let me assure you that I didn't intend it to. Just sharing some
honest thoughts, which you might assume has come from a mentally ill person.
ASP - AJAX is SEXY. PERIOD.
|
|
|
|
|
There are some pretty random posts on these forums - I guess that if we hashed them then that would have to be random - or maybe it would make more sense!
Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."
|
|
|
|
|
It's an interesting discussion, and to really get into it, you have to define what random means. Every physical system has various numbers attached to it, which are the things you can "measure" about that system. So a flying plane, for example, has numbers like "momentum", "position of the z axis", "acceleration", etc. Furthermore, these values aren't completely independent. If you know the "momentum" and "acceleration" at time 0, you can make a really good guess for the momentum at future times (with guesses for sooner times better than future times).
The implication would be that for a physical system, there is a "purely mathematical" part, that describes the abstract system. There is also a random part added in though. This implies that the physical system is somewhat random. So if the velocity of a falling block is 0 at time =0 and it's acceleration is -g, then you can make a solid guess as to the velocity at t=1.0 seconds -- it won't be random at all. However, if you factor out the mathematical part, you'll get a purely random part. So if, for instance, you expected the velocity at t=1 to equal -g meters/second, you could sample the actual velocity at t=1 and would get a Gaussian out.
In the real world, this particular example has a very strong physical/mathematical component and a very small random component. On the other hand, with various quantum mechanical systems, it has been proven that the "physical/mathematical" component is 0, and the answer you will get out is completely random.
So I disagree with you that people are a good source of randomness. You can ask someone to give you 100,000 random numbers between 0 and 100 and you'll find that the output is very non-random. In my interpretation, this reflects some "laws of the mind" that are totally non-random (the fact that I really "feel" 17 is random, and "1" is not would be one example). That said, if you were able to figure out the physical laws, you can factor those out and get something purely random out. So a physical law of the brain would say that I feel "17" is so random, I will pick it 10% of the time, as opposed to 1%, but whether in a particular run I pick it more or less than exactly 10% will be completely random.
So if you want to find purely random numbers, pick a physical system. Either pick one that has no relationships between it's variables -- these are found mostly in quantum mechanical systems -- and are really completely random, or pick one where you know the physical system perfectly and factor out the predictable physicality to get something random.
But there are truly random entities in math. If you're familiar with the halting problem, the probability that a random program (basically a program that consists of a random 1 or 0 everytime the computer needs some input) is completely random (after the first few digits). But there isn't any way to calculate it, and so it can't be used. Practically, using a formula that isn't random, but for which you can prove it looks random is the best way to go. (You can actually buy a physical random number generator, but unless you are worried about cryptographic stuff, it won't do any better for you than a software RNG, and if it breaks, you might not be able to tell, which isn't a problem with software RNGS).
|
|
|
|
|
My reply was rather tongue in cheek - as much of a comment on the original post as anything. Clearly there are potentially major problems with using this sort of thing to generate random numbers - predictable diurnal variations to do with time-zones and culture shifts come to mind. That said, if we use a good hash function - the hashes of the posts are probably pretty random.
Nathan Addy wrote: you have to define what random means
I agree.
Nathan Addy wrote: for a physical system, there is a "purely mathematical" part, that describes the abstract system. There is also a random part added in though
I don't know what you mean by this - are you simply implying the Heisenberg uncertainty principle, or the uncertainty in your measurement or both?
Nathan Addy wrote: So if, for instance, you expected the velocity at t=1 to equal -g meters/second, you could sample the actual velocity at t=1 and would get a Gaussian out
Why, and why Gaussian?
Nathan Addy wrote: So if you want to find purely random numbers, pick a physical system
I agree, sytems based on thermal noise or shot noise I believe are good examples of this - and seem to be the best types of generators of randomness that we have. Interesting question - are they truly random or is it just that our theories at this stage are not good enough?
Nathan Addy wrote: But there are truly random entities in math. If you're familiar with the halting problem, the probability that a random program (basically a program that consists of a random 1 or 0 everytime the computer needs some input) is completely random
It's been a long time since I studied Turing machines - but you example sounds circular - do you really need random data to generate random output?
Nathan Addy wrote: You can actually buy a physical random number generator, but unless you are worried about cryptographic stuff, it won't do any better for you than a software RNG, and if it breaks, you might not be able to tell, which isn't a problem with software RNGS
I agree - I have done a reasonable amount of Monte-Carlo simulation and the pseudo-random generators these days are pretty good, just don't use the basic rand() function. If I was a bank generating their RSA key I'd probably want something better.
Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."
|
|
|
|
|
|