Le lundi 21 mars 2011 à 11:08 -0700, Matthew a écrit :
> Hello again SymPy Community,
> 
> I'm leaning now towards a GSoC project in Stats/Uncertainty. I like
> the work done in the uncertainties package 
> http://packages.python.org/uncertainties/index.html
> and am interested in moving the ideas over to the symbolic world. In a
> nutshell the existing package gives you the ability to work with
> variables that are enhanced with a single parameter uncertainty (i.e.
> standard deviation).
> Basic example copied from the link above:
> >>> x = ufloat((1, 0.1))  # x = 1+/-0.1
> >>> print 2*x
> 2.0+/-0.2
> >>> sin(2*x)  # In a Python shell, "print" is optional
> 0.90929742682568171+/-0.083229367309428481
> 
> To me the symbolic equivalent of this is to work with probability
> distributions on continuous random variables. Equivalent of the simple
> example above:
> >>> A = Normal(mean=0, std=1)
> >>> A.pdf(x)
> 2**(1/2)*exp(-y**2/2)/(2*pi**(1/2))
> >>> sin(A).pdf(x)
> 2**(1/2)*exp(-asin(x)**2/2)/(2*pi**(1/2)*(1 - x**2)**(1/2))
> 
uncertainties is indeed an interesting package - even more so since it
switched to the BSD license. I think there are 2 possible symbolic
equivalents: one is random variables, the other is to use interval
arithmetic. While the latter is less physically motivated, it allows to
compute firm bounds on the value of an expression and is important for
some applications. So it would be nice if you could implement it as well
- while the algorithm required are different, the problems to solve in
order to integrate it with existing functionalities are probably the
same.

> - Is this an appropriate direction to take a GSoC project?
> - Is this a useful contribution to SymPy?

Yes to both.

> - What are the relevant parts of SymPy that would need to be enhanced
> (right now I see sympy.statistics.distributions)?

A major design problem is how to get sin(A) to be a random variable.
Presently, sin(A) can only be an instance of the class sin, which
subclasses Expr and is therefore meant to represent an ordinary
expression as encountered in elementary calculus. I think this is a big
limitation of our current design and any idea to overcome it is
welcome.  

> - Is there a better way to approach this problem?

* You shouldn't limit yourself to continuous random variables.
Poisson-distributed integer variables are almost as important as
Gaussian variables. 
* You need to make sure that the random variables actually behave like
variables, so that with x, y = Normal(0, 1), x - x == 0, but x-y "=="
Normal(0, sqrt(2))

> - What are some interesting directions people see this going?
> - What are some fun examples where this would be useful?
> 
This has the potential of being very useful to build complex statistical
models in a much more elegant/Pythonic/physically meaningful way than
usually required in statistical packages. For instance, consider the
following pseudo-code representing the full treatment of some
experiment:

G = Lambda(...)
V_nominal, I_data, T_0 = gather_experimental_data()

input_jitter = Indexed(Normal(0, 0.1), n)
offset = Normal(0, 0.3)
V_actual = Indexed(V_nominal[n] + offset + input_jitter[n], n)
I_model = Indexed(G(V_actual[n], a, b, T) + Normal(0, 0.2), n)

# not sure how to express this...
posterior = P(a, b, assuming=Eq(I_model, I_data) & Eq(T, T_0))

density_plot(posterior, ...)

> Feedback strongly appreciated
> -Matt
> 
> On Mar 20, 7:22 am, Vinzent Steinberg
> <vinzent.steinb...@googlemail.com> wrote:
> > Hi Matt,
> >
> > On Mar 20, 5:32 am, Matthew <mrock...@gmail.com> wrote:
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > > Hello SymPy Community,
> >
> > > I'm looking for an interesting project to work on during some free
> > > time I have this Summer and I'm wondering if we're a good fit. Here is
> > > a bit about me:
> >
> > > I'm a PhD student studying Computer Science at the University of
> > > Chicago with a background in Physics and Mathematics. I'm a heavy user
> > > of Python and its open source developments but have never contributed
> > > more than bug reports. I code a fair amount but it's all research-
> > > grade and not suitable for public use. My goal for this project would
> > > be to focus on crafting code and a clear end-user experience rather
> > > than focusing on a scientific research question. I would also like to
> > > engage and join the Python community a bit; I've always been "just an
> > > end-user."
> >
> > > I'm searching for an appropriate project for a summer. I'm looking
> > > over the provided list and at the existing functionality in SymPy. I
> > > have a few ideas but I'd appreciate suggestions.
> >
> > > My interests include the following: Scientific Computing (generally),
> > > Numerical Linear Algebra, Physics (generally), Geometry/Relativity,
> > > Dynamical Systems, Statistics (generally), Uncertainty/Sensitivity,
> > > Optimization, Education.
> >
> > > Thoughts:
> > > My ideal project would be to develop a code-base for General
> > > Relativity. However I see that someone else already has some code that
> > > they're thinking of contributing. Would it be best to wait on this?
> > > Are there supporting aspects of this topic that I could help with
> > > (reworking tensors for example). Relevant thread here:http://goo.gl/zRmDs
> > > I could probably improve sympy Matrices. I'm curious, how many people
> > > use the existing functionality? What are common applications for
> > > symbolic matrices? If I go this route I want to make sure that there
> > > are some good motivating use cases. I wonder if something akin to
> > > numpy's ndarray would be appropriate to merge both this and the above
> > > topic. A lot of functionality is shared and currently (I think)
> > > codeveloped in both branches.
> >
> > The matrices module was written by a GSoC student some time ago. Most
> > of the basic stuff is implemented, but the interface could be
> > improved. If you want to choose this as a project, I guess you'll have
> > to find some more advanced functionality to implement.
> >
> > Adding pure python numpy-like ndarray support to sympy would be nice.
> > This probably requires a lot of work.
> >
> > > Brian Granger's quantum physics projects seem appropriate.
> > > I'm also tangentially interested in code generation. Any suggestions
> > > on this front?
> >
> > Øyvind worked on this during last GSoC, so he may have some
> > suggestions.
> >
> > > Anyone have thoughts for applications in education? Something like
> > > sympy might aid significantly in learning calculus for example.
> >
> > I think sympy has a lot of potential in education. If you want to
> > know, you can easily look up the implementation (using ?? or the
> > source() command). Do you have any thoughts? To me, this is a not-so-
> > obvious project to do.
> >
> > > Can anyone think of projects that would be appropriate for someone of
> > > my background that haven't yet been added to the ideas list?
> >
> > Any project about statistics or uncertainity.
> >
> > My suggestion is to choose the project that interests you the most
> > (given that it is a project that is likely to be accepted).
> >
> > Vinzent
> 


-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to sympy@googlegroups.com.
To unsubscribe from this group, send email to 
sympy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to