Cool. As I mentioned earlier I'm doing parametric density estimation.
A typical example is the following:
var('mu')
var('sigma_squared')
fNormal = exp(-(x-mu)^2 / (2*sigma_squared)) / (sqrt(sigma_squared*2*pi))
We introduce data D={x1,..,xn} and estimate the parameters mu and
sigma_squared from it using the maximum likelihood method. D is
actually undefined at this point, I just want this to work for any
list of numeric values D.
L = prod(fNormal(D[i], 0, 1) for i in range(0,len(D)))
Optionally, next I'd take the log to make taking the derivative by
hand simpler although it might be unnecessary if using SAGE to do the
derivative.
logL = log(L)
Then I'd compute partial derivatives w.r.t. mu and sigma_squared and
set them both equal to 0 to find the maximum values for both mu and
sigma_squared. I'm not sure of the syntax for this, so I won't try.
Does this make sense?
Brian
On 5/8/07, William Stein <[EMAIL PROTECTED]> wrote:
>
> On 5/8/07, Brian Harris <[EMAIL PROTECTED]> wrote:
> >
> > Do you have plans to ever support this?
> >
> > sum(x^i for i in range(1,n)).diff(x)
> >
>
> Do you mean working symbolic with formal sums? If so, yes, we definitely do
> plan to support this. Please feel free to send a list of example type
> problems
> that illustrate the functionality you would like to have.
>
> William
>
> >
> > On May 7, 10:09 am, William Stein <[EMAIL PROTECTED]> wrote:
> > > On Monday 07 May 2007 10:11 am, Brian Harris wrote:
> > >
> > > > Thanks for the scatter plot pointers. For question 2, imagine
> > > > something like:
> > > > f(x) = 5 *SUM(1<i<10, x^i)
> > > > Probably not standardsumnotation, but I hope it's clear. Now I want
> > > > to use SAGE to compute f'(x).
> > >
> > > This doesn't help you today, but in SAGE-2.5 (which will be much
> > > more aimed at Calculus use), which will be released this week,
> > > you'll be able to do this:
> > >
> > > sage: f = 5*sum(x^i for i in range(1,10)); f
> > > 5*(x^9 + x^8 + x^7 + x^6 + x^5 + x^4 + x^3 + x^2 + x)
> > > sage: f.derivative()
> > > 5*(9*x^8 + 8*x^7 + 7*x^6 + 6*x^5 + 5*x^4 + 4*x^3 + 3*x^2 + 2*x + 1)
> > >
> > > Actually, the above would also work in sage-2.4, but would
> > > have slightly different output.
> > >
> > > Maybe you could send some more complicated examples along these
> > > lines that you're interested in. They are useful to us, since
> > > we can add them as examples in the reference manual and/or
> > > tutorial.
> > >
> > > william
> > >
> > >
> > >
> > > > On May 6, 9:04 pm, Marshall Hampton <[EMAIL PROTECTED]> wrote:
> > > > > I'm not completely sure what you mean for your question 2 - can you
> > > > > give an example?
> > >
> > > > > For your first question, if you have a tuple of 2D data called 'data',
> > > > > then in the notebook you can do
> > >
> > > > > show(point(data))
> > >
> > > > > and you get a scatterplot. In the reference manual under 2D-plotting
> > > > > there is more information on graphics primitives, such as adding
> > > > > colors (http://modular.math.washington.edu/sage/doc/html/ref/module-
> > > > > sage.plot.plot.html).
> > >
> > > > > There is also a list_plot command, so you can do
> > >
> > > > > show(list_plot(data))
> > >
> > > > > to a list of data points; this has a 'plotjoined' option.
> > >
> > > > > Hopefully that helps. I am not a SAGE guru, so there may be other
> > > > > nice options as well.
> > >
> > > > > -M.Hampton
> > >
> > > > > On May 6, 2:49 pm, Brian <[EMAIL PROTECTED]> wrote:
> > > > > > 1. How do you do scatter plots in SAGE, without using an interface
> > > > > > to
> > > > > > underlying commercial software like MATLAB?
> > >
> > > > > > 2. Can maxima or another tool compute [partial] derivatives or
> > > > > > integrals containing arithmetic sums or products?
> > >
> > > --
> > > William Stein
> > > Associate Professor of Mathematics
> > > University of Washington
> >
> >
> > >
> >
>
>
> --
> William Stein
> Associate Professor of Mathematics
> University of Washington
> http://www.williamstein.org
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sage-support
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---