[sage-support] How to set Initial conditions for desolve_laplace
Hi everybody, To become familiar with ODEs with Sage, I am trying to solve a very simple ODE with the Laplace method implemented in Sage In concrete, i want to solve dy(t)/dt = -k*y(t) with for example, initial conditions y(0)=1 For that: t = var('t') k = var('k') y = function('y',t) myODE = diff(y,t)+k*y==0 mysol = desolve_laplace(de=myODE, ivar=t, dvar=y, ics=[1,0]) mysol gets the value: e^(-k*t)*y(0) Works fine, but I am not able to set the initial condition y(0) to 1. The documentation say that the argument ics is a list of numbers which correspond the solution to the function when the independent value is zero. Am i missing something??? I would like to obtain the solution in the form mysol(t) = e^(-k*t) So that I can plot the solution with different values of k fig1 = plot(mysol.subs(k=1/5.), 0, 10) fig2 = plot(mysol.subs(k=1/2.), 0, 10) Of course, for more complex ODEs Thanks a lot in advance. Nin -- 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] [ANN] OpenOpt suite 0.34
Hi all, I'm glad to inform you about new quarterly release 0.34 of the OOSuite package software (OpenOpt, FuncDesigner, SpaceFuncs, DerApproximator) . Main changes: * Python 3 compatibility * Lots of improvements and speedup for interval calculations * Now interalg can obtain all solutions of nonlinear equation (example) or systems of them (example) in the involved box lb_i = x_i = ub_i (bounds can be very large), possibly constrained (e.g. sin(x) + cos(y+x) 0.5). * Many other improvements and speedup for interalg. See http://forum.openopt.org/viewtopic.php?id=425 for more details. Regards, D. -- 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] How to set Initial conditions for desolve_laplace
On Thu, Jun 16, 2011 at 5:58 AM, Nin n...@neurohost.org wrote: Hi everybody, To become familiar with ODEs with Sage, I am trying to solve a very simple ODE with the Laplace method implemented in Sage In concrete, i want to solve dy(t)/dt = -k*y(t) with for example, initial conditions y(0)=1 For that: t = var('t') k = var('k') y = function('y',t) myODE = diff(y,t)+k*y==0 mysol = desolve_laplace(de=myODE, ivar=t, dvar=y, ics=[1,0]) mysol gets the value: e^(-k*t)*y(0) Works fine, but I am not able to set the initial condition y(0) to 1. The You meant sage: t = var('t') sage: k = var('k') sage: y = function('y',t) sage: myODE = diff(y,t)+k*y==0 sage: desolve_laplace(de=myODE, ivar=t, dvar=y, ics=[0,1]) e^(-k*t) You can type type desolve_laplace? for more details on the syntax. documentation say that the argument ics is a list of numbers which correspond the solution to the function when the independent value is zero. Am i missing something??? I would like to obtain the solution in the form mysol(t) = e^(-k*t) So that I can plot the solution with different values of k fig1 = plot(mysol.subs(k=1/5.), 0, 10) fig2 = plot(mysol.subs(k=1/2.), 0, 10) Of course, for more complex ODEs Thanks a lot in advance. Nin -- 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 -- 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] How to set Initial conditions for desolve_laplace
On 16/06/11 13:32, David Joyner wrote: On Thu, Jun 16, 2011 at 5:58 AM, Ninn...@neurohost.org wrote: Hi everybody, To become familiar with ODEs with Sage, I am trying to solve a very simple ODE with the Laplace method implemented in Sage In concrete, i want to solve dy(t)/dt = -k*y(t) with for example, initial conditions y(0)=1 For that: t = var('t') k = var('k') y = function('y',t) myODE = diff(y,t)+k*y==0 mysol = desolve_laplace(de=myODE, ivar=t, dvar=y, ics=[1,0]) mysol gets the value: e^(-k*t)*y(0) Works fine, but I am not able to set the initial condition y(0) to 1. The You meant sage: t = var('t') sage: k = var('k') sage: y = function('y',t) sage: myODE = diff(y,t)+k*y==0 sage: desolve_laplace(de=myODE, ivar=t, dvar=y, ics=[0,1]) e^(-k*t) You can type type desolve_laplace? for more details on the syntax. documentation say that the argument ics is a list of numbers which correspond the solution to the function when the independent value is zero. Am i missing something??? I would like to obtain the solution in the form mysol(t) = e^(-k*t) So that I can plot the solution with different values of k fig1 = plot(mysol.subs(k=1/5.), 0, 10) fig2 = plot(mysol.subs(k=1/2.), 0, 10) Of course, for more complex ODEs Thanks a lot in advance. Nin -- 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 Fantastic, obviously I misunderstood the ics argument! Thanks David! -- 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: Error: Converting from p-adics to rationals.
I do want to convert to an integer in this particular case...but integers are rationals, so I don't understand why I don't just get the integer 344 when I try the following code: sage: K=Qp(7,5) sage: Q=QQ sage: a=344 sage: b=K(a) sage: a=Q(b) -- 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: Error: Converting from p-adics to rationals.
Here is the code that can be pasted into sage to produce the error: sage: K=Qp(7,5) sage: Q=QQ sage: a=344 sage: b=K(a) sage: a=Q(b) -- 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] install R packages on OS X
I was hoping that new release 4.7 will fix the problem, seeing that the ticket 5634 has been closed. However, I just tried to install a new package and got an error message: = Detected SAGE64 flag Building Sage on OS X in 64-bit mode -- | Sage Version 4.7, Release Date: 2011-05-23 | | Type notebook() for the GUI, and license() for information.| -- sage: r.install_packages('actuar') R version 2.10.1 (2009-12-14) Copyright (C) 2009 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. options(repos=http://cran.r-project.org/;); install.packages(actuar) trying URL 'http://cran.r-project.org/src/contrib/actuar_1.1-2.tar.gz' Content type 'application/x-gzip' length 1457732 bytes (1.4 Mb) opened URL == downloaded 1.4 Mb * installing *source* package ‘actuar’ ... ** libs Warning: R include directory is empty -- perhaps need to install R- devel.rpm or similar make: /Users/buildbot/build/sage/bsd-1/bsd_64_binary/build/sage-4.7/ local/lib/R/share/make/shlib.mk: No such file or directory make: *** No rule to make target `/Users/buildbot/build/sage/bsd-1/ bsd_64_binary/build/sage-4.7/local/lib/R/share/make/shlib.mk'. Stop. ERROR: compilation failed for package ‘actuar’ * removing ‘/Applications/Sage-4.7-OSX-64bit-10.6.app/Contents/ Resources/sage/local/lib/R/library/actuar’ The downloaded packages are in ‘/private/var/folders/D8/D8+XDdMDEJ4XIybIIPvntTQ/-Tmp-/RtmpZeAJMz/ downloaded_packages’ Updating HTML index of packages in '.Library' Warning messages: 1: In install.packages(actuar) : installation of package 'actuar' had non-zero exit status 2: In file.create(f.tg) : cannot create file '/Users/buildbot/build/sage/bsd-1/bsd_64_binary/ build/sage-4.7/local/lib/R/doc/html/packages.html', reason 'No such file or directory' 3: In tools:::unix.packages.html(.Library) : cannot create HTML package index real0m3.328s user0m0.927s sys 0m0.196s Please restart Sage in order to use 'actuar'. sage: = I do not understand, am I missing something on my Mac or the way sage has been compiled for Mac still does not support R packages installation? Regards, Kirill -- 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: install R packages on OS X
On Jun 16, 10:44 am, Kirill Vankov kirill.van...@gmail.com wrote: I was hoping that new release 4.7 will fix the problem, seeing that the ticket 5634 has been closed. However, I just tried to install a The errors reported there were of a different nature, primarily related to us long ago not having installed the suggested packages in R. new package and got an error message: That is sad! = Detected SAGE64 flag Building Sage on OS X in 64-bit mode Does this happen every time you start Sage? That is odd. -- | Sage Version 4.7, Release Date: 2011-05-23 | | Type notebook() for the GUI, and license() for information. | -- sage: r.install_packages('actuar') Warning: R include directory is empty -- perhaps need to install R- devel.rpm or similar make: /Users/buildbot/build/sage/bsd-1/bsd_64_binary/build/sage-4.7/ local/lib/R/share/make/shlib.mk: No such file or directory make: *** No rule to make target `/Users/buildbot/build/sage/bsd-1/ bsd_64_binary/build/sage-4.7/local/lib/R/share/make/shlib.mk'. Stop. ERROR: compilation failed for package ‘actuar’ = I do not understand, am I missing something on my Mac or the way sage has been compiled for Mac still does not support R packages installation? Unfortunately, we still have some hard links that are created during installation of the R package. These are incredibly tricky to track down. Presumably you have no directories like the ones in '/Users/buildbot/build/sage/bsd-1/bsd_64_binary/build/sage-4.7/local/ lib/R/doc/html/packages.html' There are several open tickets to fix this sort of thing, but no one has been working on them lately - presumably due to not understanding enough about the issues. Others may have some comments. The workaround for you is pretty simple, though it will take a few hours of sleep for it to happen. 1) Download the *source* to Sage, e.g. at http://www.sagemath.org/download-source.html 2) Follow the instructions to build Sage from source. It consists of going into a certain directory in Terminal and typing make. 3) Wait a few hours. 4) Now try to install your package! http://trac.sagemath.org/sage_trac/ticket/8274 is probably where this should get fixed. I'll put something about this there. Good luck! I use R optional packages all the time, so I hope it should work for you if you build from source. - kcrisman -- 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: gap packages and sage
Dear Enrique, I cc to sage-support, as it is an appropriate venue for such requests. On 16-Jun-2011, at 3:28 PM, Enrique Artal Bartolo wrote: Dear Dimitri, I am not sure if your are the good correspondant for this mail. I am a gap user and now I started to use sage. I appreciate a lot your work but I have a small problem. I installed the optional spkg with additional packages for gap; there are some packages which I use with gap (outside sage) which are not included. I tried to compile them in the sage tree but sage-gap does not recognize them. I guess that it is impossible to have a spkg with all gap packages and I have two questions: What is needed to change in some conf file for a package to be recognized if installed in gap inside sage? if the GAP packages in question do not need to be compiled, all you need to do is to put your GAP packages in $SAGE_ROOT/local/lib/gap-4.4.12/pkg/ to see exactly what needs to be done in the more complex cases, have a look in gap_packages spkg (spkg files are just bzip2-compressed tar archives, so you can easily see (in spkg-install file) what needs to be done to do proper configuring/compiling) If I recall right, you just have to start sage -sh, cd into SAGE_ROOT/local/lib/gap-4.4.12/pkg/your-package, and do the usual for your-package sequence of ./configure and make Please let us know if you still have problems with this setup. Is there a way to replace the gap tree in sage with the system gap tree? I don't recall what exactly makes this tricky, but it is not 100% trivial. Sincerely, Enrique Artal. Best, Dmitrii -- 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: Memleak when deleting elliptic curve over finite field ?
The following piece of code also seems to leak memory. The problem seems to occur while resolving the action of ZZ on E. sage: K = GF(155,'t') sage: a = K.random_element() sage: while 1: : E = EllipticCurve(j=a); P = E.random_point(); 2*P; On 16 juin, 02:51, Jean-Pierre Flori jpfl...@gmail.com wrote: this is now 11495 On 16 juin, 02:46, Jean-Pierre Flori jpfl...@gmail.com wrote: Ok so the memleak comes from ZZ_pE_to_ZZ_pX in c_lib/src/ntl_wrap.cpp It should have been fixed by trac #1092, but has been reverted by commit 8503. I'll reopen #1092. On 16 juin, 02:07, Jean-Pierre Flori jpfl...@gmail.com wrote: and from ZZ_pE_c_to_list function On 16 juin, 01:18, Jean-Pierre Flori jpfl...@gmail.com wrote: Which seems to come from list() method. On 16 juin, 00:09, Jean-Pierre Flori jpfl...@gmail.com wrote: I finally found the memleak in different si2sa_* functions in sage.libs.singular.singular and provided a fix on Trac. On 15 juin, 21:50, Jean-Pierre Flori jpfl...@gmail.com wrote: S the memleak seems to be located within creation or rather coercing to MPolynomial_libsingular. Calling gc.collect() whithin the loop seem to fix or are least attenuate the problem. However, calling afterwards does not free memory back. On 15 juin, 14:29, Jean-Pierre Flori jpfl...@gmail.com wrote: Thanks a lot, I'll have a look at that. On 15 juin, 14:26, Alastair Irving alastair.irv...@sjc.ox.ac.uk wrote: On 14/06/2011 21:58, Jean-Pierre Flori wrote: On 14 juin, 08:44, Simon Kingsimon.k...@uni-jena.de wrote: Since sage-nt seems to agree that it is a bug, I opened trac ticket #11474. Good ! About the original memleak, I tried looking at how EllipticCurves_finite_field (maybe not correct name) are created but could not find anything fishy, only Python code which should not produce any memleak. Hi I think this is a problem with multivariate polynomials over finite fields and is not specific to elliptic curves. The following code produces a leak: K=GF(2^50,t) R.x,y=PolynomialRing(K) a=K.random_element() while(1): f=a*x del f When constructing an elliptic curve its equation is constructed in the 3-variable polynomial ring over K, and thus we will get this leak. Best wishes Alastair -- 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: Error: Converting from p-adics to rationals.
On Jun 16, 7:22 am, Mel chemmyg...@gmail.com wrote: I do want to convert to an integer in this particular case...but integers are rationals, so I don't understand why I don't just get the integer 344 when I try the following code: If you are sure that the element can be represented as an integer, then just convert to an integer. That will always work: sage: K=Qp(7,5) sage: Q=QQ sage: a=344 sage: b=K(a) sage: a=Q(b) #your error sage: ZZ(a) 344 sage: ZZ(K(1/5)) 6723 sage: c = K(1/21) sage: c sage: ZZ(c) ValueError: negative valuation If it's not, you can make sure you can: sage: ZZ(K.prime()^(-c.valuation())*c)*K.prime()^(c.valuation()) 11205/7 sage: Q(c) 1/21 sage: K(1/21)-K(11205/7) O(7^4) The default choice of conversion from K to Q is apparently to call rational reconstruction (see c.rational_reconstruction) which, as you observed, tries to find a rational number N/D close to your element with |N|, |D| bounded by sqrt(p^precision), i.e., it's trying to use the same number of bits, but equally distributed over the numerator and denominator. For an arbitrary p-adic that happens to be meaning to represent a rational number, this is almost always what you want. If you know you mean an integer, you're wasting bits on a denominator you want to take 1 anyway, so it's not what you want. I'm a little on the fence whether rational reconstruction is the best default conversion for p-adics to Q, since your example shows sometimes people just want some rational number that lies close to their p-adic number. If you want to have your cake and eat it too (i.e., nice reps if they exist and some rep otherwise), just double the apparent precision: sage: QQ(Qp(7,2*K.precision_cap()) (b).lift_to_precision(2*b.precision_relative())) 344 -- 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: install R packages on OS X
On 2011-06-16 kcrisman wrote: On Jun 16, 10:44 am, Kirill Vankov wrote: Detected SAGE64 flag Building Sage on OS X in 64-bit mode Does this happen every time you start Sage? That is odd. About that, see trac tickets 10303, 11077, 9960: http://trac.sagemath.org/sage_trac/ticket/10303 http://trac.sagemath.org/sage_trac/ticket/11077 http://trac.sagemath.org/sage_trac/ticket/9960 -- 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: gap packages and sage
Hi Dmitrii and Enrique, On 16 Jun., 17:17, Dima Pasechnik dimp...@gmail.com wrote: On 16-Jun-2011, at 3:28 PM, Enrique Artal Bartolo wrote: Dear Dimitri, I am not sure if your are the good correspondant for this mail. I am a gap user and now I started to use sage. I appreciate a lot your work but I have a small problem. I installed the optional spkg with additional packages for gap; there are some packages which I use with gap (outside sage) which are not included. I tried to compile them in the sage tree but sage-gap does not recognize them. IIRC compiling them in the Sage tree (or more precisely in the location Dmitrii has indicated) almost suffices. But it may be needed to run the command sage: gap_reset_workspace() to make GAP in Sage aware of the existence of the new package. At least that's what I do when I install GAP packages that are not part of the optional spkg. Cheers, Simon -- 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: Error: Converting from p-adics to rationals.
As I said previously, you are only going to reconstruct RATIONALs with num,den less than sqrt((1/2)*p^k), i.e. 92 in this case. It is true that the integers are a subset of the rationals, but the convert to integer problem is not a sub-problem of the convert to rational problem. On Jun 16, 3:22 pm, Mel chemmyg...@gmail.com wrote: I do want to convert to an integer in this particular case...but integers are rationals, so I don't understand why I don't just get the integer 344 when I try the following code: sage: K=Qp(7,5) sage: Q=QQ sage: a=344 sage: b=K(a) sage: a=Q(b) -- 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