On Thu, May 12, 2011 at 4:52 PM, Tim Lahey <tim.la...@gmail.com> wrote:
> Hi,
>
> On Thu, May 12, 2011 at 6:14 PM, Aaron Meurer <asmeu...@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.

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

>
> Thanks,
>
> Tim.
>
> --
> Tim Lahey
> PhD Candidate, Systems Design Engineering
> University of Waterloo
> http://about.me/tjlahey
>

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