--
You received this message because you are subscribed to the Google Groups "sympy" group.
To post to this group, send email to sy...@googlegroups.com.
To unsubscribe from this group, send email to sympy+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
As a very small response to this question. My name is Cory Dominguez and I am a physics major at University of California at Santa Cruz. I am new to this group but I am interested in contributing. This quarter I am taking a class is Computational Physics where we have mainly looked at numerical analysis with c++ and for the second half of the quarter we get a crash course in Mathematica and do some symbolic analysis. I had heard of Sage through my various stumbles around the internet and I am a great fan of python. At least at my university, none of the professors I have talked to even know of the open source tools available today. They rely instead on software like Mathematica and Maple. I really wish that I had been aware of software like matplotlib, numpy, and sympy during my lower division courses. I think it could of increased my understanding tremendously. In my opinion if you make undergraduates aware of these tools and they are allowed to get used to them as they take their fundamental courses, then you lay a good foundation for this group in the future. I remember how stoked I was to get a TI-89 calculator, learning about sympy was like christmas.
~Luke
--
"Those who would give up essential liberty to purchase a little
temporary safety deserve neither liberty nor safety."
-- Benjamin Franklin, Historical Review of Pennsylvania, 1759
On Thu, May 12, 2011 at 9:14 AM, Matthew Rocklin <mroc...@gmail.com> wrote:
> Do we have a clear understanding of who our userbase is?
> Is SymPy being used for education? for research in academia? in industry? I
> imagine the answer is that "yes, it's being used in all of those places".
Yes, that's the answer.
> Does anyone know the extent to which it's used in these contexts? While
> designing I'd like to know what audience I should target.
It's hard to know or measure this, so I think the responses in this
thread give you some idea.
Speaking for myself and my own experience with people I know, I think
a large group is physics and engineering students (I am a physics
student myself), then physics or applied math faculty/research
(usually people who need symbolic things to generate or represent some
code in C/Fortran, be it linear algebra, or finite elements, ....). In
industry, for example EPD (http://www.enthought.com/products/epd.php)
includes sympy.
I think that large part of sympy users (and developers) are students.
For example from the top 20 contributors in the last month (git
shortlog -ns --after="1 month ago"), there are around 15 students and
5 non students.
Ondrej
There are two reasons I see Matlab used a lot in engineering
departments. The first is that it's used a lot in industry. The second
is that it has quite a bit of functionality that's not available in
open source programs. The collection of toolboxes means it can do a
whole lot more.
I'm still looking for an equivalent to the System Identification
toolbox. Parts of the functionality are in an Octave add-on, but it
doesn't look like anybody has bothered to implement ETFE (empirical
transfer-function estimate). Without that, I can't switch since I use
that function as part of some modal analysis code. Similarly, there
are a lot of toolboxes for control and the support for taking a model
and outputting embedded code to run on various hardware platforms.
That's a step up from just outputting C based upon a set of equations.
I would quite like to completely switch away from Maple and Matlab,
but I can't. I've been trying the easier one first, Maple. One problem
is I already have a lot of Maple code I've written to support my work
so I need to convert that over to Sympy before I could do real work. I
don't have that time, so I've been sticking with Maple for the most
part, while trying to learn Sympy better.
To switch from Matlab to Scipy, I'd have to recreate the Splines
Toolbox and parts of the System ID toolbox (my two main Matlab
toolboxes). The Splines Toolbox could be handled mostly by wrapping
the appropriate parts of the SLATEC library from Netlib, but the
System ID toolbox is much more work.
Cheers,
Tim.
--
Tim Lahey
PhD Candidate, Systems Design Engineering
University of Waterloo
http://about.me/tjlahey
Thanks for starting this discussion. My personal use of SymPy outside
of developing for it has been in the math courses I have taken. Last
semester, I used it a lot in my PDEs course, and occasionally in my
linear algebra course. In both cases, I used it to do difficult
computation, like Matrix multiplication or integration. Ironically,
one of the modules that I find myself using the most when I use SymPy
for school is the ODE module that I wrote. SymPy is generally
sufficient for what I want to do, and I only turn to Maple when I want
to do something more numeric, like plotting.
Two semesters ago, I had a mathematical modeling course. The course
involved a lot of group work, and the work was done mostly in Maple or
Matlab, with a presentation given in class. By the end of the class,
we got quite a few people to use Octave instead of Matlab, since quite
a few people (myself included) did not want to pay for Matlab,
especially since at least in my case it would be something that I
would never use again. We also went from only myself and another
person in the class even knowing what Beamer was to about a third to a
half of the class using it for the presentations (everyone else used
PowerPoint). So I encourage those of you who are students to
encourage your classmates to use open source software over the closed
source alternatives, including SymPy.
As for how to make SymPy more popular among undergraduates, I think
one of the best ways to do it would be to create a nice interface to
SymPy, like some kind of GUI. This would have to be something that
runs in Windows. Most people are Windows users who do not know Python
and aren't good enough or patient enough to install all the
prerequisites for SymPy (like Python itself if you are on Windows).
If there were a nice GUI that was friendly, like easy access to docs,
automatic sympification (so no one gets caught by 1/2 problems),
pretty printing, etc., then it would make SymPy more accessible to
more people. I say this because most people that I know who use Maple
are like this. Most of these people hate programming (or at least
think they do because they were introduced to it with C and have never
tried Python).
Finally, I just want to remind everyone of the saying "if you build
it, they will come." If you include behavior that would be useful to
*someone*, those people will end up using SymPy because the behavior
will be there.
Aaron Meurer
I very strongly believe that it is possible to write clear and
extensible code that is also fast. A special case of this is my also
strong belief that code written Python can be just as fast as code
written in C or any other language, at least for a CAS. In my
experience, the speed of your CAS functionality has less to do with
your underlying language and more to do with the speed of your
algorithms. For example, the tests I've done indicate that
risch_integrate() is just as fast as integrate() in Maple for
complicated integrals.
How do you think that the polys internals do not follow this? I think
that they are actually a good example of this. The code is (for the
most part) clean, and it is designed in a modular way that makes it
extensible (for example, you can easily plug in different ground types
of different low level representations). But on the other hand, it is
very fast. Part of this comes from the modularity of it, because it's
much easier to optimize the low level code, which is basically just
nested lists of integers.
Another example I can give you is the ODE module I wrote two summers
ago. I decided to make the module very extensible by separating the
solving methods from the solver, so if an ODE matches various methods,
it can be solved with any of them. This also ended up making the
solver faster, because we can make the default order of the methods
match the speed (for example, it will always try the faster
undetermined coefficients method before the slower but more general
variation of parameters method).
Aaron Meurer
>
> As to the original question, is there any data of where/how Sympy is
> used ?
> If not, can we start collecting such data ?
>
> Thanks Matthew, once again, to raise such an important question.
>
> -Sherjil Ozair
>
> On May 12, 8:14 pm, Matthew Rocklin <mrock...@gmail.com> wrote:
>> Do we have a clear understanding of who our userbase is?
>>
>> Is SymPy being used for education? for research in academia? in industry? I
>> imagine the answer is that "yes, it's being used in all of those places".
>> Does anyone know the extent to which it's used in these contexts? While
>> designing I'd like to know what audience I should target.
>>
>> Best,
>> -Matt
>
Have you seen any deficiencies in SymPy like your ETFE that would
prevent you from moving?
Aaron Meurer
>
> To switch from Matlab to Scipy, I'd have to recreate the Splines
> Toolbox and parts of the System ID toolbox (my two main Matlab
> toolboxes). The Splines Toolbox could be handled mostly by wrapping
> the appropriate parts of the SLATEC library from Netlib, but the
> System ID toolbox is much more work.
>
> Cheers,
>
> Tim.
>
> --
> Tim Lahey
> PhD Candidate, Systems Design Engineering
> University of Waterloo
> http://about.me/tjlahey
>
Off the top of my head, something like testeq from Maple would be
great. pdsolve, DETools, and PDETools would be nice as well. Oh, and
I'd like to have inert sum and integrals so they won't be evaluated.
Volume and Surface integrals over a general V and S go with this as
well. However, this last one isn't in a CAS that I use, I just want
it.
Other things I'm guessing are there, but I'm not sure how they're done.
- Extract the name of a function (e.g., f of f(x)). This is a building
block to differentiating with respect to a function f(x) so I can do
dL/df. Once I extract the name of a function, I build a symbol to
equate it to. Then differentiate with respect to it and switch back.
- Extract the variables of the function (e.g., x in f(x) or x,t in g(x,t)).
- Get the integrand, variable, and range of an integral, so I can
manipulate the integral. Also for a sum.
- Find if an integral, function, and sum is in an expression.
Thanks,
Just curious about this part --- do you have some idea how to do it?
For example, Sage uses a preparser to IPython, so if you write:
sage: 1/2
1/2
you get something like ours Integer(1)/Integer(2), i.e. in isympy:
>>> 1/2
0.5
>>> Integer(1)/Integer(2)
1/2
so is your idea to have this in isympy, or on what level should this
preparsing be done?
Ondrej
We do have classify_ode, the idea of which was stolen from DETools.
But I agree that having more of those would be nice. Any specific
ones that you would like to have? Maybe open issues for them. Having
a symbolic pde solver would be nice too, though it would be very
difficult to implement.
We do have inert sums and integrals. Just use Sum() and Integral().
Representing integrals over surfaces and volumes is not implemented,
though we do have line_integrate(). I think we would have to have
some kind of object to represent surfaces and volumes to do that well,
I think. Of course, if you can represent those as standard cartesian
integrals, then it is implemented.
>
> Other things I'm guessing are there, but I'm not sure how they're done.
>
> - Extract the name of a function (e.g., f of f(x)). This is a building
> block to differentiating with respect to a function f(x) so I can do
> dL/df. Once I extract the name of a function, I build a symbol to
> equate it to. Then differentiate with respect to it and switch back.
Well, of course you can do this. Just use .func, as in
In [294]: f(x).func
Out[294]: f
>
> - Extract the variables of the function (e.g., x in f(x) or x,t in g(x,t)).
Use .free_variables, or if you want "dummy" variables too (like
variables of integration in a definite integral), .atoms(Symbol):
In [2]: Integral(x*y, (x, 0, 1)).free_symbols
Out[2]: set(y)
In [3]: Integral(x*y, (x, 0, 1)).atoms(Symbol)
Out[3]: set(x, y)
This is actually a new feature since 0.6.7.
>
> - Get the integrand, variable, and range of an integral, so I can
> manipulate the integral. Also for a sum.
In [12]: a = Integral(f(x), (x, 0, 1))
In [13]: a.function
Out[13]: f(x)
In [14]: a.variables
Out[14]: [x]
In [15]: a.limits
Out[15]: (Tuple(x, 0, 1),)
They are exactly the same for Sum. See help(integral).
>
> - Find if an integral, function, and sum is in an expression.
I don't understand what this means.
This is all from master, but much of it is the same in the last
release (but you should use master anyway :), and also we are going to
release soon).
Aaron Meurer
>
> Thanks,
>
> Tim.
>
> --
> Tim Lahey
> PhD Candidate, Systems Design Engineering
> University of Waterloo
> http://about.me/tjlahey
>
As for how to do it, can sympify be extended to parse any python
expression (like can we make S("for i in range(10): print i") work)?
Aaron Meurer
I think we should do it as an option, yes. And we can start using it,
as an option and see how it goes.
> As for how to do it, can sympify be extended to parse any python
> expression (like can we make S("for i in range(10): print i") work)?
Yes, I think it can, as long as AST trees are used (as they are
already in sympify). The only problem with that is that it will not
work on the google app engine (they don't provide the "parser" module
there), but apart from that, it should work.
Ondrej
Aaron Meurer
On Thu, May 12, 2011 at 6:14 PM, Aaron Meurer <asme...@gmail.com> wrote:
>
> We do have classify_ode, the idea of which was stolen from DETools.
> But I agree that having more of those would be nice. Any specific
> ones that you would like to have? Maybe open issues for them. Having
> a symbolic pde solver would be nice too, though it would be very
> difficult to implement.
I mostly work with PDEs so PDETools probably would be more useful to me.
>
> We do have inert sums and integrals. Just use Sum() and Integral().
> Representing integrals over surfaces and volumes is not implemented,
> though we do have line_integrate(). I think we would have to have
> some kind of object to represent surfaces and volumes to do that well,
> I think. Of course, if you can represent those as standard cartesian
> integrals, then it is implemented.
Thanks. For the surface and volume integrals, I'd like to work with dS
and dV in general, without having to specify the exact surface shape
and volume. Basically, this would likely be inert surface and volume
integrals.
>
> Well, of course you can do this. Just use .func, as in
>
> In [294]: f(x).func
> Out[294]: f
That's handy.
>
>>
>> - Extract the variables of the function (e.g., x in f(x) or x,t in g(x,t)).
>
> Use .free_variables, or if you want "dummy" variables too (like
> variables of integration in a definite integral), .atoms(Symbol):
>
> In [2]: Integral(x*y, (x, 0, 1)).free_symbols
> Out[2]: set(y)
>
> In [3]: Integral(x*y, (x, 0, 1)).atoms(Symbol)
> Out[3]: set(x, y)
>
> This is actually a new feature since 0.6.7.
>
I'll have to look at this to see which I'd need.
>>
>> - Get the integrand, variable, and range of an integral, so I can
>> manipulate the integral. Also for a sum.
>
> In [12]: a = Integral(f(x), (x, 0, 1))
>
> In [13]: a.function
> Out[13]: f(x)
>
> In [14]: a.variables
> Out[14]: [x]
>
> In [15]: a.limits
> Out[15]: (Tuple(x, 0, 1),)
>
> They are exactly the same for Sum. See help(integral).
>
That should work fine.
>>
>> - Find if an integral, function, and sum is in an expression.
>
> I don't understand what this means.
>
If I have an expression like
1/2*Integral(f(x),x) + g(x) +C
I'd like to know if there is an Integral in the expression, if there's
a Sum, or if f(x), g(x), or v(x) are in it and which term they're in,
so I can work with the term and then replace it as I apply operations
to it.
Here is the file (I think it works for 2.5+):
https://github.com/sympy/sympy/blob/master/sympy/parsing/ast_parser.py
And we have a python 2.4 compatibility version here:
https://github.com/sympy/sympy/blob/master/sympy/parsing/ast_parser_python24.py
Ondrej
99% of the time you want free_symbols. It's actually pretty uncommon
that you want to do something with a bound variable in an expression.
That's why we made free_symbols a property of Expr and left all of
them to .atoms().
>
>>>
>>> - Get the integrand, variable, and range of an integral, so I can
>>> manipulate the integral. Also for a sum.
>>
>> In [12]: a = Integral(f(x), (x, 0, 1))
>>
>> In [13]: a.function
>> Out[13]: f(x)
>>
>> In [14]: a.variables
>> Out[14]: [x]
>>
>> In [15]: a.limits
>> Out[15]: (Tuple(x, 0, 1),)
>>
>> They are exactly the same for Sum. See help(integral).
>>
>
> That should work fine.
>
>
>>>
>>> - Find if an integral, function, and sum is in an expression.
>>
>> I don't understand what this means.
>>
>
> If I have an expression like
>
> 1/2*Integral(f(x),x) + g(x) +C
>
> I'd like to know if there is an Integral in the expression, if there's
> a Sum, or if f(x), g(x), or v(x) are in it and which term they're in,
> so I can work with the term and then replace it as I apply operations
> to it.
.atoms() can also help with this:
In [21]: a = Integral(f(x), x)/2 + g(x) + C
In [22]: a.atoms(Integral)
Out[22]:
⎛⌠ ⎞
set⎜⎮ f(x) dx⎟
⎝⌡ ⎠
we also have new methods .find() and .replace() that can be very helpful:
In [23]: a.find(Integral)
Out[23]:
⎛⌠ ⎞
set⎜⎮ f(x) dx⎟
⎝⌡ ⎠
In [25]: a.replace(f, h)
Out[25]:
⌠
⎮ h(x) dx
⌡
C + ───────── + g(x)
2
replace() in particular is very powerful. See the docstring for all
the kinds of things you can do with it.
Aaron Meurer
Aaron Meurer
That's really the only thing that prevents us from using a standard
Python shell. I wish Python did the right thing and returned
fractions.Fraction(1, 2) for 1/2... Since that's not the case, the next
easiest option is to wrap all integer literals with Integer() - which
shouldn't be hard in ipython, I hope.
Oh, yeah, that would do it. We should be able to do that with a
simple regex replacement, no advanced parsing like ast needed.
We could also wrap float literals with Real(" "), so that you
automatically get lossless arbitrary precision floats.
Actually, now that I think about it, it isn't so simple as regex,
because you don't want to do it with literals that are in strings. So
probably the best way is to use an actual parser.
Aaron Meurer
You could use the tokenize module. I'm not sure if that's available on
the App Engine, but it probably is.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
-- Umberto Eco
It is, this:
import tokenize
tokenize.__file__
produces:
'/base/python_runtime/python_dist/lib/python2.5/tokenize.py'
Ondrej
And by the way, even if you're not from a developing country, you can
save a lot of money by using open source software (assuming it is of
comparable quality).
Aaron Meurer
When I started studying a few years back, the only OSS we used was
Octave. Nowadays, students are taught SAGE among others. Even if student
licences are affordable, I don't think closed source programs are
appropriate in academia and teaching.
> I think this sort of evangelism is one way of getting the sympy
> userbase to grow.
>
I've been name-dropping SymPy at every opportunity lately. :)
Jeremias
That's pretty cool. Does he just use the GA module, or the core sympy too?
Aaron Meurer
Do not forget PythonCAD ..
http://sourceforge.net/projects/pythoncad/
we are using sympy for all geometrical operation ..
last yeard I made an youtube video that show how to render sympy data to
PythonCAD and how to get sympy data from PythonCAD
http://www.youtube.com/watch?v=FnxRDj4qyc4 (Watch in hd)
I will have a talk at europython2011 in Florance and of course I will
talk about sympy:
http://ep2011.europython.eu/conference/talks/developing-a-cad-application-as-hobby
Regards,
Matteo
Cool. Let us know if they post a video or at least the slides.
Aaron Meurer
On Sun, May 15, 2011 at 11:40 PM, Matteo BoscoloCool. Let us know if they post a video or at least the slides.
<matteo....@boscolini.eu> wrote:
> hi all,
>
> Do not forget PythonCAD ..
> http://sourceforge.net/projects/pythoncad/
> we are using sympy for all geometrical operation ..
>
> last yeard I made an youtube video that show how to render sympy data to
> PythonCAD and how to get sympy data from PythonCAD
> http://www.youtube.com/watch?v=FnxRDj4qyc4 (Watch in hd)
>
> I will have a talk at europython2011 in Florance and of course I will talk
> about sympy:
> http://ep2011.europython.eu/conference/talks/developing-a-cad-application-as-hobby
This seems to be true. If you just search for "sympy" on GitHub or on
Google Code Search (http://www.google.com/codesearch), you can find
all kinds of projects that use SymPy (in Google Code search, add
"-package:sympy" to remove results from SymPy).
Here are some of the ones I just found:
- https://github.com/chopin/natural-k I can't even tell what this is.
- http://code.google.com/p/rg-graph/ "Feynmann graphs calculations
using R' operation"
- http://code.google.com/p/esla/ "Educational Software for Linear Algebra"
- http://www.google.com/codesearch/p?hl=en#NG_4V0w3FH0/euler/zz.py&q=sympy%20-package:sympy&sa=N&cd=27&ct=rc
Just some guy using SymPy's Rational to solve a Project Euler problem
:)
- http://code.google.com/p/onda/ "Models steady inviscid water waves
with vorticity"
- http://code.google.com/p/ahkab/ "An electronic circuit simulator
written in Python"
And it goes on (I got through about five pages of Google Code Search
for "sympy -project:sympy").
Many of these just use simple functionality, like solve(). Others are
build on top of SymPy. I skipped any projects that I felt the
community already knew about.
Also, a lot of projects use SymPy in some way or another for their
test suite or examples. I didn't include any of those here.
By the way, apparently not everyone has as good of code quality
standards as we do. Quite a few of these have "import *" and "x =
sympy.var('x')" and other things that made me cringe when I saw them.
Clearly, coding for SymPy makes you a better Python programmer.
Aaron Meurer
I don't know if there's an easy way to do that with GitHub (other than
cloning and "git grep sympy").
Aaron Meurer
I am definitely interested in perturbation theory in QM and available
to mentor if you want.
Do you have some particular problem that you want to solve, or are you
looking for a general opportunity to contribute?
Let us know your ideas.
Ondrej
Greetings!
It probably is another thread, but I am also willing to mentor you on
this. It would be fantastic to have PT implemented in a general
manner in sympy. I recommend forking sympy on github and starting to
dig into the code in sympy.physics.quantum. We will have lots of
people working on this code over the summer, so it is a perfect time
to get started. Let us know if you have any questions.
Cheers,
Brian
> Caleb Miles
>
> --
> You received this message because you are subscribed to the Google Groups "sympy" group.
> To post to this group, send email to sy...@googlegroups.com.
> To unsubscribe from this group, send email to sympy+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
>
>
--
Brian E. Granger
Cal Poly State University, San Luis Obispo
bgra...@calpoly.edu and elli...@gmail.com