

11182012, 11:15 PM


A Very Gentle Bort


Join Date: Jan 2005
Location: Bortlandia
Gender: Male


Re: Homework Help Thread  Linear Algebra Edition
Sine! Cosine!
Cosine! Sine!
Three point one
four one five nine!
__________________
\V/_ I COVLD TEACh YOV BVT I MVST LEVY A FEE

11182012, 11:16 PM


more of a before rehab friend


Join Date: Jul 2004
Location: Silicon Valley
Gender: Bender


Re: Homework Help Thread  Linear Algebra Edition
Quote:
Originally Posted by Dragar
So, as I'm a physicist...
Can you think of any physical variables that might be represented by your differential equation?

Um... waves?
Do you mean that equation, specifically?
I'm doing my thesis on nonlinear PDEs, specifically Korteweg–de Vries equation and nonlinear Schrodinger equation. I know what physical phenomena those represent.
(And Deadlokd thought he was joking. )

11192012, 10:58 AM


Now in six dimensions!


Join Date: Jan 2005
Location: The only hill in Oxford
Gender: Male


Re: Homework Help Thread  Linear Algebra Edition
Quote:
Originally Posted by Ensign Steve
Quote:
Originally Posted by Dragar
So, as I'm a physicist...
Can you think of any physical variables that might be represented by your differential equation?

Um... waves?
Do you mean that equation, specifically?
I'm doing my thesis on nonlinear PDEs, specifically Korteweg–de Vries equation and nonlinear Schrodinger equation. I know what physical phenomena those represent.
(And Deadlokd thought he was joking. )

Yup, that equation specifically!
Waves is always a good first step, but a wave is a description of a behaviour of a thing, not a thing itself. Your equation is actually a form of a simple harmonic oscillator, one of the most important equations in all of physics. Mainly because almost everything can be approximated to this motion when motions are small.
Your first term  the second derivative  is the acceleration. So that's like the 'force' in F=ma. All the other terms we should think of in terms of forces.
If you had a first derivative, that would act as a damping term; frictional forces are proportional to velocities. Depending on the sign of the coefficient, you could have negative damping, causing a runaway effect  meep!
Then you have a term proportional to y. You have y'' = y, essentially  so you have a linear restoring force. The further away from y=0, the more you get pushed back to it. This is actually the same force for springs (see Hook's Law), and for pendulums when the motion is small.
Your final term doesn't depend on y  it's a driving force. Your full equation is actually an example of a driven, undamped harmonic oscillator. And you've got two competing frequencies in the system  the natural frequency without the driving force (corresponding the natural swing of a pendulum, or the bounce of a spring) and the frequency of your driving force. (You should write both of these down for your equation and compare!). If the two are very close, you get a resonance effect  like pushing your friend on a swing in time with the natural oscillation of the swing. If the two frequencies are different...well, you can imagine what happens based on your experience with swings, right?
These sorts of equations are found everywhere in physics. Springs, pendulems, electric circuits, quantum mechanics, electromagnetism, particle physics, orbital mechanics, acoustic physics.... and so on. One of my favourite physicists, Sidney Coleman, once described the life of a young theoretical physicist as 'treating the simple harmonic oscillator in ever increasing levels of abstraction'.
If you study Schrodinger's equation, you'll end up studying the quantised version of the harmonic oscillator equation. In fact, you'll see that you can treat any potential well as approximately the harmonic oscillator for small energies.
In fact, modern day particle physics does exactly this  matter is viewed a field, where at each and every point in space there is a simple harmonic oscillator, coupled to all its neighbours (and other fields). That means modern field theory is merely the process of solving an infinite number of coupled, simple harmonic oscillators  and perturbing them slightly outside of that approximation!
So your humble little equation is actually an example of one of the most important equations ever studied. Treat it kindly, study it well!
__________________
The miracle of the appropriateness of the language of mathematics for the formulation of the laws of physics is a wonderful gift which we neither understand nor deserve. Eugene Wigner
Last edited by Dragar; 11192012 at 12:37 PM.

11192012, 03:59 PM


more of a before rehab friend


Join Date: Jul 2004
Location: Silicon Valley
Gender: Bender


Re: Homework Help Thread  Linear Algebra Edition
Will do!

11192012, 10:07 PM


Bornagain counter


Join Date: Oct 2007
Location: Utrecht, the Netherlands
Gender: Male


Re: Homework Help Thread  Linear Algebra Edition
Just look at the sign! The sign!!!

11202012, 07:58 AM


Re: Homework Help Thread  Linear Algebra Edition
Why algebra can save you time and money
Proof That Girls Are Evil
__________________
Integrity has no need of rules
 Albert Camus

11202012, 11:10 AM


Now in six dimensions!


Join Date: Jan 2005
Location: The only hill in Oxford
Gender: Male


Re: Homework Help Thread  Linear Algebra Edition
Quote:
Originally Posted by Pan Narrans
Just look at the sign! The sign!!!

Pff, near enough (though I did misread that!). You can always replace x with ix. It's just a Wick rotation away!
Of course then you have a hyperbolic driving term...
__________________
The miracle of the appropriateness of the language of mathematics for the formulation of the laws of physics is a wonderful gift which we neither understand nor deserve. Eugene Wigner

11172013, 04:38 AM


more of a before rehab friend


Join Date: Jul 2004
Location: Silicon Valley
Gender: Bender


Re: Homework Help Thread  Linear Algebra Edition
Guys, help me out with this graph. The vertical axis has a logarithmic scale, and then the curves look like log functions. Does that mean that the curves are actually linear?
From the application, I feel like the blue line is supposed to diverge a hell of a lot from the other two (I figure that's why they used the log scale, otherwise the scale would be too far off to fit all three lines). But if they're all linear, that wouldn't be the case.
What's the significance of the blue line being at 7 when the red and green are at 2? I don't think that means it's 3.5 times bigger. Damn I can't read this shit, it's like the fucking Ricter scale.

11172013, 07:58 AM


Trying to find the actual stastics


Join Date: May 2007
Location: Augsburg
Gender: Male


Re: Homework Help Thread  Linear Algebra Edition
The curves diverge a lot near the origin, but they seem to become steadier and nearly parallel* for larger values of n, which suggests all 3 functions settle down to an exponential trend.
Log 7 means 107 where Log 2 stands for 102, so the blue process is about 10 000 (105) times slower than the others.
*parallel log means as the three functions increase, they remain in the same approx. 10 000X relation,
__________________
... it's just an idea
Last edited by mickthinks; 11172013 at 11:11 AM.
Reason: wrong figures

11172013, 03:36 PM


puzzler


Join Date: Aug 2004
Location: UK


Re: Homework Help Thread  Linear Algebra Edition
It doesn't make much difference but beware that MatLab (and Octave) tend to use natural logarithms rather than base10 ones unless you explicitly write say log10(computationTime) instead of log(computationTime)
With base10 the logarithm of any number, x, is the power to which 10 must be raised to get x, so log10(100) is 2, log10(1000) is 3 and so on.
Natural logarithms are just the same except that they use e≈2.718281828 instead of 10
log(100) ≈ 4.6, and log(1000) ≈ 6.9
The natural logarithm of a number is always ≈ 2.3 times larger than the log10 of the same number. The exact multiple is just the natural logarithm of 10, log(10) in MatLab.
If you remember that adding logarithms is like multiplying the original numbers that the logs were derived from, you won't go far wrong.

11172013, 03:53 PM


more of a before rehab friend


Join Date: Jul 2004
Location: Silicon Valley
Gender: Bender


Re: Homework Help Thread  Linear Algebra Edition
Awesome, thanks, both of you!
I didn't make the graph, but I'm assuming it's log base10 from context. But anyway, I don't care about the exact values, so I don't think the base is important. It's more the shape of the curves at that scale that is tripping me up.
Is there anything special about having a logshaped curve on a logarithmic scale? If one were to "stretch" the graph out so that it was at a linear scale, would those curves straighten up to linear or bend past it to exponential? (I bet if I could remember how to find the derivative of a log function, it would help.)
I think that a linearlooking function on a log scale is really exponential (thanks, mick!) but if the slope was zero, the function would look the same at both linear and log scales, just constant, right? But I guess the question is, what does a linear function look like at a log scale? It looks like a log function, yeah? As the slope of the line decreases, does the function ever "pass through" linear on its way from exponential to constant?
Don't worry if that question makes no sense, it doesn't to me either.
Last edited by Ensign Steve; 11172013 at 04:35 PM.

11172013, 04:02 PM


more of a before rehab friend


Join Date: Jul 2004
Location: Silicon Valley
Gender: Bender


Re: Homework Help Thread  Linear Algebra Edition
Oh wait! I got it! Maybe. Here's my question.
All three lines are roughly the same shape, logshaped, but the blue line has a greater slope. Assuming they approach parallel but never reach it, the blue line will keep diverging a whole lot at the linear scale. Is it possible that the blue line could represent an exponential function while the red and green lines represent linear functions, even though all three are the same shape but with different derivatives?
Edit: just reread this:
Quote:
Originally Posted by mickthinks
which suggests all 3 functions settle down to an exponential trend.

of course
Here is the thing that is still tripping me up. What happens as the slope of the red and green lines approach zero? Is it still exponential, just a really small exponent? (Is there such a thing? maybe like raising something to the 1.00001 power?)

11172013, 04:40 PM


Stoic Derelict


Join Date: Sep 2011
Location: The Dustbin of History
Gender: Male


Re: Homework Help Thread  Linear Algebra Edition
Do you mean if Y becomes a horizontal asymptote as x increases? In that case you might find the limit and use the limit as an approximation, if you have to fill in numbers? Asymptotes stretch to infinity, and the slope gets incrementally smaller, so I'm not sure if you can ever really nail down a number to use for an exponent.
Sorry if I'm just talking gibberish, I haven't really done any maths in a long time.
__________________
Chained out, like a sitting duck just waiting for the fall _Cage the Elephant

11172013, 06:42 PM


puzzler


Join Date: Aug 2004
Location: UK


Re: Homework Help Thread  Linear Algebra Edition
I scanned the data into Octave and recreated the plot so you can see the original numbers (Octave is like an opensource MatLab, so the same code should run in MatLab, if that's what you're used to).
First here's my plot so you can check it's near enough to your original.
I don't know why the Xaxis legend isn't showing "x 10^4" instead of "x 10"  must be some weirdness in the Octave xlabel command  but anyway that's only the legend  the points really are plotted using a x 10^4 scale.
Next, here is the raw data that creates the plot:
#points ANN time CUDA time CUBLAS time
512 0.00063 0.00063 0.00063
1024 0.01585 0.00251 0.00200
2048 0.25119 0.00398 0.00251
4096 6.30957 0.01000 0.00631
8192 158.48932 0.06310 0.02512
16384 3981.07171 1.58489 0.50119
32768 158489.31925 19.95262 6.30957
65536 6309573.44480 251.18864 100.00000
and here's the Octave program that has the data, draws the plot and then writes out the data in table form:
clear ; close all; clc;
data = [
# n log10(ANN) log10(CUDA) log10(CUBLAS)
512, 3.2, 3.2, 3.2;
1024, 1.8, 2.6, 2.7;
2048, 0.6, 2.4, 2.6;
4096, 0.8, 2.0, 2.2;
8192, 2.2, 1.2, 1.6;
16384, 3.6, 0.2, 0.3;
32768, 5.2, 1.3, 0.8;
65536, 6.8, 2.4, 2.0
];
x = data(:, 1) ./ 1E4;
plot(x, data(:, 2), "@+b", x, data(:, 3), "@or", x, data(:, 4), "@*g"); % ANN, CUDA, CUBLAS);
xlabel('Number of points n X 10^4');
ylabel('Log computation time');
legend('ANN', 'CUDA', 'CUBLAS');
printf("#points ANN time CUDA time CUBLAS time\n");
for i = 1:size(data, 1)
fprintf("%5d %15.5f %15.5f %15.5f\n", data(i, 1), 10 ^ data(i, 2), 10 ^ data(i, 3), 10 ^ data(i, 4));
end
Last edited by ceptimus; 11172013 at 06:53 PM.

11172013, 11:24 PM


more of a before rehab friend


Join Date: Jul 2004
Location: Silicon Valley
Gender: Bender


Re: Homework Help Thread  Linear Algebra Edition
You are too awesome, cept! I was 5 minutes away from trying to graph it by hand.

11182013, 12:05 AM


puzzler


Join Date: Aug 2004
Location: UK


Re: Homework Help Thread  Linear Algebra Edition
From the data you have it looks like CUDA is about twoandahalf times slower than CUBLAS and ANN is hundreds or thousands of times slower than CUBLAS on the same number of points.
Unless there are some other factors involved, CUBLAS is the winner.
None of them looks like they will scale very well to very much larger data set sizes without taking unfeasibly long run times. Its just possible that the curves might flatten out eventually but it seems unlikely to me based on the data you have. If it were possible to do so, I'd try out just CUBLAS on some bigger data sets to see whether its curve looks like it might ever level out.

11182013, 12:19 AM


more of a before rehab friend


Join Date: Jul 2004
Location: Silicon Valley
Gender: Bender


Re: Homework Help Thread  Linear Algebra Edition
The question is whether CUDA and CUBLAS perform better enough than ANN for it to be worth a shitload of time and money to invest in the switch. I think it does, but I have to justify it.

11192013, 09:56 PM


Trying to find the actual stastics


Join Date: May 2007
Location: Augsburg
Gender: Male


Re: Homework Help Thread  Linear Algebra Edition
I guess that depends on  the current upper limit for n and how long ANN takes to complete the task currently,
 how often the job needs to be run,
 and whether and by how much the task is expected to expand in the future
If the job is run once weekly and ANN can do it in 100 hrs, then there's no need to pay a huge premium to have it done by CUBLAS in a few secs*. But if you expect the task to grow in the next few years then ANN might soon need more than a week to run ...
On the other hand, if the process needs to return results every time someone clicks on a website icon then ANN would be no earthly use unless n were guaranteed to remain relatively small.
*BTW I fucked up here  105 means ANN is in the order of 100 000 times slower, not 10 000 times
__________________
... it's just an idea

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)


Thread Tools 

Display Modes 
Linear Mode

Posting Rules

You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off



All times are GMT +1. The time now is 05:03 PM.



