These are chat archives for sympy/sympy/optics

18th
Jun 2014
Indranil Sinharoy
@indranilsinharoy
Jun 18 2014 03:31

Hi Sudhanshu,

First of all, kudos to you for your initiative on implementing the optics module. I am actually very new to SymPy. When I saw the "Optics" module in SymPy I immediately wanted to see what's there, as I happen to work a little bit with optics and imaging. While I was looking at the code, some questions/ thoughts came up, and I thought that I should probably let you know. Please note that I don't mean to intrude here in any way. So if you think my questions are relevant, and you have some time, please consider responding, else it is just fine.

  1. Is there any particular reason why you chose to implement a transverse wave class in the optics module? I mean, optical waves are just one example of transverse wave model. For example the displacement in a taut
    string can be represented using the same model. And there are many other examples too. My point is that a general "wave class" could be written that is a super-class of all the different cases. This will probably prevent code duplication if in future someone wants to model the propagation of wave in a stretched string in the physics module. Also, you may probably consider renaming the (sub-class) as OpticalWave ... just a thought!

  2. As I understand, you are in favor of this one yourself. I strongly agree that the "gaussoptics" module should be moved inside the optics module. Since you are actively working on the optics module this is probably the right time to do it ... of course if other people are in agreement. Good work!

Sudhanshu Mishra
@debugger22
Jun 18 2014 12:16

Hi Indranil

Thanks for the nice feedback! Regarding the first point, initially I thought of creating a wave class but the question was where it should stay. IMO optics module was not a right place for that. One more thing.. if I would have created that class, I should have also considered the case of longitudinal wave. Your proposition will indeed reduce the code duplication and I think we should consider it. @flacjacket This is necessary because once we create a public API it'll become difficult to make further changes.

You may want to take a look at my proposal for optics. Your comments are most welcome.

For the second point I'll create a pull request to move it.

Thanks!

Indranil Sinharoy
@indranilsinharoy
Jun 18 2014 17:16

@debugger22 "initially I thought of creating a wave class but the question was where it should stay. IMO optics module was not a right place for that."

Good to know that we are on the same page. I think a "wave" module should be in physics at the same level that others like "sho.py" are placed.

"if I would have created that class, I should have also considered the case of longitudinal wave."

yes, absolutely.

"This is necessary because once we create a public API it'll become difficult to make further changes."

I am glad that you mentioned it. I had the exact same concern in my mind. I think once the blue print is in place, you (or someone else) can extend the work you are doing now. For example, allowing the wave equation to be defined in 3 spatial dimensions plus time, etc.

I have read your proposal in parts, I will read it more thoroughly in the coming days.

Thanks.

Sean Vig
@flacjacket
Jun 18 2014 20:53
With a more general class for treating propagating waves, you might start to run into components of the mechanics module (which I'll admit I don't have a good understanding of). I'm not sure how much the notions treated in the optics and mechanics module can be stitched together.
Though it is definitely something to consider
Though I don't think there'd be too much API breaking if that is done later
Sudhanshu Mishra
@debugger22
Jun 18 2014 21:00
Ok then I'll continue with the current implementation.
@indranilsinharoy If you'd like to help, you're welcome.
Sudhanshu Mishra
@debugger22
Jun 18 2014 21:07
@flacjacket I've updated sympy/sympy#7580
Please take a look if you are free