On Jul 5, 9:54 am, Jason Grout <[email protected]> wrote:
> On 7/5/11 8:49 AM, kcrisman wrote:
>
>
>
>
>
>
>
> >>>>> Harder example:
>
> >>>>> @interact
> >>>>> def _(f=x^2, a=(3,[2..10]), c = (2,6)):
> >>>>>         g(x)=f+a
> >>>>>         show(plot(g,(x,-c,c)))
>
> >>>> This is harder since when the interact is run, ``a`` is a single number
> >>>> (by the autoguessing), but when the function itself is run, ``a`` is a
> >>>> tuple.  Same problem for c.  Maybe we should actually change the
> >>>> function that is returned to substitute in the default arguments,
> >>>> instead of just returning the function.  That would be doable and
> >>>> reasonable, I think.
>
> >> There's hacks that you could do (call the autoguessing function
> >> yourself, then call the default method on each control returned)...how
> >> desperate are you?
>
> > Oh, it would be really nice.  My use case would be to get at least
> > simple interacts to be extractable automatically using sws2tex and
> > then evaluated using SageTeX - but then I would need to modify the
> > code in a cell to get something like what we are discussing.
>
> > Unfortunately, it will still be hackish - since I'll have to guess on
> > the fly whether the output includes a plot and do \begin/end{sageplot}
> > accordingly.  I don't know whether I'll be able to do that well enough
> > to make it worthwhile.
>
> > If only SageTeX knew automatically that a command returned a plot and
> > turned a \sage*{} thing into a plot in those cases ... :)
>
> If SageTeX uses the single-cell server, it will know that it got a plot
> since there will be a plotting message back to it.  Hopefully these
> messages are the future of the notebook, so it may be just a matter of
> time.  Of course, I'm sure there's some way of knowing now, I'm just not
> sure what it is.
>
> Part of the problem is that we never built interacts to run from the
> command line, so SageTeX is going to have some problems running those
> commands from the command line.

Which is why I wanted to just extract the function itself (after all,
the decorator does still work, as in the example of f above), and then
ask SageTeX to just run the function with defaults.  I'm not looking
to have the interact itself, just the default output of the interact
function (no widgets, for instance).

- kcrisman

-- 
To post to this group, send an email to [email protected]
To unsubscribe from this group, send an email to 
[email protected]
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to