On 5/9/07, Justin C. Walker <[EMAIL PROTECTED]> wrote:
>
>
>
> On May 9, 2007, at 10:51 AM, Timothy Clemans wrote:
>
> > The calculus package fails on all of the following general forms. I
> > used sagenb.com and a clean worksheet.
>
> I'm not sure these are failures, per se.  This may be a in issue with
> the Principal of Least Surprise :-}


This is definitely the case here. In every one of your examples, Timothy,
the module is doing what it's supposed to. Sorry, the documentation is kind
of lacking in the tutorial. I'm working on it right now. For now I'd suggest
looking at the reference manual and especially the docstring for
sage.calculus.calculus.

First of all, many of your expressions contain more than one
SymbolicVariable. For example, the first thing you tried has a variable c
and a variable x. diff() won't work unless you tell it which variable you
want to differentiate with respect to.

Now,  by default, the symbols f, g, and most other single-character symbols
are instances of SymbolicVariable. They are not callable. What you really
are trying to do is make a formal function f, and a formal function g, and
differentiate those. So to do that, you need to use the commands:

sage: f = function('f')
sage: g = function('g')
sage: foo = diff(f(x) + g(x))
diff(g(x), x, 1) + diff(f(x), x, 1)

and then you can do something like
sage: foo(f=sin, g=x^3)
cos(x) + 3*x^2

>
> > {{{
> > diff(c)
> > ///
> > 1
> > }}}
>
> 'c' is a symbolic variable (new with 2.5), so differentiating it as
> above (implicitly, w.r.to 'c') gives '1'.
>
> > {{{
> > diff(c*f(x))
> > ///
>
> I think this fails because you have an expression using two variables
> (c, x), but don't specify whether to compute "d/dx" or "d/dc".  For
> example,


Exactly.

{{{
> diff(x*y)
> }}}
>
> fails, while
>
> {{{
> diff(x*y,x)
> ///
> y
> }}}
>
> which is stated in the traceback:
> > line 1062, in derivative
> >     "expression containing more than one variable"
> > ValueError: must supply an explicit variable for an expression
> > containing more than one variable
> > }}}
>
> I'm not sure what is going on in the rest of your examples, since f
> and g aren't defined (for us)


They are, but not as formal functions. They're defined as SymbolicVariables.

.  If I do define them, the other
> operations in your message do seem to work (as far as I've tried them).
>
> A last example:
>
> {{{
> diff (x^n,x)
> ///
> n*x^(n - 1)
> }}}
>
>
> Justin
>
> --
> Justin C. Walker, Curmudgeon-At-Large
> Director
> Institute for the Enhancement of the Director's Income
> --------
> "Weaseling out of things is what separates us from the animals.
>   Well, except the weasel."
>        - Homer J Simpson
> --------
>
>
>
> >
>


-- 
Bobby Moretti
[EMAIL PROTECTED]

--~--~---------~--~----~------------~-------~--~----~
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/
-~----------~----~----~----~------~----~------~--~---

Reply via email to