[sage-support] is animate so slow?
hi all, I was trying to animate a plot, with only few frames (50). I get a very slow animate: from numpy import linspace t_vec = linspace(0,Tn,50) L = Graphics() v = [] tp = [] Xp = [] Yp = [] for tn in t_vec: tp.append(tn) Xp.append(X.subs(val_dict).subs(t = tn)) Yp.append(Y.subs(val_dict).subs(t = tn)) L += list_plot(zip(Xp,Yp), plotjoined = True) v.append(L) Xmin = min(Xp) Xmax = max(Xp) Ymin = min(Yp) Ymax = max(Yp) a = animate(v, xmin = Xmin, xmax = Xmax, ymin = Ymin, ymax = Ymax) timeit('a.show()', repeat = 1) 5 loops, best of 1: 12 s per loop is this expected? thanks maurizio -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
[sage-support] Re: evaluating numerically a function expression
is there any form of pattern matching in sage? that should be the basic tool to do something like you mentioned, is it correct? Maurizio On 25 Lug, 11:35, Renato wrote: > On Sat, 24 Jul 2010 11:03:45 -0700 > > > > Jason Grout wrote: > > On 7/24/10 4:38 AM, Renato wrote: > > > Hi, this seems very basic, but I wasn't able to figure it out. > > > Let's say I have a function: > > > > sage: f(t) > > > -4*(5*sqrt(2)*cos(1/2*sqrt(2)*sqrt(5)) - > > > 2*sqrt(5)*sin(1/2*sqrt(2)*sqrt(5)))*sin(1/2*sqrt(5)*t)/(sqrt(5)*sin(1/2*sqrt(2)*sqrt(5))^2 > > > + sqrt(5)*cos(1/2*sqrt(2)*sqrt(5))^2) + > > > 4*(5*sqrt(2)*sin(1/2*sqrt(2)*sqrt(5)) + > > > 2*sqrt(5)*cos(1/2*sqrt(2)*sqrt(5)))*cos(1/2*sqrt(5)*t)/(sqrt(5)*sin(1/2*sqrt(2)*sqrt(5))^2 > > > + sqrt(5)*cos(1/2*sqrt(2)*sqrt(5))^2) - 8 > > > > how do I tell sage to evaluate numerically everything but sin(), > > > cos() and t? I.e. I know this function is in the form > > > > f(t) = a*sin(b*t) + c*cos(d*t) > > > > can I tell sage to put it in this form, evaluating numerically a,b,c > > > and d? > > > > kind regards > > > renato > > > It looks like there is also a -8 at the end: > > ah yes, you're right. > > > sage: f(t)=-4*(5*sqrt(2)*cos(1/2*sqrt(2)*sqrt(5)) > > -2*sqrt(5)*sin(1/2*sqrt(2)*sqrt(5)))*sin(1/2*sqrt(5)*t)/(sqrt(5)*sin(1/2*sqrt(2)*sqrt(5))^2+ > > sqrt(5)*cos(1/2*sqrt(2)*sqrt(5))^2) > > +4*(5*sqrt(2)*sin(1/2*sqrt(2)*sqrt(5)) > > +2*sqrt(5)*cos(1/2*sqrt(2)*sqrt(5)))*cos(1/2*sqrt(5)*t)/(sqrt(5)*sin(1/2*sqrt(2)*sqrt(5))^2+ > > sqrt(5)*cos(1/2*sqrt(2)*sqrt(5))^2) - 8 > > > sage: f.subs_expr(sqrt(5)==sqrt(5).n(),sqrt(2)==sqrt(2).n()) > > t |--> 8.13039327042996*sin(1.11803398874989*t) + > > 12.5656955743861*cos(1.11803398874989*t) - 8 > > > Basically, I used subs_expr to subsititute in numeric values for the > > square roots. > > thanks :) > > > Question to the community at large: > > > It seems like f.n() should do the above (evaluate what it can > > numerically, leave the variables alone). But this doesn't work: > > yes it would be nice indeed to have a more general way of doing this. > > regards > renato -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
[sage-support] stein-wakins database iter_levels
the command iter_levels does not read the last line of the file I even tried s = SteinWatkinsAllData(0); L=s.__getslice__(5,9);L; this gives not output, where as s = SteinWatkinsAllData(0); L=s.__getslice__(5,7);L; gives the correct output/ Currently I was running the following code s = SteinWatkinsAllData(0); d=s.iter_levels(); while c<10^5-1: A=d.next(); And it gave me the following error after conductor 7 Traceback (most recent call last):while c<10^5: File "", line 1, in File "/private/var/folders/rt/rtyQ7RPsHRCDmvOBf9SYwU+++TI/-Tmp-/ tmpVqySXB/___code___.py", line 10, in A=d.next(); File "/Applications/sage/local/lib/python2.6/site-packages/sage/ databases/stein_watkins.py", line 247, in iter_levels E = iter.next() StopIteration Right now I have a temp. fix for my code. Which is to add a fake curve at the end of each file with conductor (n)*10^5. But was wondering if we could adjust the code instead. I am not very familiar with python so, done have a way yet, but will keep on working on it. -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
[sage-support] building sage 4.5.1 on macos
Hello, I am trying to build sage 4.5.1 from source on my MacBook Pro, OS Leopard 10.6.4. The compilation stops with an error at "singular" package, does anyone has a clue about that ? Thank you in advance your help. Leonard Finished installing sagenb-0.8.1.spkg /Users/Leo/Downloads/sage-4.5.1/spkg/pipestatus "sage-spkg singular-3.1.0.4.p7 2>&1" "tee -a /Users/Leo/Downloads/sage-4.5.1/spkg/logs/singular-3.1.0.4.p7.log" Warning: Attempted to overwrite SAGE_ROOT environment variable singular-3.1.0.4.p7 Machine: Darwin MacBook-Pro-de-BuU.local 10.4.0 Darwin Kernel Version 10.4.0: Fri Apr 23 18:27:12 PDT 2010; root:xnu-1504.7.4~1/RELEASE_X86_64 x86_64 Deleting directories from past builds of previous/current versions of singular-3.1.0.4.p7 Extracting package /Users/Leo/Downloads/sage-4.5.1/spkg/standard/singular-3.1.0.4.p7.spkg ... -rw-r--r--@ 1 Leo staff 7670621 28 jui 18:36 /Users/Leo/Downloads/sage-4.5.1/spkg/standard/singular-3.1.0.4.p7.spkg Finished extraction Host system uname -a: Darwin MacBook-Pro-de-BuU.local 10.4.0 Darwin Kernel Version 10.4.0: Fri Apr 23 18:27:12 PDT 2010; root:xnu-1504.7.4~1/RELEASE_X86_64 x86_64 CC Version gcc -v Using built-in specs. Target: i686-apple-darwin10 Configured with: /var/tmp/gcc/gcc-5659~1/src/configure --disable-checking --enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin10 --program-prefix=i686-apple-darwin10- --host=x86_64-apple-darwin10 --target=i686-apple-darwin10 --with-gxx-include-dir=/include/c++/4.2.1 Thread model: posix gcc version 4.2.1 (Apple Inc. build 5659) make[2]: *** No rule to make target `distclean'. Stop. rm: /Users/Leo/Downloads/sage-4.5.1/local/bin/Singular*: No such file or directory creating cache ./config.cache checking uname for singular... unknown configure: error: Unknown architecture: Check singuname.sh Unable to configure Singular. real0m0.919s user0m0.149s sys 0m0.332s sage: An error occurred while installing singular-3.1.0.4.p7 ... make[1]: *** [installed/singular-3.1.0.4.p7] Error 1 real67m40.679s user53m54.938s sys 13m54.002s Error building Sage. -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
Re: [sage-support] Re: Problem solving system of ODEs
Hello, On 07/23/2010 04:41 AM, kcrisman wrote: > Thanks for this explicit example. I think that what is happening is > that we are providing a list to the Maxima function "atvalue" (the > 'X(t) is just an unevaluated function X(t)), which Maxima wouldn't > like, perhaps. [...] > But I'm not sure why this is happening; doing the atvalue 'by hand' > seems to give the right thing. Anyone else have ideas why this > happens? Apparently no, at least there hasn't been any further reply so far :) Should I file a bug? Is there any other way to solve my system of ODEs using SAGE? I need to work with those equations in systems biology class. Thanks, Richard -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
[sage-support] Does sage have support for category theory?
I've tried to find info on this. Sorry if it's already been written down. Alec -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
Re: [sage-support] Re: evaluating numerically a function expression
On Sat, 24 Jul 2010 11:03:45 -0700 Jason Grout wrote: > On 7/24/10 4:38 AM, Renato wrote: > > Hi, this seems very basic, but I wasn't able to figure it out. > > Let's say I have a function: > > > > sage: f(t) > > -4*(5*sqrt(2)*cos(1/2*sqrt(2)*sqrt(5)) - > > 2*sqrt(5)*sin(1/2*sqrt(2)*sqrt(5)))*sin(1/2*sqrt(5)*t)/(sqrt(5)*sin(1/2*sqrt(2)*sqrt(5))^2 > > + sqrt(5)*cos(1/2*sqrt(2)*sqrt(5))^2) + > > 4*(5*sqrt(2)*sin(1/2*sqrt(2)*sqrt(5)) + > > 2*sqrt(5)*cos(1/2*sqrt(2)*sqrt(5)))*cos(1/2*sqrt(5)*t)/(sqrt(5)*sin(1/2*sqrt(2)*sqrt(5))^2 > > + sqrt(5)*cos(1/2*sqrt(2)*sqrt(5))^2) - 8 > > > > how do I tell sage to evaluate numerically everything but sin(), > > cos() and t? I.e. I know this function is in the form > > > > f(t) = a*sin(b*t) + c*cos(d*t) > > > > can I tell sage to put it in this form, evaluating numerically a,b,c > > and d? > > > > kind regards > > renato > > > > > It looks like there is also a -8 at the end: ah yes, you're right. > sage: f(t)=-4*(5*sqrt(2)*cos(1/2*sqrt(2)*sqrt(5)) > -2*sqrt(5)*sin(1/2*sqrt(2)*sqrt(5)))*sin(1/2*sqrt(5)*t)/(sqrt(5)*sin(1/2*sqrt(2)*sqrt(5))^2+ > > sqrt(5)*cos(1/2*sqrt(2)*sqrt(5))^2) > +4*(5*sqrt(2)*sin(1/2*sqrt(2)*sqrt(5)) > +2*sqrt(5)*cos(1/2*sqrt(2)*sqrt(5)))*cos(1/2*sqrt(5)*t)/(sqrt(5)*sin(1/2*sqrt(2)*sqrt(5))^2+ > > sqrt(5)*cos(1/2*sqrt(2)*sqrt(5))^2) - 8 > > sage: f.subs_expr(sqrt(5)==sqrt(5).n(),sqrt(2)==sqrt(2).n()) > t |--> 8.13039327042996*sin(1.11803398874989*t) + > 12.5656955743861*cos(1.11803398874989*t) - 8 > > Basically, I used subs_expr to subsititute in numeric values for the > square roots. thanks :) > Question to the community at large: > > It seems like f.n() should do the above (evaluate what it can > numerically, leave the variables alone). But this doesn't work: yes it would be nice indeed to have a more general way of doing this. regards renato -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
[sage-support] Define an action
Hello, I would like to define an action, let us say: def Ac(Y,k): return k.transpose()*Y*k where Y and k are square matrices of the same size. But, I would prefer to use a more mathematical notation, like Y[k] or y...@k or whatever non already used symbol instead of Ac(y,k). How is it possible to do that? Best regards. Drenwal -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org