Recent content by rem1618
-
R
Why is the complexity of this code O(n^2)?
You're totally right. I don't know what my mind was thinking haha. And yes, I'm aware of the precision issue with floats. I was mostly just experimenting with the runtime, because I've only recently realized the iterative algorithm is way faster than the recursive one for fibonacci numbers.- rem1618
- Post #13
- Forum: Programming and Computer Science
-
R
Why is the complexity of this code O(n^2)?
Ah right. I had thought 100000 was small because I've read that Python can represent numbers up to around 10^308, but that was for floats. When I changed fib(n) to calculate with floats instead the runtime did indeed turn linear.- rem1618
- Post #9
- Forum: Programming and Computer Science
-
R
Why is the complexity of this code O(n^2)?
They're not huge numbers, I ran it in range(0, 100000, 10000). This was the plot I got The rest of my code is just for clocking runtime and plotting, so there should be nothing special there, but here it is. import time from pylab import * def fib(n): ...f0, f1, = 0, 1 ...for i in...- rem1618
- Post #6
- Forum: Programming and Computer Science
-
R
Why is the complexity of this code O(n^2)?
So it's the adding of big numbers that's contributing to the overall complexity? That makes sense, but how do I quantify it? So far my understanding of determining complexity is merely by counting the number of operations.- rem1618
- Post #3
- Forum: Programming and Computer Science
-
R
Why is the complexity of this code O(n^2)?
def fib(n): f0, f1, = 0, 1 for i in range(n - 1): f0, f1 = f1, f0 + f1 return f1 It looks like it'd be linear, given there's only one loop, but when I plotted n against runtime, the relationship was quadratic, why?- rem1618
- Thread
- Code Complexity
- Replies: 12
- Forum: Programming and Computer Science
-
R
Interested in optimization for scientific computing, where to start?
I've just started programming with Python this summer, and I'm taking a course in computational physics this semester. I've been really enjoying it and programming in general, but I don't have much knowledge in computer science save for intro stuff (string/list methods, functions/classes...- rem1618
- Thread
- Computing Optimization Scientific Scientific computing
- Replies: 1
- Forum: Programming and Computer Science
-
R
Graduate Reason for separate concepts of gravitational vs inertial mass
My mechanics prof today said when setting GMm/r2 = ma, the canceling of the small m is actually a bit nuanced because you have to assume the gravitational mass is equal to the inertial mass (though it's supported by experiments). I'm so used to seeing mass as just mass so I'm having a bit of... -
R
Nuclear Engineering (or electrical) and Physics
You'll want to study physics instead of engineering for sure then. EE does not go into the nuclear domain at all I believe, but they might have an energy domain. There is the nuclear engineering program, but my impression of them is that, beyond the fundamentals, they deal more with ME stuff...- rem1618
- Post #10
- Forum: STEM Academic Advising
-
R
Nuclear Engineering (or electrical) and Physics
Isaac Newton would've been Isaac Newton no matter what he studied. Famous/genius academics didn't get there by asking how they can become famous or influential. They just did it because they had it in them. If there's an easy answer to "what should I study in order to become a great scientist"...- rem1618
- Post #7
- Forum: STEM Academic Advising
-
R
Undergrad An intuitive meaning to the phase constant k?
k being the one from the harmonic wave ψ(x,t) = Asin(kx - ωt) where k = 2π/λ The way I see it right now, k is just defined this way to get the period of sin(x) to be λ by using sin(kx), so I wondered if there's something more to it. (Though I know it can be used as an vector to declare the...- rem1618
- Thread
- Constant Phase
- Replies: 4
- Forum: Quantum Physics
-
R
Post Your Summer/Fall 2013 Class Schedules
Classical Mechanics I Practical Physics I Quantum Mechanics II Ordinary Differential Equations History/Philosophy: Science and Values I'm also volunteering in a superconductivity lab, and thinking about a part time job...not sure if I'd kill myself if I do that.- rem1618
- Post #16
- Forum: STEM Academic Advising
-
R
Physicists/Grad students, how much computer science do you use?
Pretty much everyone in the physical sciences these days has to know programming. C++, fortran, matlab, and what have you. But what about the more core computer science concepts, like algorithms, data structure, numerical analysis, operating systems, etc.? How important are these to those...- rem1618
- Thread
- Computer Computer science Science students
- Replies: 2
- Forum: STEM Academic Advising
-
R
Deriving <v> from <x> - Introductory Quantum Mechanics
That helped a lot. Thank you :]- rem1618
- Post #3
- Forum: Advanced Physics Homework Help
-
R
Deriving <v> from <x> - Introductory Quantum Mechanics
(First post, hi everyone.) I'm reading Griffith's textbook on intro to quantum mech right now. After establishing the following equation $$\left\langle f(x) \right\rangle = \int f(x)p(x)\,dx$$ And thus $$\left\langle x \right\rangle = \int x|\Psi|^2\,dx$$ He goes on to find...- rem1618
- Thread
- deriving Introductory Mechanics Quantum Quantum mechanics
- Replies: 2
- Forum: Advanced Physics Homework Help