
DQNOK wrote: Do you know the algorithm for using the rand() function (which generates a uniform PDF) to generate values within a specified PDF?
I answered my own question.
For a PDF called 'y(x)' (where x is the random varaible), and a computer library function rand() that returns a random value in the range [0, 1) from a uniform PDF, we seek to map rand's return value (call it rx) to the correct x.
Effectively, we are looking for x such that the area under the curve y(x) LEFT OF x is equal to the area under the uniform PDF left of rx. But since rand produces values within the unit interval [0,1), rx IS the area under the curve left of rx. So, we seek x such that:
rx = integral from infinity to x of y(x)
Exactly HOW we evaluate the integral (i.e. solve for x) is an implementation detail that depends on how y(x) is defined. If the integral is already given via a formula, we just use a standard nonlinear scalar solver, like a NewtonRaphson. It not, then perhaps I would just use a stepping approach, something like:
ndx = getBestStartingIndex(rx);
x = X_STARTS[ndx];
area = AREAS[ndx];
old_y = y(x);
while( area < rx )
{
x += dx;
new_y = y(x);
area += dx * (old_y + new_y)/2 ;
old_y = new_y;
}
return x;
Which can be polished for better precision, timeperformance etc.
David

Empirical studies indicate that 20% of the people drink 80% of the beer. With C++ developers, the rule is that 80% of the developers understand at most 20% of the language. It is not the same 20% for different people, so don't count on them to understand each other's code.
http://yosefk.com/c++fqa/picture.html#fqa6.6

modified on Thursday, April 17, 2008 9:28 AM





OK, you've got me thinking...
The PDF appropriate for a given used part is the subset of the original PDF that is (thinking graphically) "to the right" of that part's age. BUT, this part of the graph doesn't have unit area (the area under this part of the curve is no longer unity). But even that doesn't seem such a large handicap; just normalize it by the area that IS there.
If I could somehow mathematically model this "lefttruncated" PDF, I could  as you alluded to in your response, use it to assign a random life. As you pointed out, taking the mean of the remainder of the original PDF gives the best EXPECTED life; I just need to figure out how to use that remainder to assign a random life.
Hmmmmm... Maybe it's not so hard. I'll have to think about it a while.
David

Empirical studies indicate that 20% of the people drink 80% of the beer. With C++ developers, the rule is that 80% of the developers understand at most 20% of the language. It is not the same 20% for different people, so don't count on them to understand each other's code.
http://yosefk.com/c++fqa/picture.html#fqa6.6






I have a problem about hamilton algorithm .I don,t know how do I write it ? Please send me a document which discuss about it .Thanks





You're going to have to be more specific...
What has the future in store for this strange being, born of a breath, of perishable tissue, yet Immortal, with his powers fearful and Divine?
What magic will be wrought by him in the end?
What is to be his greatest deed, his crowning achievement?





What is Hamilton algorithm?
(just curious).
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
 Iain Clarke





I'm assuming he means one of these.[^]
What has the future in store for this strange being, born of a breath, of perishable tissue, yet Immortal, with his powers fearful and Divine?
What magic will be wrought by him in the end?
What is to be his greatest deed, his crowning achievement?





Thanks .Hamilton algorithm : what do I want to say that the method to
find cycle hamilton .This is a algorithm in graph theory subject .
 algorithm which find cycle hamilton





Source code is available from this page[^].
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer  Rush





I think he's referring to this[^]. The physics references refer to Hamiltonian mechanics which is a way of constructing a set of differential equations to describe a physical system.
And when the sunlight hits the olive oil, don't hesitate.





I see.
Vaguely.
Drawing on my fine command of language, I said nothing.





I know  the distinction isn't clear. If you think of the Hamiltonian in physics (loosely) as the path/configuration of minimum energy, then you can see why Hamilton's algorithm for vertex paths is related.
Yes/no? It has to do with each vertex (in the case of the Hamiltonian algorithm for graph theory) being touched only once...
And when the sunlight hits the olive oil, don't hesitate.





I get what you're saying, but I was trying to read up on Hamiltonian mechanics, and it was WAY complicated. I was getting it, and then it completely lost me. I'm too dumb, sorry.
Drawing on my fine command of language, I said nothing.





Ravel H. Joyce wrote: I get what you're saying, but I was trying to read up on Hamiltonian mechanics, and it was WAY complicated. I was getting it, and then it completely lost me. I'm too dumb, sorry.
No, you're not dumb. Your mind is still pure and clean. Your innocence hasn't been taken from you; you haven't been touched by the horrors of Jackson[^] yet.
Also, to understand Hamiltonian mechanics, you have to understand the mathematical language it's formalized in. You are too young to have been exposed to calculus yet let alone generalized position and momentum equations or the principle of minimum variation. Let's just say that Hamiltonian mechanics is a grand generalization of classical mechanics (physics). In it's most easily understood terms, the Hamiltonian of a system represents the minimum energy configuration. It allows you, for example, to derive a set of equations of, say, a particle in a field  a set of equations that will describe the evolution of i.e. position and momentum over time.
And when the sunlight hits the olive oil, don't hesitate.





73Zeppelin wrote: Your mind is still pure and clean.
...oh...
That was serious...
But I have a basic understanding of calculus. I have a very patchy knowledge of mathematics, actually, now that I think about it. I know that e^{ip} + 1 = 0 ! ...except that I don't really know how it's derived or anything. Well, I very vaguely do, a very superficial knowledge. I know what a complex number is, despite my probable lack of being able to do much with it. I know that 5 is bigger than 4. I guess that's what you get from reading random Wikipedia articles and being stopped from being accelerated!
So wait, the Hamiltonian of a system represents the minimum energy configuration...so, a particle moving in a straight line (well, no acceleration) is the lowest energy configuration?
I dunno where I'm going with this. Hopefully to a little more understanding, but that's not overly likely.
Drawing on my fine command of language, I said nothing.





Ravel H. Joyce wrote: So wait, the Hamiltonian of a system represents the minimum energy configuration...so, a particle moving in a straight line (well, no acceleration) is the lowest energy configuration?
I dunno where I'm going with this. Hopefully to a little more understanding, but that's not overly likely.
Well, that depends: a particle moving in a straight line being acted upon by what forces?
A hydrogen atom (in the ground state) can be described by a quantum mechanical Hamiltonian that gives the equations for the description of the hydrogen atom (ground state). In fact, the Hamiltonian in quantum mechanics leads to the Schrödinger equation  one of the fundamental equations of quantum theory. And since we are talking about the ground state of an atom, we are really considering its lowest energy configuration.
Ravel H. Joyce wrote: a particle moving in a straight line (well, no acceleration) is the lowest energy configuration
No! A particle at rest is! A particle moving in a straight line with no acceleration still has kinetic energy!
And when the sunlight hits the olive oil, don't hesitate.





73Zeppelin wrote: Well, that depends: a particle moving in a straight line being acted upon by what forces?
No acceleration = no forces?
73Zeppelin wrote: No! A particle at rest is! A particle moving in a straight line with no acceleration still has kinetic energy!
Moving in a straight line relative to what? At rest relative to what?
I didn't think that there was a difference...
[Edit #1] Wait...I'm confused about kinetic energy. So...accelerating something gives it kinetic energy? What is kinetic energy? Is it an increase in mass because of an increase of energy? (E=mc^{2})? Or am I just completely missing the point?
Maybe I'm just making this unnecessarily complicated...
[Edit #3] I don't think I really get the concept of 'at rest'.
Just a thought  would the act of dropping a nuclear bomb (and having it accelerate towards the ground) increase the energy of the explosion a tiny bit? Rather than having it sit motionless? Ignoring, of course, the ground absorbing heaps of the energy of the explosion.
73Zeppelin wrote:
A hydrogen atom (in the ground state) can be described by a quantum mechanical Hamiltonian that gives the equations for the description of the hydrogen atom (ground state). In fact, the Hamiltonian in quantum mechanics leads to the Schrödinger equation  one of the fundamental equations of quantum theory. And since we are talking about the ground state of an atom, we are really considering its lowest energy configuration.
Ground state.
Lowest energy configuration.
What does that entail? Absolute zero?
[Edit #2] Question: if you accelerate an atom to a high enough speed can it cause an electron to jump to a higher orbital?
Ground state incorporates both being at rest and having minimum level energy electrons, doesn't it?
[Edit #4] No, AHHH!!! I don't get it. My thoughts are racing too fast. I'm gonna go, I dunno, eat a cookie or something...
[Edit #5] Kinetic energy is a relative measure, isn't it? E_{k} = 1/2*m*v^{2}, and velocity is relative, so kinetic energy is too?
Drawing on my fine command of language, I said nothing.
modified on Wednesday, April 23, 2008 2:19 AM





Ravel H. Joyce wrote: No acceleration = no forces?
But can I not put a particle in a magnetic field or even a gravitational field and have it exhibit zero velocity? Can I not put a particle in a magnetic field or even a gravitational field and have it exhibit no acceleration? ("At rest" implies zero velocity.)
Let's get a nice, accurate definition of no acceleration:
1. No acceleration = no NET external forces.
2. A net external force acting on a particle produces an acceleration in the direction of the force  the force being equal to the product of the particle's mass times its acceleration. Sound familiar?
Ravel H. Joyce wrote: Moving in a straight line relative to what? At rest relative to what?
I didn't think that there was a difference...
[Edit #1] Wait...I'm confused about kinetic energy. So...accelerating something gives it kinetic energy? What is kinetic energy? Is it an increase in mass because of an increase of energy? (E=mc2)? Or am I just completely missing the point?
Maybe I'm just making this unnecessarily complicated...
[Edit #3] I don't think I really get the concept of 'at rest'.
Just a thought  would the act of dropping a nuclear bomb (and having it accelerate towards the ground) increase the energy of the explosion a tiny bit? Rather than having it sit motionless? Ignoring, of course, the ground absorbing heaps of the energy of the explosion.
You are overcomplicating it. Let's go step by step.
For your edit 1: When a particle is at rest in the presence of external forces, it possesses potential energy. When you climb up a hill and sit on top of that hill (at rest, v=0, a=0 and so no net external forces acting on you) you possess potential energy. If you roll down the hill  you start to accelerate down the hill with acceleration due to gravity, g  then you possess kinetic energy. You have taken the potential energy you gained by climbing that hill and converted it to kinetic energy. As you accelerate down the hill and your velocity increases you gain kinetic energy. Eventually you will stop accelerating and move with constant velocity, v. Your kinetic energy is then proportional to your mass times the square of your velocity. So kinetic energy is very sensitive to velocity!
Kinetic energy is 0.5*m*v^2, where m is the mass of the particle and v is the velocity. Kinetic energy is "energy of motion", hence "kinetic". Any particle with nonzero mass (or with zero mass! but the above equation is no longer valid) and velocity possesses kinetic energy. Since acceleration doesn't appear in the equation, acceleration can be zero and a particle can still possess kinetic energy. Kinetic energy, in the classical sense, isn't an increase in mass, no.
Ravel H. Joyce wrote: Just a thought  would the act of dropping a nuclear bomb (and having it accelerate towards the ground) increase the energy of the explosion a tiny bit? Rather than having it sit motionless? Ignoring, of course, the ground absorbing heaps of the energy of the explosion.
No. It would certainly increase the kinetic energy of the bomb, but not it's yield. The yield is proportional to the configuration of the bomb, not it's velocity towards the ground.
Ravel H. Joyce wrote: Ground state.
Lowest energy configuration.
What does that entail? Absolute zero?
No, not absolute zero. That's something different. In the basic hydrogen atom you have a proton for the nucleus circled by an electron. The electron "orbits" the proton and possess a certain quantized energy value. If we "excite" that atom, the electron "jumps" to another energy level by another distinct "quantum" of energy. There are ground state hydrogen atoms all around you! There are ground state atoms of neon gas all around you! An example of neon atoms not in the ground state is a neon store sign! When you add energy to "excite" a neon atom, you cause some electrons in that atom to jump from their ground state to higher energy levels. As they fall back to the ground state they emit light  that light is the light you get from a neon sign.
Ravel H. Joyce wrote: Question: if you accelerate an atom to a high enough speed can it cause an electron to jump to a higher orbital?
Ground state incorporates both being at rest and having minimum level energy electrons, doesn't it?
Not by accelerating the atom, but by adding energy to it  for example hitting it with another particle. On impact, the impacting particle can impart energy to the target atom. That energy will cause orbital electrons to jump into higher energy orbits. The ground state doesn't imply "at rest" here. The ground state implies the minimum energy configuration for the atom's electrons.
Ravel H. Joyce wrote: Kinetic energy is a relative measure, isn't it? Ek = 1/2*m*v2, and velocity is relative, so kinetic energy is too?
Ahhhh...now you get into relativistic corrections...to give you a simple answer  yes, there is a relativistic version of the kinetic energy equation. But to talk about that, we have to consider velocities that approach the speed of light.
And when the sunlight hits the olive oil, don't hesitate.





Oh, OK, I get it. I was getting all...muddled.
Drawing on my fine command of language, I said nothing.





Thanks for that, by the way. I was rushed off to dinner before. It must be annoying, answering stupid questions. You'd be an awesome teacher, I reckon.
Drawing on my fine command of language, I said nothing.





Ravel H. Joyce wrote: hanks for that, by the way. I was rushed off to dinner before.
No problem.
Ravel H. Joyce wrote: It must be annoying, answering stupid questions.
No, not at all  no questions are stupid (well...no intelligent questions... )
Ravel H. Joyce wrote: You'd be an awesome teacher, I reckon.
I'm afraid I didn't enjoy my teaching days. Most of the students weren't interested in learning and I had no patience for it. If a student was interested in the material, I had all the patience in the world. Unfortunately most were not  they were there either because they thought that university was the "popular thing to do" or they wanted what they thought was a fast ticket to a highpaying job. They were unwilling to make the required effort and I didn't appreciate that. The internet is a much better teaching platform  I can "disconnect" from it at will! But I did like teaching the higher university years  that's where the serious students were... Anyways, I much prefer a situation where I teach from timetotime and where I can do my research most of the time...I like writing books, not teaching books.
Anyways, ask all the questions you like  don't be discouraged by my pessimism.
And when the sunlight hits the olive oil, don't hesitate.





Um, OK:
What happens when the unstoppable force hits the immovable object?
Drawing on my fine command of language, I said nothing.





To answer that, you have to know if the chicken or the egg came first!
And when the sunlight hits the olive oil, don't hesitate.





I'd use my time machine to go and see, but...you know those ships in bottles? Yeah, my time machine is stuck in a Klein bottle of all things, and then some guy and his weird cat went and took it! I knew how fast they were running away, but I couldn't for the life of me figure out where they were.
Drawing on my fine command of language, I said nothing.





Ravel H. Joyce wrote: I'd use my time machine to go and see, but...you know those ships in bottles? Yeah, my time machine is stuck in a Klein bottle of all things, and then some guy and his weird cat went and took it! I knew how fast they were running away, but I couldn't for the life of me figure out where they were.
Klein bottles? Schrödinger's cat? Where do you pick this stuff up at your age?
And when the sunlight hits the olive oil, don't hesitate.





I think a lot of it was from StumbleUpon[^]
Drawing on my fine command of language, I said nothing.




