[sage-support] Re: solve() fails to produce a solution
On Thu, Aug 28, 2008 at 11:06 PM, Robert Dodier <[EMAIL PROTECTED]> wrote: > On 8/28/08, William Stein <[EMAIL PROTECTED]> wrote: > >> Sage uses Maxima's solve command, and Maxima's solve >> command is pretty wimpy, and we (Sage developers) intend >> to write our own new solve command that can deal with >> more general equations. > > Go nuts, man. Hope you can write it in Python since that will > make it easier to port to Lisp. > We might start with Sympy's solve command, which is in Python, and which also can't solve the above equations: sage: from sympy import * sage: x,y = var('x,y') sage: sympy.solve([x==0, 1-exp(y)==0],[x,y]) {} sage: solve([y*sin(x)==0, cos(x)==0],x,y) {} William --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: solve() fails to produce a solution
On 8/28/08, William Stein <[EMAIL PROTECTED]> wrote: > Sage uses Maxima's solve command, and Maxima's solve > command is pretty wimpy, and we (Sage developers) intend > to write our own new solve command that can deal with > more general equations. Go nuts, man. Hope you can write it in Python since that will make it easier to port to Lisp. By the way, Maxima has an add-on package named solver which seems to be somewhat stronger than built-in solve. See: maxima/share/algebra/solver best Robert Dodier --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: solve() fails to produce a solution
On Thu, Aug 28, 2008 at 10:59 PM, mabshoff <[EMAIL PROTECTED]> wrote: > > > > On Aug 28, 10:47 pm, "William Stein" <[EMAIL PROTECTED]> wrote: >> On Thu, Aug 28, 2008 at 8:57 AM, Roger <[EMAIL PROTECTED]> wrote: >> >> > solve([x==0, 1-exp(y)==0],x,y) >> > returns the empty set, although (0,0) is an obvious solution. This >> > occurs also for other simple combinations involving exp, as well as >> > for >> > solve([y*sin(x)==0, cos(x)==0],x,y) >> >> > What am I doing wrong? Thanks. (Sage 3.0.2 on Mac OSX) >> >> Sage uses Maxima's solve command, and Maxima's solve >> command is pretty wimpy, and we (Sage developers) intend >> to write our own new solve command that can deal with >> more general equations. >> >> Here's an illustration of maxima not solving the above equations >> >> sage: !maxima >> (%i2) solve([x=0, 1-exp(y)=0],[x,y]); >> (%o2) [] >> (%i3) solve([y*sin(x)=0, cos(x)=0],[x,y]); >> (%o3) [] > > Yeah, and it is also broken in the latest Maxima (since William might > have used the Maxima from Sage 3.1.1): If you read the docs for Maxima's solve, then I don't think "broken" is the right word. It's more that Maxima's solve simply isn't that sophisticated of a command, and doesn't claim to be.The only real solutions is for some sage developers to write a whole solve package, which is going to probably be an interesting project. The first step would be to replicate Maxima's functionality, at least. William > > Maxima 5.16.2 http://maxima.sourceforge.net > Using Lisp CLISP 2.46 (2008-07-02) > Distributed under the GNU Public License. See the file COPYING. > Dedicated to the memory of William Schelter. > The function bug_report() provides bug reporting information. > (%i1) solve([x=0, 1-exp(y)=0],[x,y]); > (%o1) [] > (%i2) solve([y*sin(x)=0, cos(x)=0],[x,y]); > (%o2) [] > (%i3) > > Since Robert Dodier is not subscribed to sage-support I am CCin him > here. > >> You can read the help on maxima's solve, if you want to get >> a sense of its limitations. >> >> sage: maxima.solve? >> >> William > > Cheers, > > Michael > > > -- William Stein Associate Professor of Mathematics University of Washington http://wstein.org --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: solve() fails to produce a solution
On Aug 28, 10:47 pm, "William Stein" <[EMAIL PROTECTED]> wrote: > On Thu, Aug 28, 2008 at 8:57 AM, Roger <[EMAIL PROTECTED]> wrote: > > > solve([x==0, 1-exp(y)==0],x,y) > > returns the empty set, although (0,0) is an obvious solution. This > > occurs also for other simple combinations involving exp, as well as > > for > > solve([y*sin(x)==0, cos(x)==0],x,y) > > > What am I doing wrong? Thanks. (Sage 3.0.2 on Mac OSX) > > Sage uses Maxima's solve command, and Maxima's solve > command is pretty wimpy, and we (Sage developers) intend > to write our own new solve command that can deal with > more general equations. > > Here's an illustration of maxima not solving the above equations > > sage: !maxima > (%i2) solve([x=0, 1-exp(y)=0],[x,y]); > (%o2) [] > (%i3) solve([y*sin(x)=0, cos(x)=0],[x,y]); > (%o3) [] Yeah, and it is also broken in the latest Maxima (since William might have used the Maxima from Sage 3.1.1): Maxima 5.16.2 http://maxima.sourceforge.net Using Lisp CLISP 2.46 (2008-07-02) Distributed under the GNU Public License. See the file COPYING. Dedicated to the memory of William Schelter. The function bug_report() provides bug reporting information. (%i1) solve([x=0, 1-exp(y)=0],[x,y]); (%o1) [] (%i2) solve([y*sin(x)=0, cos(x)=0],[x,y]); (%o2) [] (%i3) Since Robert Dodier is not subscribed to sage-support I am CCin him here. > You can read the help on maxima's solve, if you want to get > a sense of its limitations. > > sage: maxima.solve? > > William Cheers, Michael --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: solve() fails to produce a solution
On Thu, Aug 28, 2008 at 8:57 AM, Roger <[EMAIL PROTECTED]> wrote: > > solve([x==0, 1-exp(y)==0],x,y) > returns the empty set, although (0,0) is an obvious solution. This > occurs also for other simple combinations involving exp, as well as > for > solve([y*sin(x)==0, cos(x)==0],x,y) > > What am I doing wrong? Thanks. (Sage 3.0.2 on Mac OSX) Sage uses Maxima's solve command, and Maxima's solve command is pretty wimpy, and we (Sage developers) intend to write our own new solve command that can deal with more general equations. Here's an illustration of maxima not solving the above equations sage: !maxima (%i2) solve([x=0, 1-exp(y)=0],[x,y]); (%o2) [] (%i3) solve([y*sin(x)=0, cos(x)=0],[x,y]); (%o3) [] You can read the help on maxima's solve, if you want to get a sense of its limitations. sage: maxima.solve? William --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: saving as C code?
On Thu, Aug 28, 2008 at 9:14 PM, Jason Grout <[EMAIL PROTECTED]> wrote: > > MB wrote: >> Using Robert's suggestion of repr() got me pretty close. The biggest >> remaining issue is that Sage writes a^x whereas C needs pow(a,x). For >> simple cases, I was able to fix this with regular expression >> substitution as follows: >> >> import re >> p = re.compile("([a-zA-Z0-9]+?)\\^([a-zA-Z0-9]+)") >> >> o = open("mycode.c", "w") >> o.write("E1 = " >> o.write(p.subn("pow(\\1,\\2)", repr(E1))[0]) >> o.write(";\n") >> >> Here E1 is the expression to be written out. >> >> Unfortunately, my regular expression is too simple to handle cases >> like (a+b)^2. > > > For various objects and various software systems (like mathematica, > magma, maxima, etc.), we have a _mathematica_init_, _magma_init_, etc, > which convert an expression into syntax for the target system. A lot of > these are defined in calculus.py for converting symbolic expressions to > syntax for other systems. I don't think we have an "interface" to C > code; can anyone think of a reason why we shouldn't? (or do we already > have one?) This is a good idea. Regarding the rest of your email, this is precisely the same thing I would have said. Incidentally, I believe Ginac has a C output mode for its expressions. This isn't wrapped in pynac yet, but should be easy to do. > That said, can you modify either the _repr_ function or the _latex_ > function for your needs? For example, in the _latex_ function, there is > a place in the code where it clearly does the power string (line 5081 in > devel/sage/sage/calculus/calculus.py in my current sage files). > > For that matter, it looks like if you just add two lines in _sys_init_ > (line 5111 in calculus.py for me), so it looks like this: > > def _sys_init_(self, system): > ops = self._operands > if self._operator is operator.neg: > return '-(%s)' % sys_init(ops[0], system) > elif self._operator is operator.pow: >return 'pow(%s, %s)' % (sys_init(ops[0], system), >sys_init(ops[1], system)) >else: > return '(%s) %s (%s)' % (sys_init(ops[0], system), > infixops[self._operator], > sys_init(ops[1], system)) > > or something like that, it would be a quick hackjob to do what you want, > maybe. > > > Thanks, > > Jason > > > > > -- William Stein Associate Professor of Mathematics University of Washington http://wstein.org --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: saving as C code?
MB wrote: > Using Robert's suggestion of repr() got me pretty close. The biggest > remaining issue is that Sage writes a^x whereas C needs pow(a,x). For > simple cases, I was able to fix this with regular expression > substitution as follows: > > import re > p = re.compile("([a-zA-Z0-9]+?)\\^([a-zA-Z0-9]+)") > > o = open("mycode.c", "w") > o.write("E1 = " > o.write(p.subn("pow(\\1,\\2)", repr(E1))[0]) > o.write(";\n") > > Here E1 is the expression to be written out. > > Unfortunately, my regular expression is too simple to handle cases > like (a+b)^2. For various objects and various software systems (like mathematica, magma, maxima, etc.), we have a _mathematica_init_, _magma_init_, etc, which convert an expression into syntax for the target system. A lot of these are defined in calculus.py for converting symbolic expressions to syntax for other systems. I don't think we have an "interface" to C code; can anyone think of a reason why we shouldn't? (or do we already have one?) That said, can you modify either the _repr_ function or the _latex_ function for your needs? For example, in the _latex_ function, there is a place in the code where it clearly does the power string (line 5081 in devel/sage/sage/calculus/calculus.py in my current sage files). For that matter, it looks like if you just add two lines in _sys_init_ (line 5111 in calculus.py for me), so it looks like this: def _sys_init_(self, system): ops = self._operands if self._operator is operator.neg: return '-(%s)' % sys_init(ops[0], system) elif self._operator is operator.pow: return 'pow(%s, %s)' % (sys_init(ops[0], system), sys_init(ops[1], system)) else: return '(%s) %s (%s)' % (sys_init(ops[0], system), infixops[self._operator], sys_init(ops[1], system)) or something like that, it would be a quick hackjob to do what you want, maybe. Thanks, Jason --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Plotting functions with asymptotes
The general asymptote issues referred to in this thread are now http://trac.sagemath.org/sage_trac/ticket/3985 . - kcrisman --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Plotting functions with asymptotes
Hello, On Thu, Aug 28, 2008 at 6:47 AM, kcrisman <[EMAIL PROTECTED]> wrote: > > Speaking of asymptotes, any ideas on > http://trac.sagemath.org/sage_trac/ticket/3907 > ? I would be glad to try it, but don't understand enough of how > infinity and _tasteful_ticks work in Sage. > ... > Very good! Any ideas on why plot(2*sin, -5, 5) doesn't (see > http://trac.sagemath.org/sage_trac/ticket/3906)? Again, I'd be glad > to help if I understood anything of the symbolics. I've put fixes up for both #3906 and #3907. Hopefully they will be reviewed in time for inclusion in Sage 3.1.2. --Mike --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: differentiation in the class 'sage.calculus.calculus.SymbolicArithmetic'
> There is a weird bug in Sage (or Python) where in some weird cases it > blames sympy for every single thing that ever goes wrong. > Go figure. I noticed that too. It blames sympy.plotting, which has this: try: from ctypes import * except: raise ImportError("ctypes is required for plotting.\n'easy_install ctypes' or visit http://sourceforge.net/projects/ctypes/";) I don't know if it could be related to ctypes, but I cannot reproduce it, maybe it was fixed by not importing sympy by default in recent Sage. Ondrej --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: differentiation in the class 'sage.calculus.calculus.SymbolicArithmetic'
On Thu, Aug 28, 2008 at 11:36 AM, Ondrej Certik <[EMAIL PROTECTED]> wrote: > > On Tue, Aug 5, 2008 at 6:27 AM, Alex Raichev <[EMAIL PROTECTED]> wrote: >> >> Hi all: >> >> I am having difficulty differentiating a formal symbolic function >> multiplied by the symbolic constant 1 (see code below). Is this a >> bug? How can i work around it? >> >> Alex >> === >> sage: >>var('x') >>f= function('F',x) >>g= x^2 >>a= SR(2) >>b= SR(1) >>for j in [f,f*g,f*a,g*b]: >>print type(j) >>print diff(j,x) >> >> >> >> d >> -- (F(x)) >> dx >> >> >>2 d >> x (-- (F(x))) + 2 x F(x) >> dx >> >> >>d >> 2 (-- (F(x))) >>dx >> >> Traceback (most recent call last):print diff(j,x) >> File "/home/arai021/sage-3.0.2-ubuntu32-intel-i686-Linux/local/lib/ >> python2.5/site-packages/sympy/plotting/", line 3, in > > > ^^^ why is sympy called here? > > That's another bug that should be imho fixed, sympy should not be > called unless needed. There is a weird bug in Sage (or Python) where in some weird cases it blames sympy for every single thing that ever goes wrong. Go figure. -- William --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: saving as C code?
Using Robert's suggestion of repr() got me pretty close. The biggest remaining issue is that Sage writes a^x whereas C needs pow(a,x). For simple cases, I was able to fix this with regular expression substitution as follows: import re p = re.compile("([a-zA-Z0-9]+?)\\^([a-zA-Z0-9]+)") o = open("mycode.c", "w") o.write("E1 = " o.write(p.subn("pow(\\1,\\2)", repr(E1))[0]) o.write(";\n") Here E1 is the expression to be written out. Unfortunately, my regular expression is too simple to handle cases like (a+b)^2. --Michael --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Find_root bug
The reciprocal of tangent is not a constant function, but Sage says otherwise. This is now http://trac.sagemath.org/sage_trac/ticket/3980 . (Incidentally, using z(x)=tan(x) also doesn't work, as it yields a NotImplementedError (whose message could be better) for 1/z; presumably the bug below would occur even if it were implemented, though.) - kcrisman sage: z=tan sage: z tan sage: 1/z 1/tan sage: find_root(1/z,1,2) --- RuntimeError Traceback (most recent call last) /Applications/sage/local/lib/python2.5/site-packages/sage/numerical/ optimize.py in find_root(f, a, b, xtol, rtol, maxiter, full_output) 52 """ 53 try: ---> 54 return f.find_root(a=a,b=b,xtol=xtol,rtol=rtol,maxiter=maxiter,full_output=full_output) 55 except AttributeError: 56 pass /Applications/sage/local/lib/python2.5/site-packages/sage/calculus/ calculus.py in find_root(self, a, b, var, xtol, rtol, maxiter, full_output) 3088 return a 3089 else: -> 3090 raise RuntimeError, "no zero in the interval, since constant expression is not 0." 3091 var = repr(w[0]) 3092 RuntimeError: no zero in the interval, since constant expression is not 0. --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Plotting functions with asymptotes
> > >>> I don't know the best way to be "smart" about fixing this such as how > >>> much of the asymptote to include, etc. > >> Yeah, I was thinking about this, because what you would really want to > >> do is have an algorithm which would automatically check if the 'bend' > >> was too great compared to the rest of the function and then NOT plot > >> the line connecting those points. But would that slow plotting down > >> too much (since you'd have to compare *all* the bends to each other, > >> not just to max_bend like in adaptive refinement, as I understand > >> it)? Not to mention trying to decide what "too great compared" means. > > > It might be easier to detect a root in 1/f(x) (or some kind of > > heuristic given a sign change between f(a) and f(b), is a root of f > > (x) or 1/f(x) more likely). Thanks for your thoughts, Jason. > > Another thing: does the adaptive plotting code handle asymptotes > intelligently? That is, when it picks one point on either side of an > asymptote, it seems like it would try to recursively subdivide unless it > knows there is an asymptote there or can somehow guess there is an > asymptote. > Not currently, that's for sure, but combined with Robert's idea it might be a good starting point, given this snippet of the result of the xdata: sage: P=plot(tan,-5,5); list=P[0].xdata;len(list) 1201 sage: list -4.7260837325003902, -4.7260666712822843, -4.7260496100641793, -4.7260325488460744, -4.7260154876279685, -4.7259984264098627, -4.7259813651917577, -0.10341837811481863, -0.03500403414505103, -0.010279622543906589, 0.069496699401952633, 0.10646492301295057, 0.13438881092313087, 0.20201941119890751, Interesting that Mma includes the "asymptotes", but that they really look like asymptotes given that it intelligently chooses the ymin and ymax. That could be another way to go. - kcrisman --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Erratic behaviour with "Evaluate All" in a notebook
Weird, the text version of the notebook had code that was not displayed at all (below id=25). I deleted it from the text version, restarted the notebook, evaluated all, it worked, I did this a couple of times and then again: boom. The interesting thing is that if I repeated the last command manually, it evaluated, so it was not that the definition of dwaterv was not evaluated at all, but the cell dwaterv.subs(locals()) must have been evaluated before the definition. See code below (id=31 was put in after Evaluate All). Stan Bugs system:sage {{{id=11| %html For testing purposes: /// For testing purposes: }}} {{{id=8| var('ab av jbiom lwat p rwat biom veloc mort epot esv etv esb etb wv wb qbv qvb bv') /// (ab, av, jbiom, lwat, p, rwat, biom, veloc, mort, epot, esv, etv, esb, etb, wv, wb, qbv, qvb, bv) }}} {{{id=9| dwaterv = (av*p - esv - etv - qvb + qbv) dwaterb = (ab*p - esb + qvb - qbv) ab = 1 - av qvb = veloc*wv/av qbv = veloc*wb/ab esv = av*lwat*(wv/av) etv = av*rwat*(wv/av)*(bv/av)^2 esb = ab*lwat*wb/ab dbv = jbiom*etv - mort*bv /// }}} {{{id=18| %hide %html where av and ab are the area fractions by the vegetated and bare soil box respectively. av+ab=1. /// where av and ab are the area fractions by the vegetated and bare soil box respectively. av+ab=1. }}} {{{id=19| assume(p>0, veloc>0, mort>0,lwat>0,jbiom>0,rwat>0,av>=0,av<=1,wv>=0,wb>=0,bv>=0) /// }}} {{{id=20| dwaterv.subs(locals()) /// Traceback (most recent call last): File "", line 1, in File "/Users/sschym/.sage/sage_notebook/worksheets/admin/4/code/ 14.py", line 6, in exec compile(ur'dwaterv.subs(locals())' + '\n', '', 'single') File "/Users/sschym/Programs/sage/local/lib/python2.5/site-packages/ SQLAlchemy-0.4.6-py2.5.egg/", line 1, in NameError: name 'dwaterv' is not defined }}} {{{id=31| dwaterv.subs(locals()) /// -veloc*wv/av - bv^2*rwat*wv/av^2 - lwat*wv + veloc*wb/(1 - av) + av*p }}} {{{id=32| /// }}} --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: saving as C code?
Robert, Thanks! That helps. --Michael On Aug 28, 1:04 pm, Robert Bradshaw <[EMAIL PROTECTED]> wrote: > On Thu, 28 Aug 2008, MB wrote: > > > I'm converting over from mathematica to Sage. One thing I need to do > > is write a large number of expressions to an ASCII file as C code, or > > something reasonably close. Mathematica has the CForm[] operator for > > this, which doesn't quite make C code but is pretty close. > > > In Sage, I tried writing str(expression) to a file, but it doesn't > > just print a flat expression. Rather, it tries to make it look > > pretty, which makes it unusable for automatic code generation. > > > Does anyone have an idea how to do this? > > This hasn't been implemented in great generality yet, but try writing > repr(expression) rather than str(expression). > > - Robert --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Plotting functions with asymptotes
Mike Hansen wrote: > Hello, > > On Tue, Aug 26, 2008 at 8:47 PM, kcrisman <[EMAIL PROTECTED]> wrote: >> There have been tons of great improvements to the plotting making >> their way through trac lately. Do any of those changes for ranges >> etc. deal with the very weird output one gets for e.g. >> >> sage: plot((x-1)/(x+2),-4,4) >> >> or, worse, >> >> sage: plot(tan,-20,20) >> >> In both cases, Sage isn't "recognizing" the asymptotes, and then the >> scale gets thrown off, not to mention the non-existent-but-plotted >> connections across discontinuities. > > Nope, none of these are fixed by the new changes. I tried Maple and > it did the same thing -- I don't know what Mathematica does. You can > do these as a workaround: I did these in mathematica and posted the result at http://sage.math.washington.edu/home/jason/mma-graph.pdf for comparison. Thanks, Jason --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Plotting functions with asymptotes
Robert Bradshaw wrote: > On Aug 28, 2008, at 6:47 AM, kcrisman wrote: > >> Thanks for the replies (and the great work!). Some followup below: >> >>> Nope, none of these are fixed by the new changes. I tried Maple and >>> it did the same thing -- I don't know what Mathematica does. You can >>> do these as a workaround: >>> >> Interesting that Maple does it. Anyone know about Mma? Mac's Grapher >> definitely IS smart about this, rather elegantly so. >> >>> sage: plot(tan,-20,20).show(ymin=-5, ymax=5) >>> sage: plot((x-1)/(x+2),-4,4).show(ymin=-10, ymax=10) >>> >> Of course, these plots still have the Intermediate Value Property on >> the entire real line. >> >>> I don't know the best way to be "smart" about fixing this such as how >>> much of the asymptote to include, etc. >> Yeah, I was thinking about this, because what you would really want to >> do is have an algorithm which would automatically check if the 'bend' >> was too great compared to the rest of the function and then NOT plot >> the line connecting those points. But would that slow plotting down >> too much (since you'd have to compare *all* the bends to each other, >> not just to max_bend like in adaptive refinement, as I understand >> it)? Not to mention trying to decide what "too great compared" means. > > It might be easier to detect a root in 1/f(x) (or some kind of > heuristic given a sign change between f(a) and f(b), is a root of f > (x) or 1/f(x) more likely). Another thing: does the adaptive plotting code handle asymptotes intelligently? That is, when it picks one point on either side of an asymptote, it seems like it would try to recursively subdivide unless it knows there is an asymptote there or can somehow guess there is an asymptote. Thanks, Jason --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Erratic behaviour with "Evaluate All" in a notebook
Well, the behaviour is erratic, indeed. Sometimes it works, sometimes it does not. I deleted the %hide command and then it worked once or twice, then it didn't any more etc. Could it have something to do with other notebooks that I have open at the same time? It's a mystery and obviously difficult to analyse if it is not reproducible. I put the text version of the notebook after it produced the error below. Stan Bugs system:sage {{{id=11| %html For testing purposes: /// }}} {{{id=8| var('ab av jbiom lwat p rwat biom veloc mort epot esv etv esb etb wv wb qbv qvb bv') /// (ab, av, jbiom, lwat, p, rwat, biom, veloc, mort, epot, esv, etv, esb, etb, wv, wb, qbv, qvb, bv) }}} {{{id=9| dwaterv = (av*p - esv - etv - qvb + qbv) dwaterb = (ab*p - esb + qvb - qbv) ab = 1 - av qvb = veloc*wv/av qbv = veloc*wb/ab esv = av*lwat*(wv/av) etv = av*rwat*(wv/av)*(bv/av)^2 esb = ab*lwat*wb/ab dbv = jbiom*etv - mort*bv /// }}} {{{id=18| %hide %html where av and ab are the area fractions by the vegetated and bare soil box respectively. av+ab=1. /// where av and ab are the area fractions by the vegetated and bare soil box respectively. av+ab=1. }}} {{{id=19| assume(p>0, veloc>0, mort>0,lwat>0,jbiom>0,rwat>0,av>=0,av<=1,wv>=0,wb>=0,bv>=0) /// }}} {{{id=20| dwaterv.subs(locals()) /// Traceback (most recent call last): File "", line 1, in File "/Users/sschym/.sage/sage_notebook/worksheets/admin/4/code/ 234.py", line 6, in exec compile(ur'dwaterv.subs(locals())' + '\n', '', 'single') File "/Users/sschym/Programs/sage/local/lib/python2.5/site-packages/ SQLAlchemy-0.4.6-py2.5.egg/", line 1, in NameError: name 'dwaterv' is not defined }}} {{{id=31| /// }}} {{{id=25| dwaterv /// Traceback (most recent call last): File "", line 1, in File "/Users/sschym/.sage/sage_notebook/worksheets/admin/4/code/ 46.py", line 6, in exec compile(ur'dwaterv' + '\n', '', 'single') File "/Users/sschym/Programs/sage/local/lib/python2.5/site-packages/ SQLAlchemy-0.4.6-py2.5.egg/", line 1, in File "sage_object.pyx", line 92, in sage.structure.sage_object.SageObject.__repr__ (sage/structure/ sage_object.c:795) File "/Users/sschym/Programs/sage/local/lib/python2.5/site-packages/ sage/calculus/calculus.py", line 4922, in _repr_ return self._simp._repr_(simplify=False) File "/Users/sschym/Programs/sage/local/lib/python2.5/site-packages/ sage/calculus/calculus.py", line 4928, in _repr_ s = [x._repr_(simplify=simplify) for x in ops] File "/Users/sschym/Programs/sage/local/lib/python2.5/site-packages/ sage/calculus/calculus.py", line 4928, in _repr_ s = [x._repr_(simplify=simplify) for x in ops] File "/Users/sschym/Programs/sage/local/lib/python2.5/site-packages/ sage/calculus/calculus.py", line 4928, in _repr_ s = [x._repr_(simplify=simplify) for x in ops] File "/Users/sschym/Programs/sage/local/lib/python2.5/site-packages/ sage/calculus/calculus.py", line 4928, in _repr_ s = [x._repr_(simplify=simplify) for x in ops] AttributeError: 'dict' object has no attribute '_repr_' }}} {{{id=26| type(dwaterv) /// }}} {{{id=27| dwaterv.diff /// Traceback (most recent call last): File "", line 1, in File "/Users/sschym/.sage/sage_notebook/worksheets/admin/4/code/ 53.py", line 6, in exec compile(ur'dwaterv.diff' + '\n', '', 'single') File "/Users/sschym/Programs/sage/local/lib/python2.5/site-packages/ SQLAlchemy-0.4.6-py2.5.egg/", line 1, in File "sage_object.pyx", line 92, in sage.structure.sage_object.SageObject.__repr__ (sage/structure/ sage_object.c:795) File "/Users/sschym/Programs/sage/local/lib/python2.5/site-packages/ sage/calculus/calculus.py", line 4922, in _repr_ return self._simp._repr_(simplify=False) File "/Users/sschym/Programs/sage/local/lib/python2.5/site-packages/ sage/calculus/calculus.py", line 4928, in _repr_ s = [x._repr_(simplify=simplify) for x in ops] File "/Users/sschym/Programs/sage/local/lib/python2.5/site-packages/ sage/calculus/calculus.py", line 4928, in _repr_ s = [x._repr_(simplify=simplify) for x in ops] File "/Users/sschym/Programs/sage/local/lib/python2.5/site-packages/ sage/calculus/calculus.py", line 4928, in _repr_ s = [x._repr_(simplify=simplify) for x in ops] File "/Users/sschym/Programs/sage/local/lib/python2.5/site-packages/ sage/calculus/calculus.py", line 4928, in _repr_ s = [x._repr_(simplify=simplify) for x in ops] AttributeError: 'dict' object has no attribute '_repr_' }}} {{{id=28| dwaterv{1} /// Syntax Error: dwaterv{1} }}} {{{id=29| search_src('simplify') /// Search Source Code: simplifycalculus/all.py calculus/calculus.py calculus/equations.py calculus/functional.py calculus/tests.py calculus/wester.py functions/constants.py functions/ elementary.py graphs/graph.py interfaces/maple.py libs/pari/decl.pxi libs/pari/ functional.py libs/pari/gen.pyx libs/symmetrica/ symmetrica.pxi logic/logic.py matrix/ matrix_symbolic_dense.pyx misc/sage_input.py plot/plot3d/ transform.pyx rings/ polynomial/polynomia
[sage-support] Inert Integrals and Derivatives?
Hi, Maple has a really useful feature of inert integrals and derivatives. Basically, the integrals and derivatives show up in the equations, but aren't evaluated until a command to evaluate them is explicitly given. So, you can delay the evaluation until after you've processed the expression to the point where it can be evaluated. This feature comes in very handy during complicated derivations because you can see which terms are integrals or derivatives and manipulate them along side non-integrals/derivatives. Is there a way to do this in Sage? Thanks, Tim. smime.p7s Description: S/MIME cryptographic signature
[sage-support] Re: Erratic behaviour with "Evaluate All" in a notebook
Hi Stan, Thanks for the step by step test. Unfortunately I wasn't able to reproduce the bug. Your exact test is in my testing document. On Thu, Aug 28, 2008 at 10:26 AM, Ryan <[EMAIL PROTECTED]> wrote: > > I have seen this as well, and almost all my worksheets use the %hide > command within the first few cells. I don't seem to have this > problem when I don't hide the first few cells. > > I am only using Firefox 2.0.0.16 for Windows XP and Sage 3.1.1. > > > > > --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Difference between definite and indefinite integration
On Fri, Jun 27, 2008 at 3:06 PM, David Joyner <[EMAIL PROTECTED]> wrote: > > I'm not sure if what you report is a bug in SAGE. SAGE calls Maxima. If Maxima > refuses to integrate that integral (and I think it *should* but maybe > the algebra > is too complicated for it) then SAGE won't do it either. > If you want a numerical value then use n(integrate...). That seems to be > "working" though, as in my last email, providing an incorrect answer. > I just entered it as > http://trac.sagemath.org/sage_trac/ticket/3520 > > Can you check if Maxima (or sympy) can do the integral? If yes to > either, that would be > very interesting. sympy cannot: http://code.google.com/p/sympy/issues/detail?id=1060 Ondrej --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: linear algebra: solving system of equations involving some unknown scalars
On Sat, Jul 26, 2008 at 3:58 AM, Jason Grout <[EMAIL PROTECTED]> wrote: > > David Joyner wrote: >> On Fri, Jul 25, 2008 at 8:06 PM, John H Palmieri <[EMAIL PROTECTED]> wrote: >>> On Jul 25, 12:31 pm, "David Joyner" <[EMAIL PROTECTED]> wrote: I'm not sure how you would enter a matrix that size but can you compute the row reduced echelon form of the transpose of A? >>> Well, I don't even know how to define such a matrix in Sage. For >>> example, >>> >>> var('c') >>> A = Matrix(GF(2), [[1,0,c], [0,1,0]]) >>> >>> gives an error, as does >>> >>> var('c') >>> A = Matrix(GF(2), [[1,0,0], [0,1,0]]) >>> A[0,2] = c >>> >>> In a 'simple' case, I can produce a large matrix (using some lisp >>> code) which has no such parameters -- it's all 0s and 1s -- and >>> compute its row-echelon form, etc. But I can't figure out how to get >>> the parameters involved in the calculation. >> >> I was thinking that the coefficient ring would be the ring of univariate >> polynomials over GF(2). I think SAGE can do row reduction over its >> field of fractions. Can you try a 15x40 first, just to see how hard it >> would be to set up the matrix and do the rref? > > > Do you mean like this (the error below is from sagenb.org): > > sage: R. = GF(2)[] > sage: A = matrix(R, [[1, 0, y], [0, 1, 0]]) > sage: A.echelon_form() > Traceback (most recent call last): > File "", line 1, in > File "/home/server2/sage_notebook/worksheets/jason3/65/code/6.py", > line 6, in > A.echelon_form() > File > "/usr/local/sage/local/lib/python2.5/site-packages/sympy/plotting/", > line 1, in ^^^ again I am worried what is sympy plotting doing here? I cannot reproduce it in 3.1.2.alpha1, so let's hope it was fixed already: sage: R. = GF(2)[] sage: A = matrix(R, [[1, 0, y], [0, 1, 0]]) sage: A.echelon_form() --- NotImplementedError Traceback (most recent call last) /home/certiko/ext/sage-3.1.2.alpha1/ in () /home/certiko/ext/sage-3.1.2.alpha1/matrix2.pyx in sage.matrix.matrix2.Matrix.echelon_form (sage/matrix/matrix2.c:18176)() /home/certiko/ext/sage-3.1.2.alpha1/matrix2.pyx in sage.matrix.matrix2.Matrix.echelonize (sage/matrix/matrix2.c:17980)() /home/certiko/ext/sage-3.1.2.alpha1/matrix2.pyx in sage.matrix.matrix2.Matrix._echelonize_ring (sage/matrix/matrix2.c:17699)() NotImplementedError: echelon form over Univariate Polynomial Ring in y over Finite Field of size 2 not yet implemented sage: Ondrej --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: showing step by step work
On Sat, Aug 23, 2008 at 7:21 PM, Timothy Clemans <[EMAIL PROTECTED]> wrote: > No, but you're welcome to implement it. Maybe implement it in SymPy > which is written in pure Python and included in Sage. > > On Sat, Aug 23, 2008 at 1:01 PM, Brian <[EMAIL PROTECTED]> wrote: >> >> Just curious, is there any support for, or any plans to support step >> by step problem solving? I'm thinking of this tool: >> http://calc101.com/webMathematica/derivatives.jsp >> >> Which shows you that it first used the chain rule, then took the >> second derivative, then used the quotient rule, etc. It might have >> useful applications in edu. Several people have wanted that in sympy list as well, but so far noone has done it neither in Sage or sympy. Ondrej --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: differentiation in the class 'sage.calculus.calculus.SymbolicArithmetic'
On Tue, Aug 5, 2008 at 6:27 AM, Alex Raichev <[EMAIL PROTECTED]> wrote: > > Hi all: > > I am having difficulty differentiating a formal symbolic function > multiplied by the symbolic constant 1 (see code below). Is this a > bug? How can i work around it? > > Alex > === > sage: >var('x') >f= function('F',x) >g= x^2 >a= SR(2) >b= SR(1) >for j in [f,f*g,f*a,g*b]: >print type(j) >print diff(j,x) > > > > d > -- (F(x)) > dx > > >2 d > x (-- (F(x))) + 2 x F(x) > dx > > >d > 2 (-- (F(x))) >dx > > Traceback (most recent call last):print diff(j,x) > File "/home/arai021/sage-3.0.2-ubuntu32-intel-i686-Linux/local/lib/ > python2.5/site-packages/sympy/plotting/", line 3, in ^^^ why is sympy called here? That's another bug that should be imho fixed, sympy should not be called unless needed. Ondrej --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: saving as C code?
On Thu, 28 Aug 2008, MB wrote: > > I'm converting over from mathematica to Sage. One thing I need to do > is write a large number of expressions to an ASCII file as C code, or > something reasonably close. Mathematica has the CForm[] operator for > this, which doesn't quite make C code but is pretty close. > > In Sage, I tried writing str(expression) to a file, but it doesn't > just print a flat expression. Rather, it tries to make it look > pretty, which makes it unusable for automatic code generation. > > Does anyone have an idea how to do this? This hasn't been implemented in great generality yet, but try writing repr(expression) rather than str(expression). - Robert --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] saving as C code?
I'm converting over from mathematica to Sage. One thing I need to do is write a large number of expressions to an ASCII file as C code, or something reasonably close. Mathematica has the CForm[] operator for this, which doesn't quite make C code but is pretty close. In Sage, I tried writing str(expression) to a file, but it doesn't just print a flat expression. Rather, it tries to make it look pretty, which makes it unusable for automatic code generation. Does anyone have an idea how to do this? Thanks--Michael --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Plotting functions with asymptotes
On Aug 28, 2008, at 6:47 AM, kcrisman wrote: > > Thanks for the replies (and the great work!). Some followup below: > >> Nope, none of these are fixed by the new changes. I tried Maple and >> it did the same thing -- I don't know what Mathematica does. You can >> do these as a workaround: >> > > Interesting that Maple does it. Anyone know about Mma? Mac's Grapher > definitely IS smart about this, rather elegantly so. > >> sage: plot(tan,-20,20).show(ymin=-5, ymax=5) >> sage: plot((x-1)/(x+2),-4,4).show(ymin=-10, ymax=10) >> > > Of course, these plots still have the Intermediate Value Property on > the entire real line. > >> I don't know the best way to be "smart" about fixing this such as how >> much of the asymptote to include, etc. > > Yeah, I was thinking about this, because what you would really want to > do is have an algorithm which would automatically check if the 'bend' > was too great compared to the rest of the function and then NOT plot > the line connecting those points. But would that slow plotting down > too much (since you'd have to compare *all* the bends to each other, > not just to max_bend like in adaptive refinement, as I understand > it)? Not to mention trying to decide what "too great compared" means. It might be easier to detect a root in 1/f(x) (or some kind of heuristic given a sign change between f(a) and f(b), is a root of f (x) or 1/f(x) more likely). - Robert --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Line continuation inside < >
How can I continue a line inside a < >? I want to write something like "A. = ZZ[]" over two lines. After typing "A.http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Line continuation inside < >
On Thu, Aug 28, 2008 at 9:47 AM, phil <[EMAIL PROTECTED]> wrote: > > How can I continue a line inside a < >? > I want to write something like "A. = ZZ[]" over two lines. > After typing "A. message. Unfortunately I don't think you can do that. Sorry. You might want to try using the inject_variables function: sage: R = ZZ['a,b,c,d,e,f,g,h,i,j,k,foo,bar'] sage: R.inject_variables() Defining a, b, c, d, e, f, g, h, i, j, k, foo, bar sage: (a*b + g*h)^3 a^3*b^3 + 3*a^2*b^2*g*h + 3*a*b*g^2*h^2 + g^3*h^3 Incidentally, for stupid reasons, it's actually vastly faster in sage right now to do arithmetic in QQ[...] than in ZZ[...] when the polynomial is in >= 2 variables (this will eventually change). sage: timeit('(a*b + g*h)^3') 625 loops, best of 3: 101 µs per loop sage: R = QQ['a,b,c,d,e,f,g,h,i,j,k,foo,bar'] sage: R.inject_variables() Defining a, b, c, d, e, f, g, h, i, j, k, foo, bar sage: timeit('(a*b + g*h)^3') 625 loops, best of 3: 3.63 µs per loop --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: failed to upgrade... again
it seems to have worked ! thanks ! On Aug 28, 4:03 pm, Pierre <[EMAIL PROTECTED]> wrote: > ah, ok, m4 was just plain missing. I've installed it, the rest was > there, let me try again ! > > On Aug 28, 3:32 pm, "William Stein" <[EMAIL PROTECTED]> wrote: > > > On Thu, Aug 28, 2008 at 6:27 AM, Pierre <[EMAIL PROTECTED]> wrote: > > > > I'm on sage 3.0.2 on ubuntu, i've tried sage --upgrade and got this: > > > > checking for suitable m4... configure: error: No usable m4 in $PATH > > > or /usr/5bin (see config.log for reasons). > > > Failed to configure. > > > > i can't find the file config.log anyway. > > > > help ? > > > You should not consider using "sage -upgrade" unless you install the > > following linux programs first: > > > gcc, g++, make, m4, perl, ranlib, and tar. > > > William --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] solve() fails to produce a solution
solve([x==0, 1-exp(y)==0],x,y) returns the empty set, although (0,0) is an obvious solution. This occurs also for other simple combinations involving exp, as well as for solve([y*sin(x)==0, cos(x)==0],x,y) What am I doing wrong? Thanks. (Sage 3.0.2 on Mac OSX) --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: getting a list of points from a plot
Dan Drake wrote: > On Wed, 27 Aug 2008 at 05:18PM -0700, Mike Hansen wrote: >> Hi Dan, >> >> On Wed, Aug 27, 2008 at 5:13 PM, Dan Drake <[EMAIL PROTECTED]> wrote: >>> The "Plotting functions with asymptotes" thread reminded me of something >>> I've wondered for a while: is it possible to get access to the list of >>> points that a plot object uses? It's easy enough to make up my own list, >>> with something like >>> >>> ... >>> >>> Is this possible right now? Or do I smell a trac ticket? :) >>> >>> Dan >> You can get at this now. >> >> sage: p = plot(sin, -4, 4) >> sage: p[0].xdata[:5] >> >> [-4.0, >> -3.9983470781843895, >> -3.9966941563687794, >> -3.9950412345531694, >> -3.9933883127375589] > > Excellent! I see there is also a ydata. > > For the sake of the hive mind, here's how to achieve what I was asking > for. TikZ wants a file with each line an (x,y) pair with a space between > them. (See section 18.4 of the PGF/TikZ manual.) So you can do: > > f = open('somefile', 'w') > points = plot(sin, -4, 4)[0] > f.write('# Plot of sine from -4 to 4.\n') > for point in zip(points.xdata, points.ydata): > f.write('%f %f\n' % point) > f.close() > > and then in your document, do this inside a TikZ picture: > > \tikz \draw plot[smooth] file {somefile}; That's great! Is there any chance of making this some sort of \sagetikzplot command in sagetex? I suppose right now you could put that code in a hidden sage block in your file. Thanks, Jason --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Erratic behaviour with "Evaluate All" in a notebook
I have seen this as well, and almost all my worksheets use the %hide command within the first few cells. I don't seem to have this problem when I don't hide the first few cells. I am only using Firefox 2.0.0.16 for Windows XP and Sage 3.1.1. --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: failed to upgrade... again
ah, ok, m4 was just plain missing. I've installed it, the rest was there, let me try again ! On Aug 28, 3:32 pm, "William Stein" <[EMAIL PROTECTED]> wrote: > On Thu, Aug 28, 2008 at 6:27 AM, Pierre <[EMAIL PROTECTED]> wrote: > > > I'm on sage 3.0.2 on ubuntu, i've tried sage --upgrade and got this: > > > checking for suitable m4... configure: error: No usable m4 in $PATH > > or /usr/5bin (see config.log for reasons). > > Failed to configure. > > > i can't find the file config.log anyway. > > > help ? > > You should not consider using "sage -upgrade" unless you install the > following linux programs first: > > gcc, g++, make, m4, perl, ranlib, and tar. > > William --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Plotting functions with asymptotes
Thanks for the replies (and the great work!). Some followup below: > Nope, none of these are fixed by the new changes. I tried Maple and > it did the same thing -- I don't know what Mathematica does. You can > do these as a workaround: > Interesting that Maple does it. Anyone know about Mma? Mac's Grapher definitely IS smart about this, rather elegantly so. > sage: plot(tan,-20,20).show(ymin=-5, ymax=5) > sage: plot((x-1)/(x+2),-4,4).show(ymin=-10, ymax=10) > Of course, these plots still have the Intermediate Value Property on the entire real line. > I don't know the best way to be "smart" about fixing this such as how > much of the asymptote to include, etc. Yeah, I was thinking about this, because what you would really want to do is have an algorithm which would automatically check if the 'bend' was too great compared to the rest of the function and then NOT plot the line connecting those points. But would that slow plotting down too much (since you'd have to compare *all* the bends to each other, not just to max_bend like in adaptive refinement, as I understand it)? Not to mention trying to decide what "too great compared" means. Speaking of asymptotes, any ideas on http://trac.sagemath.org/sage_trac/ticket/3907 ? I would be glad to try it, but don't understand enough of how infinity and _tasteful_ticks work in Sage. > > 1) It would be useful for those involved to put a summary of the > > plotting improvements/changes in internals on a wiki page, once the > > whole overhaul is complete. > > I'll do this in the next day or two. Thanks. > > > 2) Specifically, will the old syntax plot(sin,-5,5) continue to be > > valid under the new plot(sin,(-5,5)) syntax, or will it be completely > > deprecated? Despite the logic of the new syntax, the old one is > > REALLY convenient and intuitive, and it would be a shame to have to > > change all those old worksheets... > > plot(sin, -5, 5) still works. > Very good! Any ideas on why plot(2*sin, -5, 5) doesn't (see http://trac.sagemath.org/sage_trac/ticket/3906)? Again, I'd be glad to help if I understood anything of the symbolics. - kcrisman --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: failed to upgrade... again
On Thu, Aug 28, 2008 at 6:27 AM, Pierre <[EMAIL PROTECTED]> wrote: > > I'm on sage 3.0.2 on ubuntu, i've tried sage --upgrade and got this: > > checking for suitable m4... configure: error: No usable m4 in $PATH > or /usr/5bin (see config.log for reasons). > Failed to configure. > > i can't find the file config.log anyway. > > help ? You should not consider using "sage -upgrade" unless you install the following linux programs first: gcc, g++, make, m4, perl, ranlib, and tar. William --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] failed to upgrade... again
I'm on sage 3.0.2 on ubuntu, i've tried sage --upgrade and got this: checking for suitable m4... configure: error: No usable m4 in $PATH or /usr/5bin (see config.log for reasons). Failed to configure. i can't find the file config.log anyway. help ? --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: How to get *nice* html output?
Dear Martin, On Aug 28, 12:44 pm, Martin Albrecht <[EMAIL PROTECTED]> wrote: > I'd expect that too, however the purpose could be something completely > different which could conflict with that behavior. I played around a little bit, and in fact html(X) uses the method X.__html__() if it exists. However, it does not return a string but only *prints* things. I guess this is of use in the notebook, not for creating web pages (which is what i am doing). Cheers Simon --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: How to get *nice* html output?
> What does html() exactly do? According to the doc string, its argument > must be a string. > It seems to me that it just garnishes the string with ` color='black'>` and ``. It seems that way, check sage.misc.html for implementation details. > And this is surprising to me. My expectation was that html(X) takes > any object X, tests whether it has a certain special method (say, > `__html__`) for making use of it, and only if the special method isn't > there, it returns something based on str(X). I'd expect that too, however the purpose could be something completely different which could conflict with that behavior. Martin -- name: Martin Albrecht _pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99 _www: http://www.informatik.uni-bremen.de/~malb _jab: [EMAIL PROTECTED] --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: converting between lists and vectors?
There are two separate things going on here. I think this is a bug: sage: vector(range(3)) TypeError: unable to find a common ring for all elements since this does work: sage: vector(srange(3)) (0, 1, 2) The difference is that the elements of range(3) are python ints while the elements of srange(3) are Sage Integers. It also works if you specify the coordinate ring: sage: vector(RR,range(3)) (0.000, 1.00, 2.00) sage: vector(ZZ,range(3)) (0, 1, 2) The problem lies in the function prepare() in sage/modules/free_module_element.pyx, since Sequence(range(3)) has universe and is_Ring() fails on that. The fix would therefore appear to be to test for the case where the universe is and change it to ZZ. The second issue is just that after w=range(3), w is a python list, and for lists, multiplying by 2 just repeats the list. Similarly sage: range(3) + range(3) [0, 1, 2, 0, 1, 2] If you want to do mathematical operations such as scalar multiplcation, convert to a vector. (You could also do [2*i for i in range(3)], but I don't think you like that construction.) I have CC's this to sage-devel so that the bug will be fixed (if people agree with me that i is a bug). John Cremona 2008/8/28 Stan Schymanski <[EMAIL PROTECTED]>: > Dear all, > > I use pylab for plotting, which requires creating lists of x and y > values. Now, in order to manipulate the lists, I would like to perform > simple operations on them, like for example multiply by 2. However, > lists seem to behave very differently to vectors when performing > mathematical operations on them (see below). Is there an easy way of > converting between lists and vectors to use them in mathematical > computations without having to loop through all elements? Intuitively, > I thought that vector(list) would work to convert a list to a vector, > but it does not (see below). > > Thanks already for your help, and I'm sorry if I missed this issue in > the documentation. > > Stan > > -- > | SAGE Version 3.1.1, Release Date: 2008-08-17 | > | Type notebook() for the GUI, and license() for information.| > -- > > sage: v = vector([1,2,3]); v > (1, 2, 3) > sage: 2*v > (2, 4, 6) > sage: w=range(1,4); w > [1, 2, 3] > sage: 2*w > [1, 2, 3, 1, 2, 3] > sage: w1=vector(w) > --- > TypeError Traceback (most recent call > last) > > /Users/sschym/modelling/VegPat/ in () > > /Users/sschym/modelling/VegPat/free_module_element.pyx in > sage.modules.free_module_element.vector (sage/modules/ > free_module_element.c:2376)() > > /Users/sschym/modelling/VegPat/free_module_element.pyx in > sage.modules.free_module_element.prepare (sage/modules/ > free_module_element.c:2622)() > > TypeError: unable to find a common ring for all elements > > > > --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] converting between lists and vectors?
Dear all, I use pylab for plotting, which requires creating lists of x and y values. Now, in order to manipulate the lists, I would like to perform simple operations on them, like for example multiply by 2. However, lists seem to behave very differently to vectors when performing mathematical operations on them (see below). Is there an easy way of converting between lists and vectors to use them in mathematical computations without having to loop through all elements? Intuitively, I thought that vector(list) would work to convert a list to a vector, but it does not (see below). Thanks already for your help, and I'm sorry if I missed this issue in the documentation. Stan -- | SAGE Version 3.1.1, Release Date: 2008-08-17 | | Type notebook() for the GUI, and license() for information.| -- sage: v = vector([1,2,3]); v (1, 2, 3) sage: 2*v (2, 4, 6) sage: w=range(1,4); w [1, 2, 3] sage: 2*w [1, 2, 3, 1, 2, 3] sage: w1=vector(w) --- TypeError Traceback (most recent call last) /Users/sschym/modelling/VegPat/ in () /Users/sschym/modelling/VegPat/free_module_element.pyx in sage.modules.free_module_element.vector (sage/modules/ free_module_element.c:2376)() /Users/sschym/modelling/VegPat/free_module_element.pyx in sage.modules.free_module_element.prepare (sage/modules/ free_module_element.c:2622)() TypeError: unable to find a common ring for all elements --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: How to get *nice* html output?
On Aug 28, 10:45 am, Martin Albrecht <[EMAIL PROTECTED]> wrote: > Then I don't know. I suppose it is NotImplementedError. Ok. What does html() exactly do? According to the doc string, its argument must be a string. It seems to me that it just garnishes the string with `` and ``. And this is surprising to me. My expectation was that html(X) takes any object X, tests whether it has a certain special method (say, `__html__`) for making use of it, and only if the special method isn't there, it returns something based on str(X). Best regards Simon --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Position of "evaluate" button
On Aug 28, 3:20 am, Kwankyu <[EMAIL PROTECTED]> wrote: > The "evaluate" button sitting just below ...somewhat irritates eyes. Hi, i think i already told someone that this is a bad ui design. I even don't understand why it is disappearing at all... h --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Position of "evaluate" button
Hi, The "evaluate" button sitting just below the active cell in a notebook causes some irritation. It appears and disappears as a particular cell becomes active and inactive, causing any output text below the cell to move a bit up and down. This somewhat irritates eyes. I suggest to leave a small area of fixed size beginning each cell to store the "evaluate" button (I think this should be an icon rather than a text) and possibly also other buttons to facilitate some useful functions relating to cells, such as grouping cells to merge (like in Mathematica). Input cells usually contain short texts, so I think saving such a small area for this purpose is not a bit deal. Kwankyu --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: How to get *nice* html output?
On Thursday 28 August 2008, Simon King wrote: > On Aug 28, 10:37 am, Martin Albrecht <[EMAIL PROTECTED]> > > wrote: > > Shouldn't view(p) do the job by typesetting it with jsMath? > > I don't want it to pop up -- i only need the string. Then I don't know. I suppose it is NotImplementedError. Martin -- name: Martin Albrecht _pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99 _www: http://www.informatik.uni-bremen.de/~malb _jab: [EMAIL PROTECTED] --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: How to get *nice* html output?
On Aug 28, 10:37 am, Martin Albrecht <[EMAIL PROTECTED]> wrote: > Shouldn't view(p) do the job by typesetting it with jsMath? I don't want it to pop up -- i only need the string. Cheers Simon --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: How to get *nice* html output?
On Thursday 28 August 2008, Simon King wrote: > Dear all, > > sage: R.=GF(5)[] > sage: p=R.random_element() > sage: html(p) > x^2 - 2*y*z + z^2 - 2*y > > Is there an easy way to have an output that will appear in the browser > as a polynomial with proper exponents (such as x2 - ... + > z2...) ? Shouldn't view(p) do the job by typesetting it with jsMath? Martin -- name: Martin Albrecht _pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99 _www: http://www.informatik.uni-bremen.de/~malb _jab: [EMAIL PROTECTED] --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Erratic behaviour with "Evaluate All" in a notebook
Hi Timothy, Thanks for following this up. Your code works for me, too. However, if I create cells with: %hide %html For testing purposes: - Evaluate- var('ab av jbiom lwat p rwat biom veloc mort epot esv etv esb etb wv wb qbv qvb bv') -Evaluate- dwaterv = (av*p - esv - etv - qvb + qbv) dwaterb = (ab*p - esb + qvb - qbv) -Evaluate- Then, I do Action... -> Restart worksheet and then Action... -> Evaluate All I get the Traceback error about not defined variables. Note that the Restart worksheet is important to reproduce this error. Also, I wonder if it could have something to do with the %hide command... I am using Firefox 3.0.1 on Mac OS 10.4.11 and sage 3.1.1. Cheers, Stan --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] How to get *nice* html output?
Dear all, sage: R.=GF(5)[] sage: p=R.random_element() sage: html(p) x^2 - 2*y*z + z^2 - 2*y Is there an easy way to have an output that will appear in the browser as a polynomial with proper exponents (such as x2 - ... + z2...) ? Cheers Simon --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---