Thanks for the quick response that was good to hear, I am just getting
started with Python for scientific computing and I am amazed at how
powerful it is.
On Monday, April 4, 2016 at 7:02:36 PM UTC-7, Amit Saha wrote:
>
> On Tue, Apr 5, 2016 at 11:24 AM, Aaron Meurer >
Great, thanks!
On Tuesday, April 5, 2016 at 8:11:06 PM UTC+2, Aaron Meurer wrote:
>
> It works in that case too
>
> In [62]: u = Function('u')
>
> In [63]: u.__name__
> Out[63]: 'u'
>
> The important thing to note is that Function('u') creates *class*, not
> an object. Roughly speaking,
It works in that case too
In [62]: u = Function('u')
In [63]: u.__name__
Out[63]: 'u'
The important thing to note is that Function('u') creates *class*, not
an object. Roughly speaking, Function('u') is syntatic sugar for
class u(Function):
pass
(except it also sets the metaclass as
If you don't need op(u) as a distinct expression that is way easier.
You can also define custom printing on it to make it display however
you want.
Aaron Meurer
On Tue, Apr 5, 2016 at 2:01 PM, Nico wrote:
> Thanks Anton for the tip!
> I'll see what'll work best for me.
I need to get the name (as a string) of certain given functions, and I've
typically done it like
```
node.func.__name__
```
That works, except for UndefinedFunctions. Is that an oversight? How to get
the 'hello' from u in
```
u = sympy.Function('hello')
```
?
Cheers,
Nico
--
You received this
collect(expr, [a, b], func=factor) will do what you want.
Also see this discussion
https://groups.google.com/forum/?utm_medium=email_source=footer#!msg/sympy/-0ASBB5JBG0/1XGNURZZCAAJ.
Aaron Meurer
On Tue, Apr 5, 2016 at 1:45 PM, Luv Agarwal wrote:
> Hey, I was trying to
Thanks Anton for the tip!
I'll see what'll work best for me. (As a dirty workaround, I now defined
the function to take two arguments, e.g., op(u, x).)
Cheers,
Nico
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To unsubscribe from this group and
Hey, I was trying to represent the following expression in more compact
form:
*expr = a*l**2 + 2*a*l + a + b*conjugate(l)**2 - 2*b*conjugate(l) + b*
The above expr can be represented as:
*expr = a*(l+1)**2 + b*(conjugate(l)-1)**2*
Is there any SymPy function to perform such type of
On Tue, Apr 5, 2016 at 12:54 PM, Oscar Benjamin
wrote:
> On 5 April 2016 at 17:15, Aaron Meurer wrote:
>> On Tue, Apr 5, 2016 at 6:19 AM, Oscar Benjamin
>> wrote:
>>>
>>> I though that it should be possible to easily do
On 5 April 2016 at 17:15, Aaron Meurer wrote:
> On Tue, Apr 5, 2016 at 6:19 AM, Oscar Benjamin
> wrote:
>>
>> I though that it should be possible to easily do this with sympy
>> Floats but it doesn't seem to work:
>>
>> In [1]: x = S(1.4142)
>>
>>
It depends if you want op(u) to also be usable in expressions. If you
do, the simplest way is to make op be a Function, and define __call__
on it so that it returns an object representing op(u)(x).
Defining that other object is the tricky part. I think something like
class AppliedOp(Expr):
On Tue, Apr 5, 2016 at 6:19 AM, Oscar Benjamin
wrote:
> On 5 April 2016 at 01:56, Amy Valhausen wrote:
>>
>> import numpy
>> (np.longdouble(1.4142)** 6000 )%400
> ...
>>
>> # The library mpmath is a good solution
> import sympy as smp
So far, I've always defined functions as
```
class f(sympy.Function):
pass
```
which I could then conveniently use as
```
x = sympy.Symbol('x')
y = f(x)
```
Nice.
Now, I would like to define a function that itself returns a function, aka,
an operator. It should be used as
```
y = op(u)(x)
On 5 April 2016 at 01:56, Amy Valhausen wrote:
>
> import numpy
> (np.longdouble(1.4142)** 6000 )%400
...
>
> # The library mpmath is a good solution
import sympy as smp
mp = smp.mpmath
>
mp.mp.dps = 50 # Computation precision is 50 digits
50 digits is
14 matches
Mail list logo