[sympy] determinant of a 3x3 matrix hangs

2010-07-30 Thread Nico
oing wrong -- is that a bug in SymPy; using v0.6.7 here. Any hints? Cheers, Nico = *snip* = #! /usr/bin/env python # -*- coding: utf-8 -*- ''' Calculates the J^{-1} J{-T} for where J is the Jacobian of the bilinear mapping of the referen

[sympy] Re: determinant of a 3x3 matrix hangs

2010-07-31 Thread Nico
eventually I end up with that huge *polynomial* in xi, eta, which I want to integrate over (-1,1)^2 -- seems to be a trivial thing to do, but now, the code hangs there forever. Can you confirm this? Any workarounds? Cheers, Nico === *snip* === #!

[sympy] Re: Ideas for the new assumptions system

2009-01-26 Thread nico
> I think that could be something like a global assumption. But it's > true that I am still not convinced we need global assumptions. I agree with Vinzent about global assumptions. If x refers to a real in a whole session, I think it would be really fastidious to use 'assume(x in R)' or somethin

[sympy] Re: Ideas for the new assumptions system

2009-01-27 Thread nico
Thanks for your welcome. :) Again, I agree with Vinzent. Sometimes, it's ok to work in, say, C, and then, finally, select only real solutions. It's typically the case when you search for roots of polynomials. But there're other times you simply can't do that. For example, solving inequalities i

[sympy] Re: Ideas for the new assumptions system

2009-01-28 Thread nico
Brian Granger : > 2. The with statement actually gives a very nice way of expressing an > assumption that should be applied to a set of expressions.  Nice idea! > +1 It's really nice in a script or a program indeed (if python version is 2.5 or above). However, in a an interactive session, it is

[sympy] convert array to C(++) code: function body extraction?

2015-06-24 Thread Nico
o C code using codegen, and then after that _regexp_ the function body out. Then from the four function bodies, I build the C++ function. Is there a better way to do this, in particular one that works without regexping around the output code? Cheers, Nico -- You received this message because

[sympy] adding attributes to sympy objects

2015-07-13 Thread Nico
s there any other way to embellish SymPy objects (such as Add, Symbol) with extra attributes? Cheers, Nico -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to s

Re: [sympy] adding attributes to sympy objects

2015-07-14 Thread Nico
Thanks for the suggestions! I'll probably go ahead and see if I can wrap the objects where needed. Cheers, Nico On Monday, July 13, 2015 at 7:51:09 PM UTC+2, Aaron Meurer wrote: > > This is because SymPy uses __slots__ as a performance/memory optimization. > > One way to do

[sympy] deriving from sympy.Function

2015-07-14 Thread Nico
: x ``` It'd be easier to add the function definition straight in the initializer. However ``` class MyTest(sympy.Function): def __init__(self, name, fun): self.fun = fun return a = MyTest('a', lambda x: x) ``` does *not* work. Any idea why that is and how to fix

[sympy] deriving from sympy.Function: object not callable

2015-07-16 Thread Nico
mpy.Function): pass b = MyTest('b') b(x) # object is not callable ``` doesn't work: `b` is reported not to be callable here. Any hints why this might be and how to fix it? Cheers, Nico [1] https://groups.google.com/forum/#!topic/sympy/5mLEq4Gbyfk -- You received this message

[sympy] Re: deriving from sympy.Function: object not callable

2015-07-16 Thread Nico
Got it: As outlined in [1], what is mathematically perceived as a "function" is a class in terms of sympy, not an instance thereof. --Nico [1] http://docs.sympy.org/latest/modules/functions/index.html On Thursday, July 16, 2015 at 9:53:17 AM UTC+2, Nico wrote: > > Following u

[sympy] relate x[0] back to x

2015-08-19 Thread Nico
After defining a vector `x` and one of its components, say `x0`, ``` import sympy x = sympy.DeferredVector('x') x0 = x[0] ``` is there any way to relate `x0` back to `x`? I.e., I'm looking for a Boolean function that returns `True` for the question "Is x0 a component of x?" -- You received this

[sympy] live shell on the website

2015-08-24 Thread Nico
ion on [1], the live shell opens with seemingly unrelated code ("I didn't ask for this!"), and after hiding it, I find myself on another place in the documentation. Yikes! Other than that great work. I particularly appreciate the helpfulness of this "mailing list".

[sympy] generate code for Boolean expressions

2015-08-24 Thread Nico
to support this kind of code generation? Cheers, Nico -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscr...@googlegroups.com. To post to this group,

[sympy] sympy.Function that returns a function

2016-04-05 Thread Nico
``` y = op(u)(x) ``` With the naïve definition above, I'm getting ``` TypeError: 'op' object is not callable ``` Any hints? Cheers, Nico -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop rec

[sympy] Re: sympy.Function that returns a function

2016-04-05 Thread Nico
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

[sympy] node.func.__name__ on UndefinedFunctions?

2016-04-05 Thread Nico
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, Ni

Re: [sympy] node.func.__name__ on UndefinedFunctions?

2016-04-05 Thread Nico
x27;) creates *class*, not > an object. Roughly speaking, Function('u') is syntatic sugar for > > class u(Function): > pass > > (except it also sets the metaclass as UndefinedFunction) > > In other words, if you have a = u(x), then a.func is u. > > Aaron

[sympy] distinguishing own from intrinsic functions

2016-04-13 Thread Nico
ween function that I defined myself (`f`) the ones that come from elsewhere. I though about subclassing `sympy.Function`, but apparently it's not exactly meant to be used that way [1]. Any hints? Cheers, Nico [1] https://groups.google.com/forum/#!topic/sympy/pU81Trc_Xr8 -- You received thi

Re: [sympy] determinant of a 3x3 matrix hangs

2010-07-30 Thread Nico Schlömer
omething I don't understand here which is where the actual complication sits. I'm more worried about actually calculating the inverse of that matrix; I'm also gonna need that. Cheers, Nico On Sat, Jul 31, 2010 at 12:58 AM, Aaron S. Meurer wrote: > Hi! > > I ran your scri

Re: [sympy] Re: determinant of a 3x3 matrix hangs

2010-07-31 Thread Nico Schlömer
g off with the vectors alpha, beta, gamma, delta, rather than x0,...,x3, making use of ), sympy would get a boost. I guess I'll go on reading up on the sympy documentation and play around. Thanks! Nico On Sat, Jul 31, 2010 at 4:27 PM, Aaron S. Meurer wrote: > Well, you can't g

[sympy] simplifying combinatorial sum

2017-11-23 Thread Nico Schlömer
Given natural numbers n, r, 0<=r<=n, I'm dealing with the expression I have the strong suspicion that this can be simplified to a product of binomial coefficients. Is

Re: [sympy] simplifying combinatorial sum

2017-11-26 Thread Nico Schlömer
nk it has also received some > improvements in master. > > You can also try using SymPy to evaluate the sum. > > Aaron Meurer > > On Thu, Nov 23, 2017 at 2:43 AM, Nico Schlömer > wrote: > >> Given natural numbers n, r, 0<=r<=n, I'm dealing wit

[sympy] lambdify function with array of parameters

2018-03-19 Thread Nico Schlömer
Given the degrees in numerator and denominator I would like to represent a Padé polynomial à la ``` P(x) = (a[0] + a[1]*x + a[2]*x**2 + ...) / (1 + b[1]*x + b[2]*x**2 + ...) ``` in sympy and let it do the heavy lifting, e.g., computation of derivatives. Operations that I'll need to do: * Replac

[sympy] Re: lambdify function with array of parameters

2018-03-19 Thread Nico Schlömer
I see! I also noticed that I can use `DeferredVector`s instead of `MatrixSymbol`s to get avoid those dict shenanigans. This ``` import numpy import sympy a = sympy.DeferredVector('a') b = sympy.DeferredVector('b') x = sympy.Symbol('x') P = (a[0] + a[1]*x) / (1 + b[0]*x + b[1]*x**2 + b[2]*x**3)

Re: [sympy] Re: lambdify function with array of parameters

2018-03-22 Thread Nico Schlömer
or (which apparently isn't removed because > everyone forgot about it). > > On Mon, Mar 19, 2018 at 6:29 PM, Nico Schlömer > wrote: > > I see! > > I also noticed that I can use `DeferredVector`s instead of > `MatrixSymbol`s > > to get avoid those dict shenanigans. Th

Re: [sympy] relate x[0] back to x

2015-08-19 Thread Nico Schlömer
> There is also the MatrixSymbol class that may be better here. Quite interesting! Is there such a thing as a VectorSymbol as well? (I saw the `is_Vector` property here but never saw it True, neither for MatrixSymbols nor for DeferredVectors.) --Nico On Wed, Aug 19, 2015 at 10:20 PM Ja

[sympy] Re: distinguishing own from intrinsic functions

2016-04-13 Thread Nico Schlömer
I guess one thing I could do is taint the function class object as > > ``` f = Function('f') f.my_custom_function = True ``` -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email

Re: [sympy] distinguishing own from intrinsic functions

2016-04-13 Thread Nico Schlömer
both can be imported from > sympy.core.function). You can find custom functions with > y.atoms(AppliedUndef). > > Aaron Meurer > > > On Wed, Apr 13, 2016 at 8:35 AM, Nico > > wrote: > > To get all function from an expression, one can do > > ``` > > from sympy impor

[sympy] C code from IndexedBase

2016-04-14 Thread Nico Schlömer
>From an object like `sin(u[k]) + u0[k]` I would like to get the corresponding C code as a string. Since `k` is a variable, I cannot use `MatrixSymbol`, but there's always `IndexedBase` of course. With ``` u = IndexedBase('u') u0 = IndexedBase('u0') k = Symbol('k') y = sin(u[k]) + u0[k] ``` thing

[sympy] Re: C code from IndexedBase

2016-04-14 Thread Nico Schlömer
symbols: print(s, isinstance(s, IndexedBase)) ``` Hm... On Thursday, April 14, 2016 at 8:59:46 AM UTC+2, Nico Schlömer wrote: > > From an object like `sin(u[k]) + u0[k]` I would like to get the > corresponding C code as a string. Since `k` is a variable, I cannot use > `M

[sympy] Re: C code from IndexedBase

2016-04-14 Thread Nico Schlömer
Once again, atoms to the rescue. ``` y.atoms(IndexedBase) ``` will give you all IndexedBase object from an expression. On Thursday, April 14, 2016 at 9:25:09 AM UTC+2, Nico Schlömer wrote: > > It seems that, unfortunately, the information of whether or not a variable > is an IndexedBa

[sympy] Simplification with dot products

2017-02-27 Thread Nico Schlömer
I have a somewhat large expression in inner products, ``` zeta = ( - * * + 4 * * * + ( + * + * + * ) * ( + + + - - -

Re: [sympy] Simplification with dot products

2017-02-27 Thread Nico Schlömer
Thanks for the reply. > I assume e0, e1, and e2 are arbitrary vectors. Indeed, they can be anything. (I'm looking at 3 dimensions here but given the fact that everything is a dot product I assume that doesn't play much of a role.) Cheers, Nico On Monday, February 27, 2017

Re: [sympy] Simplification with dot products

2017-02-27 Thread Nico Schlömer
Thanks for the suggestions. The noncommutative option is probably too strict since ` != ` then. Or can I make only some multiplications noncommutative? > You might need to write a naive factor Is there any documentation on this? Cheers, Nico On Monday, February 27, 2017 at 9:44:45 PM UT

[sympy] 1.0.1 point release?

2017-03-15 Thread Nico Schlömer
Hi everyone, Are there plans for a point release of sympy? I'm eager for it because of the (fixed) regression [1]. Cheers, Nico [1] https://github.com/sympy/sympy/issues/12132 -- You received this message because you are subscribed to the Google Groups "sympy" group. To u

[sympy] Rational with Symbol

2017-10-04 Thread Nico Schlömer
a way to support integer and symbolic fractions from one interface? Cheers, Nico -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscr...@googlegroups.