Re: [sympy] array of symbols

2013-04-18 Thread benjamin
well. i know if i create another set of loops it is two times slower but everything looks unpresentable for my need that way. for i in range(4): for k in range(4): for l in range(4): for m in range(4): if(g[i][m]!=0): C[i][k][l]=1/(2*g[i][m])*(diff(g[m][k],x[l])+diff(g[m][l],x[k])-diff(g[k][l],x[

Re: [sympy] New assumptions and caching

2013-04-18 Thread Tom Bachmann
On 19.04.2013 00:36, Aaron Meurer wrote: On Tue, Apr 16, 2013 at 2:09 PM, Tom Bachmann wrote: Hi guys, I did some investigations on issues with disabling caching. Basically, I ran the tests in all our 323 test files, both with and without the cache, and timed each file separately. In each case

Re: [sympy] review request

2013-04-18 Thread Aaron Meurer
Maybe some of the GSoC applicants could help out. Reviewing others' code is a great way to become more familiar with the code base, and to improve your own coding practices. Aaron Meurer On Apr 18, 2013, at 11:24 PM, smichr wrote: These branches (with indicated PR number) and addressed issues a

[sympy] review request

2013-04-18 Thread smichr
These branches (with indicated PR number) and addressed issues are in need of review. https://github.com/sympy/sympy/pull/1925 +3712 PR1925 (issue https://code.google.com/p/sympy/issues/detail?id=3712, https://code.google.com/p/sympy/issues/detail?id=3475) https://github.com/sympy/sympy/pu

Re: [sympy] array of symbols

2013-04-18 Thread Aaron Meurer
On Apr 18, 2013, at 5:49 PM, benjaminfuture wrote: i finally did it. so here it is C= [ [ [0 for k in range (4)] for i in range(4) ] for j in range(4) ] Why don't you just write your functions here instead of 0? Aaron Meurer for i in range(4): for k in range(4): for l in range(4): C[i][k][

Re: [sympy] Comparing expressions with floats to a given precision

2013-04-18 Thread Duane Nykamp
Yes, combining bottom_up with Float-via-string does exactly what I need. Now, if a student types in the numbers as given in the solution, they will get that the answer is correct. That will lead to less grief. Thanks so much! Duane On Thursday, April 18, 2013 9:27:10 PM UTC-5, smichr wrote:

Re: [sympy] semantics of `expand` for non-scalars non-Mul

2013-04-18 Thread Aaron Meurer
You can use whatever hint name you want. Just note that only mul, multinomial, power_base, power_exp, log, and basic are run by default. If you want it to be run by default and it doesn't fit one of those names, you can use basic. There are also meta-hint names numer, denom, modulus, and deep that

Re: [sympy] Comparing expressions with floats to a given precision

2013-04-18 Thread Chris Smith
I guess you have found a bug in evalf. > > A workaround would be to take out all Float instances, round them off > and substitute them: > Although I don't recall right now why evalf just doesn't do this, this was issue #1583 and there is a function nfloat which will do the job: >>> nfloat((pi*x+

Re: [sympy] Comparing expressions with floats to a given precision

2013-04-18 Thread Chris Smith
Combining the expansion and Float-via-string ideas through bottom_up gives: >>> def xn(e, n): ... return bottom_up(e, ... lambda w: expand_mul(w).n(n) ... if not w.is_Float else Float(str(w.n(n))), atoms=True) ... >>> xn(f1, 4) == xn(f2, 4) True -- You received this message because you are su

Re: [sympy] Comparing expressions with floats to a given precision

2013-04-18 Thread Chris Smith
Here are some other things that might be useful: >>> from sympy.simplify.simplify import bottom_up >>> bottom_up(cos(.123456*x), lambda x: x.n(3)) cos(0.123*x) expandng might be a good idea since then the there is some freedom in how to write the expression: >>> def xn(e, n): ... return bottom_

Re: [sympy] array of symbols

2013-04-18 Thread benjaminfuture
i finally did it. so here it is C= [ [ [0 for k in range (4)] for i in range(4) ] for j in range(4) ] for i in range(4): for k in range(4): for l in range(4): C[i][k][l]= ... and here comes my functions (e.g. a(t)**2/(1-k*r**2) where t and r are variables), etc... my goal was to calculate chri

Re: [sympy] New assumptions and caching

2013-04-18 Thread Aaron Meurer
On Tue, Apr 16, 2013 at 2:09 PM, Tom Bachmann wrote: > Hi guys, > > I did some investigations on issues with disabling caching. Basically, I ran > the tests in all our 323 test files, both with and without the cache, and > timed each file separately. In each case, I used the --timeout=60 parameter

Re: [sympy] Comparing expressions with floats to a given precision

2013-04-18 Thread Duane Nykamp
Thanks for your patience. Sorry for bringing up such a hackneyed topic. I was thinking about trying to use subtraction. But that would get pretty difficult when trying to compare 4.322*exp(5.553*t-0.342) and 4.32*exp(5.55*t-0.34). It seems like the pattern matching suggested by Ronan should

Re: [sympy] GSOC 13 Release Process Automating and Sympy-Bot

2013-04-18 Thread Aaron Meurer
On Wed, Apr 17, 2013 at 2:50 AM, Bi Ge wrote: > Hi Sympy community, > > > My name is Bi Ge and I am a third year Computer Engineering student > at Georgia Institute of Technology. My merged patch is here. Here is another > one (still under review). > > I would love to take up the c

Re: [sympy] Comparing expressions with floats to a given precision

2013-04-18 Thread Aaron Meurer
You can see why if you take the difference (which is what == does): In [277]: h.evalf(4) - h2.evalf(4) Out[277]: 0.003906 Because of the way Float represents numbers using a mantissa and an exponent, 4 digits of precision really means 4 digits after the first 0. So h - h2 to 4 digits of precision

Re: [sympy] Comparing expressions with floats to a given precision

2013-04-18 Thread Aaron Meurer
In cases where you gather things using atoms and replace them back in, it's better to use xreplace than subs to avoid issues with the heuristics that subs does where it replaces things that aren't exactly like the "old" expression (like x.subs(-x, y) => -y). Aaron Meurer On Thu, Apr 18, 2013 at 2

Re: [sympy] array of symbols

2013-04-18 Thread Stefan Krastanov
try `list_of_functions = map(Function, list_of_names)` If you instead want some anonymous dummy unnamed functions, I think SymPy does not support it. On 18 April 2013 23:43, benjaminfuture wrote: > ok, here is simple example. > > X=[] > > for j in range(1,5): > X.append(j) > > instead of number

Re: [sympy] Comparing expressions with floats to a given precision

2013-04-18 Thread Stefan Krastanov
As a heuristic, I would guess that you would need more than one significant digit to ensure that no funny effects come from switching from binary to decimal representation. There is also the Rational class, which might be better adapted for your case. On 18 April 2013 22:53, Duane Nykamp wrote:

Re: [sympy] array of symbols

2013-04-18 Thread benjaminfuture
ok, here is simple example. X=[] for j in range(1,5): X.append(j) instead of number j, i would like to append function. So there will be list of function which i can differentiate, etc... On Thursday, 18 April 2013 20:36:06 UTC+2, Stefan Krastanov wrote: > > What do you call an array? > > If

[sympy] GSOC2013 : Project Discussion

2013-04-18 Thread Sonal Raj
Hello!, I am Sonal Raj, a final year student pursuing B.Tech(Hons.) in National Institute of Technology, Jamshedpur, India.I love to code, especially in Python. I am quite interested in developing android applications and user interfaces and would love to work on " Creating an An

Re: [sympy] Comparing expressions with floats to a given precision

2013-04-18 Thread Duane Nykamp
Oh, perfect, that should work to get inside the functions. I'll have to try it. Is the following also a bug in evalf? In [71]: h=Float("418.264") In [72]: h2=Float("418.26") In [73]: h.evalf(4) Out[73]: 418.3 In [74]: h2.evalf(4) Out[74]: 418.3 In [75]: h.evalf(4)==h2.evalf(4) Out[75]: Fals

Re: [sympy] Re: Group Theory-Combinatorics

2013-04-18 Thread Amit Jamadagni
So would be feasible to have a proposal with discrete topics.I am trying hard to work out something on quantum module but if that does not happen the above question would come into picture.Thanks. On Fri, Apr 19, 2013 at 1:27 AM, David Joyner wrote: > I haven't looked at that project but I thin

Re: [sympy] semantics of `expand` for non-scalars non-Mul

2013-04-18 Thread Stefan Krastanov
What hint would be appropriate? I guess that we do not want an explosion of hints for every possible container. Maybe we should use `mul_like` for anything that is not `Mul`? On 18 April 2013 22:19, Aaron Meurer wrote: > > > On Thu, Apr 18, 2013 at 1:06 PM, Stefan Krastanov > mailto:krastanov.ste

Re: [sympy] semantics of `expand` for non-scalars non-Mul

2013-04-18 Thread Aaron Meurer
On Thu, Apr 18, 2013 at 1:06 PM, Stefan Krastanov mailto:krastanov.ste...@gmail.com";>> wrote: Should multiplication-like operators support `expand` or not? Example: WedgeProduct(a, b+c) -> WedgeProduct(a, b) + WedgeProduct(a, c) - reasons against: because `expand` is the embodiment of the dist

Re: [sympy] Comparing expressions with floats to a given precision

2013-04-18 Thread Stefan Krastanov
Oh, sorry, I misunderstood. I guess you have found a bug in evalf. A workaround would be to take out all Float instances, round them off and substitute them: your_expression.subs([(orig_float, orig_float.evalf(3)) for orig_float in expr.atoms(Float)]) On 18 Ap

Re: [sympy] Comparing expressions with floats to a given precision

2013-04-18 Thread Duane Nykamp
No, not at all. I guess I'm being unclear. ((5.333*x-1.234)*(2.251*x+5.234)).evalf(3) returns (2.25*x + 5.23)*(5.33*x - 1.23) which evaluates the numerical coefficients to a precision of three digits. So I was hoping that exp(5.3533*x).evalf(3) should return exp(5.35*x) which is the sam

Re: [sympy] Re: Group Theory-Combinatorics

2013-04-18 Thread David Joyner
I haven't looked at that project but I think I see what you mean. The two ideas sounds a bit too disjointed to fit smoothly into one GSOC proposal, but I could be wrong. Maybe you could write a second GSOC proposal with the discrete topics (finite fields, matrix theory over finite fields, etc) and

Re: [sympy] Comparing expressions with floats to a given precision

2013-04-18 Thread Stefan Krastanov
I guess that you want `exp(5.3533*x).evalf(3)` to return the result for x=3. But this would be a bad idea, because there is nothing special about x. What should `(x*y).evalf(3)` be for instance? I guess you want to use `subs`: exp(x).subs(x, 3).evalf() -- You received this message because you ar

Re: [sympy] Comparing expressions with floats to a given precision

2013-04-18 Thread Duane Nykamp
On Thursday, April 18, 2013 1:19:11 PM UTC-5, Aaron Meurer wrote: > > On Thu, Apr 18, 2013 at 12:10 PM, Duane Nykamp > > > wrote: > > Another suggestion is to expose .evalf() on the Tuple class. Right now, > I > > have to treat it as a special case. No big deal, but it would be > consistent

[sympy] semantics of `expand` for non-scalars non-Mul

2013-04-18 Thread Stefan Krastanov
Should multiplication-like operators support `expand` or not? Example: WedgeProduct(a, b+c) -> WedgeProduct(a, b) + WedgeProduct(a, c) - reasons against: because `expand` is the embodiment of the distributivity of Mul (is it?) - reasons for: because `expand` is the embodiment of distributivity

Re: [sympy] Re: Group Theory-Combinatorics

2013-04-18 Thread Amit Jamadagni
I already have discussed the idea of spherical harmonics in detail on this link. https://groups.google.com/forum/?fromgroups=#!topic/sympy/be0WuW9gs7I It basically states it would be help the quantum module but later I realized that it is all math in quantum interpretation.This is diffused kind o

Re: [sympy] array of symbols

2013-04-18 Thread Stefan Krastanov
What do you call an array? If it is a nested python list, just write `list_of_list_of_list[i][j][k] = whatever` (or more pythonically, populate it using a list comprehension or nested `for`s and `append`). If it is a numpy array, be sure to use the `dtype=object` data type. On 18 April 2013 19:5

Re: [sympy] Re: Group Theory-Combinatorics

2013-04-18 Thread David Joyner
On Thu, Apr 18, 2013 at 2:25 PM, Amit Jamadagni wrote: > Looking at implementation of spherical harmonics (I know there exists a > module but extending it (only in the symbolic field)) and in addition to > that the conversion between covariant and contra variant co ordinate > transitions along wi

Re: [sympy] Re: Group Theory-Combinatorics

2013-04-18 Thread Amit Jamadagni
Looking at implementation of spherical harmonics (I know there exists a module but extending it (only in the symbolic field)) and in addition to that the conversion between covariant and contra variant co ordinate transitions along with that.Thanks. On Thu, Apr 18, 2013 at 11:49 PM, David Joyner

Re: [sympy] Comparing expressions with floats to a given precision

2013-04-18 Thread Aaron Meurer
On Thu, Apr 18, 2013 at 12:10 PM, Duane Nykamp wrote: > Another suggestion is to expose .evalf() on the Tuple class. Right now, I > have to treat it as a special case. No big deal, but it would be consistent > if a Tuple had an .evalf() method. > > if self._n_digits: > try: >

Re: [sympy] Re: Group Theory-Combinatorics

2013-04-18 Thread David Joyner
On Thu, Apr 18, 2013 at 2:15 PM, Amit Jamadagni wrote: > Can the implementation of finite field in Sympy with reference to nzmath > be a project that can be done for SoC?? Thanks. > That alone? Or that in conjunction with a larger project? > > > On Sat, Apr 6, 2013 at 9:45 PM, Sushant Hiray wro

Re: [sympy] Re: Group Theory-Combinatorics

2013-04-18 Thread Amit Jamadagni
Can the implementation of finite field in Sympy with reference to nzmath be a project that can be done for SoC?? Thanks. On Sat, Apr 6, 2013 at 9:45 PM, Sushant Hiray wrote: > > Dear Vipul, > > Are you sure you did the following: > > Once you enter the sympy folder do the following: > > This wil

Re: [sympy] Comparing expressions with floats to a given precision

2013-04-18 Thread Duane Nykamp
Another suggestion is to expose .evalf() on the Tuple class. Right now, I have to treat it as a special case. No big deal, but it would be consistent if a Tuple had an .evalf() method. if self._n_digits: try: if isinstance(expression,Tuple):

[sympy] array of symbols

2013-04-18 Thread benjaminfuture
Hi! I was having problem with assigning function to elements of array. For example array A with 3 indices i,j,k and I would assign to each element some function (e.g. Aijk= sin(x) ) any help is appreciated. Benjamin -- You received this message because you are subscribed to the Google Group

Re: [sympy] Comparing expressions with floats to a given precision

2013-04-18 Thread Duane Nykamp
Thanks for the suggestions. Silly me, since I think of evalf as converting to a float, I didn't think it would work for symbolic expressions. It seems to work fine with polynomials, but it doesn't recurse into functions like sin(x) and exp(x). In [14]: expr=3.21513*sin(2352.23432*x)+(x-3.2598

Re: [sympy] GSoC 2013: Relativity

2013-04-18 Thread Samuel Rowe
Yes, that does look like a good way to go. I will have a closer look at the documentation and source and see what I can do to expand upon it. On Wednesday, 17 April 2013 15:05:56 UTC+1, Stefan Krastanov wrote: > > Hi there. One plausible direction would be extending the `diffgeom` > module that

Re: [sympy] Comparing expressions with floats to a given precision

2013-04-18 Thread Aaron Meurer
On Apr 18, 2013, at 9:19 AM, Duane Nykamp wrote: First of all, thanks for sympy and the help on this forum. I've been using sympy to create problems that automatically correct students answers. So far, it has been working pretty well, and I've succeeded in making questions such as these: http:

Re: [sympy] Comparing expressions with floats to a given precision

2013-04-18 Thread Ronan Lamy
Le 18/04/2013 16:19, Duane Nykamp a écrit : First of all, thanks for sympy and the help on this forum. I've been using sympy to create problems that automatically correct students answers. So far, it has been working pretty well, and I've succeeded in making questions such as these: http://mat

[sympy] Comparing expressions with floats to a given precision

2013-04-18 Thread Duane Nykamp
First of all, thanks for sympy and the help on this forum. I've been using sympy to create problems that automatically correct students answers. So far, it has been working pretty well, and I've succeeded in making questions such as these: http://mathinsight.org/assess/sample_questions I've

[sympy] GSOC2013 - Mobile App for Android

2013-04-18 Thread Lee Shaun
Hi , every one, My name is shaun, a third year student from Graduate School of Chinese Academy of Sciences. I am very interesting working on the idea of making an app for sympy on Android devices. I am new to sympy but I have already tested the idea by making sympy running on android os in cons

Re: [sympy] Request for Design of SymPy

2013-04-18 Thread Stefan Krastanov
Half a year ago there was also some nice graph-generating commands discussed on the list. I think Matthew Rocklin was the one that started the discussion then. Check the archives. On 18 April 2013 07:26, Aaron Meurer wrote: > Some tools that can be used to make dependency graphs are described at