[sage-support] installation problems for Sage binary on Mac
I installed the Sage 4.3.1. binary in the Applications folder on my MacBook Air. I am running Mac OSX 10.5.8. I have tired installing both by dragging the image into the applications folder and also by using the copy command explicitly. Double-clicking the Sage icon (as instructed in the file sage-README-osx.txt) leads to the error message below. Suggestions gratefully accepted. Mark Mueller Last login: Sat Jan 23 16:38:11 on ttys000 /Applications/sage/sage ; exit; mark-muellers-macbook-air:~ markmueller$ /Applications/sage/sage ; exit; -- | Sage Version 4.3.1, Release Date: 2010-01-20 | | Type notebook() for the GUI, and license() for information.| -- dyld: unknown required load command 0x8022 /Applications/sage/local/bin/sage-sage: line 159: 4844 Trace/BPT trap "$SAGE_ROOT/local/bin/"sage-location logout [Process completed] -- 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] @interact with non-Sage objects
Hello, Is it possible to use the @interact with the following code-snippet? I want experiment with distributions functions that Scipy have but not in Sage. Thanks from scipy import stats import numpy as np import matplotlib.pyplot as plt @interact def plot_norm(loc=(0,(0,10)), scale=(1,(1,10))): rv = stats.norm(loc, scale) x = np.linspace(0,10) plt.plot(x,rv.pdf(x)) plt.show() -- 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] installation problems for Sage binary on Mac
Do you know which exact binary you downloaded? On Jan 23, 2010, at 2:02 PM, Mark Mueller wrote: I installed the Sage 4.3.1. binary in the Applications folder on my MacBook Air. I am running Mac OSX 10.5.8. I have tired installing both by dragging the image into the applications folder and also by using the copy command explicitly. Double-clicking the Sage icon (as instructed in the file sage-README-osx.txt) leads to the error message below. Suggestions gratefully accepted. Mark Mueller Last login: Sat Jan 23 16:38:11 on ttys000 /Applications/sage/sage ; exit; mark-muellers-macbook-air:~ markmueller$ /Applications/sage/sage ; exit; -- | Sage Version 4.3.1, Release Date: 2010-01-20 | | Type notebook() for the GUI, and license() for information.| -- dyld: unknown required load command 0x8022 /Applications/sage/local/bin/sage-sage: line 159: 4844 Trace/BPT trap "$SAGE_ROOT/local/bin/"sage-location logout [Process completed] -- 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
[sage-support] Re: @interact with non-Sage objects
Last line must be plt.savefig('plt.png') and not .show() because you are on a website and saved files are shown. When I tried it first, it didn't update the image because it was somehow locally cached. On second try it worked ... H -- 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: installation problems for Sage binary on Mac
I downloaded sage-4.3.1-OSX-10.6-i386-Darwin.dmg copied the contents to my disk and tried to execute sage. I received the messages -- | Sage Version 4.3.1, Release Date: 2010-01-20 | | Type notebook() for the GUI, and license() for information.| -- env: python: Bad CPU type in executable logout Mac Mini 1.66GHz Core 2 MacOS X 10.6.2 On Jan 24, 12:39 pm, Robert Bradshaw wrote: > Do you know which exact binary you downloaded? > > On Jan 23, 2010, at 2:02 PM, Mark Mueller wrote: > > > I installed the Sage 4.3.1. binary in the Applications folder on my > > MacBook Air. I am running Mac OSX 10.5.8. I have tired installing > > both by dragging the image into the applications folder and also by > > using the copy command explicitly. Double-clicking the Sage icon (as > > instructed in the file sage-README-osx.txt) leads to the error > > message below. > > > Suggestions gratefully accepted. > > > Mark Mueller > > > Last login: Sat Jan 23 16:38:11 on ttys000 > > /Applications/sage/sage ; exit; > > mark-muellers-macbook-air:~ markmueller$ /Applications/sage/sage ; > > exit; > > -- > > | Sage Version 4.3.1, Release Date: 2010-01-20 | > > | Type notebook() for the GUI, and license() for information. | > > -- > > dyld: unknown required load command 0x8022 > > /Applications/sage/local/bin/sage-sage: line 159: 4844 Trace/BPT > > trap "$SAGE_ROOT/local/bin/"sage-location > > logout > > > [Process completed] > > > -- > > 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 > > athttp://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
[sage-support] Re: installation problems for Sage binary on Mac
On Jan 24, 6:38 am, "davidgal...@gmail.com" wrote: > I downloaded > > sage-4.3.1-OSX-10.6-i386-Darwin.dmg This is for OS X 10.6. If you're running OS X 10.5.8, you shouldn't expect this one to work for you. -- John -- 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: @interact with non-Sage objects
On Jan 24, 5:49 am, Harald Schilly wrote: > Last line must be plt.savefig('plt.png') and not .show() because you > are on a website and saved files are shown. When I tried it first, it > didn't update the image because it was somehow locally cached. On > second try it worked ... > > H Thanks this helped. Adding a plt.clf() clear the figure after each plot update. -- 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] SAGE gives the following ERROR when working with strings? Is this normal.
| Sage Version 4.2.1, Release Date: 2009-11-14 | Hi, I was trying the code below and I was wondering how not to get an ERROR. ~Alex | Type notebook() for the GUI, and license() for information.| -- sage: STR = 'ABCDEF' sage: str = 'abcdef' sage: for a in range(0, 5): STR[a] 'A' 'B' 'C' 'D' 'E' sage: for aa in range(0, 5): STR[aa] 'A' 'B' 'C' 'D' 'E' -- 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] SAGE gives the following ERROR when working with strings? Is this normal.
Hi Alex, On Mon, Jan 25, 2010 at 3:48 AM, Alex P wrote: > | Sage Version 4.2.1, Release Date: 2009-11-14 | > Hi, > I was trying the code below and I was wondering how not to get an > ERROR. > ~Alex > > > | Type notebook() for the GUI, and license() for information.| > -- > sage: STR = 'ABCDEF' > sage: str = 'abcdef' "str" is a built-in function of Python, so you should avoid re-assigning "str" to anything. See http://docs.python.org/library/stdtypes.html#string-methods for more information on "str". I don't get the error you reported at all: [mv...@sage sage-4.2.1]$ ./sage -- | Sage Version 4.2.1, Release Date: 2009-11-14 | | Type notebook() for the GUI, and license() for information.| -- sage: STR = "ABCDEF" sage: str = "abcdef" sage: for a in range(0, 5): : STR[a] : 'A' 'B' 'C' 'D' 'E' sage: for aa in range(0, 5): : str[aa] : 'a' 'b' 'c' 'd' 'e' However, you can also do this: sage: mySTR = "ABCDEF" sage: mystr = "abcdef" sage: for s in mySTR: : print s : A B C D E F sage: for ss in mystr: : print ss : a b c d e f -- Regards Minh Van Nguyen -- 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: @interact with non-Sage objects
On Jan 24, 5:06 pm, gsever wrote: > Thanks this helped. Adding a plt.clf() clear the figure after each > plot update. no problem, and i looked for a .reset or similar, thanks for the .clr ()! Can you post this somewhere to the wiki.sagemath.org/interact/graphics (or a better topic?) as an example how to do interact with matplotlib directly? TIA, H! -- 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] Getting 'partial' rather than 'D' notation for derivatives
It seems to me I saw information somewhere on how to get: foo=function('foo',x,y) latex(diff(foo,y)) To give the 'partial' notation rather than 'D' notation. I hope that makes sense. The idea is that I'd like something on the order of "\frac{\partial}{\partial y} foo" ... Anyway, I can't find the information about this now, and I wonder if someone could point me to the relevant documentation or thread. Thanks! -Mike -- 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: @interact with non-Sage objects
On Jan 24, 11:14 am, Harald Schilly wrote: > On Jan 24, 5:06 pm, gsever wrote: > > > Thanks this helped. Adding a plt.clf() clear the figure after each > > plot update. > > no problem, and i looked for a .reset or similar, thanks for the .clr > ()! > Can you post this somewhere to the wiki.sagemath.org/interact/graphics > (or a better topic?) as an example how to do interact with matplotlib > directly? > TIA, H! Added as first wiki entry :) http://wiki.sagemath.org/interact/graphics#Interactwithmatplotlib Will also cross-post at matplotlib, numpy and scipy users. I didn't know I am the first officially documenting this. Thanks for your help -- 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: @interact with non-Sage objects
On Jan 24, 6:50 pm, gsever wrote: > Added as first wiki entry :) No problem, and i hope it's ok that i pushed you to do it ;) http://twitter.com/sagemath/status/8158003421 -- 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] cancellation in fraction fields
Hi, I'm working with fraction fields of multivariate polynomials ring with coefficients in Q. My question is, how do I get cancellation between numerator and denominator coefficients to work? Example: R.=PolynomialRing(QQ, 2) F=FractionField(R) f=(x/2)/(y/2) My question is, how do I get the representation of f to simplify to x/y? The reduce method doesn't do it. Stefan -- 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] cancellation in fraction fields
Hello, On Sun, Jan 24, 2010 at 12:02 PM, Stefan Boettner wrote: > I'm working with fraction fields of multivariate polynomials ring with > coefficients in Q. My question is, how do I get cancellation between > numerator and denominator coefficients to work? > > Example: > > R.=PolynomialRing(QQ, 2) > F=FractionField(R) > > f=(x/2)/(y/2) There isn't really a good way to do this right now. But, you're probably better off using Frac(Z['x,y']): sage: R = Frac(ZZ['x,y']) sage: x,y = R.gens() sage: (x/2)/(y/2) x/y --Mike -- 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] cancellation in fraction fields
On Sun, Jan 24, 2010 at 12:08 PM, Mike Hansen wrote: > Hello, > > On Sun, Jan 24, 2010 at 12:02 PM, Stefan Boettner wrote: >> I'm working with fraction fields of multivariate polynomials ring with >> coefficients in Q. My question is, how do I get cancellation between >> numerator and denominator coefficients to work? >> >> Example: >> >> R.=PolynomialRing(QQ, 2) >> F=FractionField(R) >> >> f=(x/2)/(y/2) > > There isn't really a good way to do this right now. But, you're > probably better off using Frac(Z['x,y']): > > sage: R = Frac(ZZ['x,y']) > sage: x,y = R.gens() > sage: (x/2)/(y/2) > x/y Here's a potentially good way to do this right now :-) Define this function: def normalize_denoms(f): n, d = f.numerator(), f.denominator() a = [vector(x.coefficients()).denominator() for x in [n,d]] return (n*a[0])/(d*a[1]) Then: sage: R.=PolynomialRing(QQ, 2) sage: F=FractionField(R) sage: f=(x/2)/(3*y/17) sage: f 1/2*x/(3/17*y) sage: normalize_denoms(f) x/(3*y) -- 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] axis labels using sagenb
Is there any flexibility on where axis labels are placed? I'd like to see them under the x axis and vertically along the y. Seems like there should be more than just axes_labels= tag. Thanks, -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
[sage-support] Re: Getting 'partial' rather than 'D' notation for derivatives
On Jan 24, 9:29 am, Mike Witt wrote: > To give the 'partial' notation rather than 'D' notation. > I hope that makes sense. The idea is that I'd like something on > the order of "\frac{\partial}{\partial y} foo" ... > > Anyway, I can't find the information about this now, and I wonder > if someone could point me to the relevant documentation or thread. This was discussed before in: http://groups.google.ca/group/sage-support/browse_thread/thread/d7520e53b492f878/0dfb76b4d21dbb47 The problem arises when you want to print: D[0](f)(g(x,y),h(x,y)) In this situation, the "first variable" for f does not have a natural name, so it is hard to come up with a sensible "partial derivative" print form. Earlier threads already pointed out that even cases like D[0](f)(x,h(x,y)) do not equal the simplistic guess (df/dx)(x,h(x,y)). The chain rule really is the culprit here. The form (df/du1)(u1,u2)|_{\{u1=x,u2=h(x,y)\}} would be a possibility and could be done with some default choice for the variable name (here u). The code could then develop further by adding heuristics for choosing more sensible variable names and situations where the "evaluated at" clause can be collapsed. -- 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] Error while integrating a form of gamma distribution
Hello, Please see my published test notebook at: http://www.sagenb.org/home/pub/1408/ variable of integration must be a simple or subscripted variable I can get this form integrating properly, and resulting with expected gamma(nu)/(alpha^nu*s) f(x) = (mu/s)*x**(nu*mu-1)*exp(-alpha*x**mu) s = integrate(f(x),(x,0,infinity)) However when I do two simple substitutions with: f(D) = f(x) / Dn x = D/Dn p = integrate(f(D),((D/Dn),0,infinity)) This yields with an error Maxima ERROR: defint: variable of integration must be a simple or subscripted variable. defint: found D/Dn -- an error. To debug this try: debugmode(true); The two form is different than each other by just one variable substitution, and they should yield the same result. Any ideas how to fix this issue? 2nd question: Is there a way to combine assumptions? Can I make an assumption like assume(mu, 'positive integer')? Thanks. -- 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] bug in numerical approximation?
Hi all: Am i doing something wrong, or does the example below demonstrate a bug in Sage's n() function? Alex -- | Sage Version 4.3, Release Date: 2009-12-24 | | Type notebook() for the GUI, and license() for information.| -- WARNING: There is one major unsolved bug in some versions of Sage on OS X 10.6 that causes an 'Abort trap' crash when doing certain symbolic computations. See http://trac.sagemath.org/sage_trac/ticket/7095/. sage: a= gamma(1/3) sage: a.n() 2.67893853470775 sage: f= a*x sage: c=f.coefficients(); c [[gamma(1/3), 1]] sage: c[0][0].n() --- TypeError Traceback (most recent call last) /Users/raichev/ in () /Applications/sage/local/lib/python2.6/site-packages/sage/symbolic/ expression.so in sage.symbolic.expression.Expression.n (sage/symbolic/ expression.cpp:15928)() TypeError: cannot evaluate symbolic expresssion numerically 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
[sage-support] Re: @interact with non-Sage objects
On Jan 24, 12:39 pm, Harald Schilly wrote: > On Jan 24, 6:50 pm, gsever wrote: > > > Added as first wiki entry :) > > No problem, and i hope it's ok that i pushed you to do it ;) > > http://twitter.com/sagemath/status/8158003421 It was my pleasure Harald. Sage is one of the well designed approaches to blur the boundaries among being a user, developer and contributor in the open-source ecosystem. Probably I will be hanging around for a long time be it bugging, complaining, documenting, adding content and eventually digging into source codes ;) -- 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: cancellation in fraction fields
On Jan 24, 9:17 pm, William Stein wrote: > > Here's a potentially good way to do this right now :-) > > Define this function: > > def normalize_denoms(f): > n, d = f.numerator(), f.denominator() > a = [vector(x.coefficients()).denominator() for x in [n,d]] > return (n*a[0])/(d*a[1]) > > Then: > > sage: R.=PolynomialRing(QQ, 2) > sage: F=FractionField(R) > sage: f=(x/2)/(3*y/17) > sage: f > 1/2*x/(3/17*y) > sage: normalize_denoms(f) > x/(3*y) I guess you meant: sage: def normalize_denoms(f): n, d = f.numerator(), f.denominator() a = lcm([vector(x.coefficients()).denominator() for x in [n,d]]) return (n*a)/(d*a) We then obtain: sage: R.=PolynomialRing(QQ, 2) sage: F=FractionField(R) sage: f=(x/2)/(3*y/17) sage: f 1/2*x/(3/17*y) sage: normalize_denoms(f) 17*x/(6*y) which seems to be a better result to me... -- 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: cancellation in fraction fields
On Sun, Jan 24, 2010 at 3:45 PM, Yann wrote: > > > On Jan 24, 9:17 pm, William Stein wrote: >> >> Here's a potentially good way to do this right now :-) >> >> Define this function: >> >> def normalize_denoms(f): >> n, d = f.numerator(), f.denominator() >> a = [vector(x.coefficients()).denominator() for x in [n,d]] >> return (n*a[0])/(d*a[1]) >> >> Then: >> >> sage: R.=PolynomialRing(QQ, 2) >> sage: F=FractionField(R) >> sage: f=(x/2)/(3*y/17) >> sage: f >> 1/2*x/(3/17*y) >> sage: normalize_denoms(f) >> x/(3*y) > > I guess you meant: > > sage: def normalize_denoms(f): > n, d = f.numerator(), f.denominator() > a = lcm([vector(x.coefficients()).denominator() for x in [n,d]]) > return (n*a)/(d*a) > > We then obtain: > > sage: R.=PolynomialRing(QQ, 2) > sage: F=FractionField(R) > sage: f=(x/2)/(3*y/17) > sage: f > 1/2*x/(3/17*y) > sage: normalize_denoms(f) > 17*x/(6*y) > > which seems to be a better result to me... Yes, of course. Thanks. I was getting rid of the denoms at the expense of computing a different fraction! -- William -- 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] plot/show bug in plotting of DiGraphs for macs?
Hi: The latest bug fix for plotting a digraph seems to be http://trac.sagemath.org/sage_trac/ticket/5620 Using a 10.6.2 mac (and sage-4.3.1.a5), I am finding that (for example) sage: D = DiGraph( { "A": ["B","C"], "B": ["C","D"], "C": ["B","D","E"], "D": ["E"], "E": ["D"]} ) sage: D.plot() yields a blank graph sage: D = DiGraph( { "A": ["B","C"], "B": ["C","D"], "C": ["B","D","E"], "D": ["E"], "E": ["D"]} ) sage: D.plot3d() plots fine (I guess) but with no vertex labels. Is this a bug? Also, sage: A = matrix([[0,10,3,0,0],[0,0,1,2,0],[0,4,0,8,2],[0,0,0,0,7],[0,0,0,9,0]]) sage: DiGraph(A).plot() yields an empty plot. Is this a bug? - 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
Re: [sage-support] plot/show bug in plotting of DiGraphs for macs?
Hi David, On Mon, Jan 25, 2010 at 11:08 AM, David Joyner wrote: > Is this a bug? I don't think so. Using www.sagenb.org, I got plots [1] of the given digraphs. On bsd.math, I got similar results [2]. In both cases, some of the images are cropped so some part of a vertex is cut off. Ticket #7299 [3] is meant to fix the image cropping issue. [1] http://www.sagenb.org/home/pub/1409 [2] http://sage.math.washington.edu/home/mvngu/doc/screenshots/wdjoyner-2010-01-25/ [3] http://trac.sagemath.org/sage_trac/ticket/7299 -- Regards Minh Van Nguyen -- 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] bug in numerical approximation?
Alex Raichev schrieb: Hi, > Am i doing something wrong, or does the example below demonstrate a > bug in Sage's n() function? > sage: a= gamma(1/3) > sage: a.n() > 2.67893853470775 > sage: f= a*x > sage: c=f.coefficients(); c > [[gamma(1/3), 1]] > sage: c[0][0].n() > --- > TypeError Traceback (most recent call > last) > > /Users/raichev/ in () > > /Applications/sage/local/lib/python2.6/site-packages/sage/symbolic/ > expression.so in sage.symbolic.expression.Expression.n (sage/symbolic/ > expression.cpp:15928)() > > TypeError: cannot evaluate symbolic expresssion numerically > sage: I think this is an error in the communication between Maxima and Sage: sage: assume(x>0) sage: g = integrate(t^(x-1)*exp(-t),(t,0,infinity)) sage: g(3).n() --- TypeError Traceback (most recent call last) /home/felix/ in () /home/felix/Temp/sage-4.3/local/lib/python2.6/site-packages/sage/symbolic/expression.so in sage.symbolic.expression.Expression.n (sage/symbolic/expression.cpp:16166)() TypeError: cannot evaluate symbolic expresssion numerically sage: g(3) - gamma(3) gamma(3) - 2 sage: simplify(g(3) - gamma(3)) 0 Seems that SAGE treats the internal Gamma Function and Maximas Gamma Function in different ways. However I do unfortunatelly not understand enough of the interals, to see where the error arise from. Felix -- 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: cancellation in fraction fields
That sort of gets my expressions nicer. It doesn't quite solve the issue with the computation time but works for now. Would it be too difficult to have such fractions normalized automatically to some normal form, e.g. monic denominator polynomial, if the coefficient ring is a field? Thanks, Stefan Am 24.01.2010 um 17:51 schrieb William Stein: > On Sun, Jan 24, 2010 at 3:45 PM, Yann wrote: >> >> >> On Jan 24, 9:17 pm, William Stein wrote: >>> >>> Here's a potentially good way to do this right now :-) >>> >>> Define this function: >>> >>> def normalize_denoms(f): >>> n, d = f.numerator(), f.denominator() >>> a = [vector(x.coefficients()).denominator() for x in [n,d]] >>> return (n*a[0])/(d*a[1]) >>> >>> Then: >>> >>> sage: R.=PolynomialRing(QQ, 2) >>> sage: F=FractionField(R) >>> sage: f=(x/2)/(3*y/17) >>> sage: f >>> 1/2*x/(3/17*y) >>> sage: normalize_denoms(f) >>> x/(3*y) >> >> I guess you meant: >> >> sage: def normalize_denoms(f): >>n, d = f.numerator(), f.denominator() >>a = lcm([vector(x.coefficients()).denominator() for x in [n,d]]) >>return (n*a)/(d*a) >> >> We then obtain: >> >> sage: R.=PolynomialRing(QQ, 2) >> sage: F=FractionField(R) >> sage: f=(x/2)/(3*y/17) >> sage: f >> 1/2*x/(3/17*y) >> sage: normalize_denoms(f) >> 17*x/(6*y) >> >> which seems to be a better result to me... > > Yes, of course. Thanks. I was getting rid of the denoms at the > expense of computing a different fraction! > > -- William > > -- > 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] Re: cancellation in fraction fields
On Sun, Jan 24, 2010 at 8:40 PM, Stefan Boettner wrote: > That sort of gets my expressions nicer. It doesn't quite solve the issue with > the computation time but works for now. Did working over Frac(ZZ['x,y']) speed things up? --Mike -- 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