Steve D
Reputation
989
Top tag
Next privilege 1,000 Rep.
 Jan 22 awarded Yearling Sep 5 awarded Good Question Mar 14 accepted Drawing an arrow pointing at the “Enable Dynamics” button Mar 14 accepted Self-loops in Graph may not display correctly or export correctly to PDF (due to BezierCurve problem) Mar 14 accepted Iterating over a list, in a functional way Mar 14 accepted Reflecting lines in ellipses: speed up the code? Mar 14 comment Reflecting lines in ellipses: speed up the code? Wow, that is a serious speed improvement! I'm going to accept this answer because it works in the generality I wanted, but I also would like to point out that I've noticed my NestWhileList was actually adding to the slow performance of my code. And I noticed that because you used NestList instead. Originally I had been stopping the line when it passed a certain length threshold, but it does seem to slow things up. Anyway, thanks again! Mar 13 revised Reflecting lines in ellipses: speed up the code? added 799 characters in body Mar 13 comment Reflecting lines in ellipses: speed up the code? @Jens: fair enough, though the first sentence mentions "bouncing off". :) The main point though is that the configuration of ellipses is random (but fixed), and the start point of the line is determined dynamically (which is why I need the generality). Mar 13 comment Reflecting lines in ellipses: speed up the code? I think the example I gave in the question makes it somewhat unclear. But I have several ellipses that need to be reflected off of (potentially) . Mar 12 answered Reflecting lines in ellipses: speed up the code? Mar 12 comment Reflecting lines in ellipses: speed up the code? @Kuba: I looked at your code, and it definitely helps. But it is different than what I'm trying to do: I'd like a list of points (up to some length) visited by the bouncing particle, and I'd also like to do the computations for when the particle hits the boundary, not when it gets sufficiently close. Mar 12 asked Reflecting lines in ellipses: speed up the code? Feb 28 comment Iterating over a list, in a functional way Thanks for the answer. I really like both your solutions (didn't know about Symbol assignment). I think I danced around your first idea, but I had it in my head to use a Reap and Sow, and so couldn't really get it to work "cleanly". Feb 28 answered Iterating over a list, in a functional way Feb 28 asked Iterating over a list, in a functional way Feb 18 awarded Famous Question Feb 9 awarded Nice Question Jan 22 awarded Yearling Jan 12 awarded Civic Duty