[sage-support] Re: solving for numeric values.
Hi, I tried solving a non-linear system to be able to get a plot of g against L as defined in the code below, I have used the solve command but failed and now I tried the find_root command, the below is the code and the first five result for E=0, but the other results are functions of L and g. What am I doing wrong? The code: from scipy import * var('L,g,E') w=2*pi.n() u=1/12 c_0 = 0.1 j = 20 AR=range (2,20,1) AR.reverse() print AR z=(g+u)^2 + j^2*w^2 -c_0*exp(-g*L)*(cos(j*w*L)*(g+u)-j*w*sin(j*w*L))/c_0*exp(-g*L)*(cos(j*w*L)* (g+u)-j*w*sin(j*w*L)) for k in AR: P=c_0*exp(-g*L)*(cos(k*w*L)*(g+u)-k*w*sin(k*w*L))/((g+u)^2+ k^2*w^2) Z = 1/P - 1 - (e^2/4)/z z = Z;z for E in arange (0.0,2.0,0.25): for L in range (0,5,1): b=((g+u)-c_0*exp^(-g*L))/c_0*exp^(-g*L) find_root(b-E^2/2*z==0,g) First set of result: [19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2] [g == 1/60] [g == (6 - 5*exp^g)/(60*exp^g)] [g == (6 - 5*exp^(2*g))/(60*exp^(2*g))] [g == (6 - 5*exp^(3*g))/(60*exp^(3*g))] [g == (6 - 5*exp^(4*g))/(60*exp^(4*g))] Thank you. Josephine. --~--~-~--~~~---~--~~ 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: cube roots
This debate has been going on for as long as computers have been in existence. Yes, there is a case to be made the odd roots of negative reals should return a negative real instead of the principal complex root. But that leads to more subtle problems in other places. If all of mathematica, maple and matlab do the non-obvious thing there must be a good reason for it! And as Mike said, you can always get the real root by inserting brackets. John Cremona On May 14, 6:56 am, Robert Bradshaw rober...@math.washington.edu wrote: On May 13, 2009, at 9:11 PM, Bill Page wrote: On Wed, May 13, 2009 at 11:54 PM, Robert Bradshaw wrote: This is because the branch in which the positive real root is real is taken. We're opting for continuity and consistency with complex numbers. If I wrote: sage: ComplexField(53)(-2.0)^(1/3) 0.629960524947437 + 1.09112363597172*I that looks ok to me, but sage: RealField(53)(-2.0)^(1/3) 0.629960524947437 + 1.09112363597172*I looks very strange. Could you explain the advantage? I can try :) sage: a -2.00 sage: a^(1/3) # what should happen here? The real field automatically promotes to complex in many instances (e.g. sqrt, or all other non-integral powers or negative numbers), so that's why I don't find it too strange. Also, it provides continuity in the exponent: sage: [(-2.0)^a for a in [0..1, step=1/10]] [1.00, 1.01931713553736 + 0.331196214043796*I, 0.929316490603148 + 0.675187952399881*I, 0.723648529606410 + 0.996016752925812*I, 0.407750368641006 + 1.25492659684357*I, 8.65956056235493e-17 + 1.41421356237309*I, -0.468382177707358 + 1.44153211743623*I, -0.954859959434831 + 1.31425198474794*I, -1.40858040033850 + 1.02339356496073*I, -1.77473421303888 + 0.576646101394740*I, -2.00] I would find it odd if every other value here were real. Note that we're not the only ones doing this: sage: mathematica((-2.0)^(1/3)) 0.6299605249474367 + 1.0911236359717214*I sage: maple((-2.0)^(1/3);) .6299605250+1.091123636*I sage: matlab((-2.0)^(1/3);) 0.6300 + 1.0911i sage: pari((-2.0)^(1/3);) 0.629960524947437 + 1.09112363597172*I - Robert --~--~-~--~~~---~--~~ 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: VMWare Player versions for Sage 3.4.1
2.5.1 for sure that work. I has using 2.5.2 (that works fine with sage 3.2.2) but it seems to keep sage 3.4.1 in a continuous loop when entering notebook option. Have you check if during instalation the authorizations to wmware networks adapters in the windows firewall? On May 13, 9:18 pm, kilucas kevin.lu...@concave.co.uk wrote: I've had two attempts at installing the VMWare Player v2.5.2 on a Windows XP Pro PC. Both times the Player will not start correctly - it crashes Windows almost immediately the player has started. So I'm not even getting as far as starting Sage. So I'm tempted to try earlier versions of the VMWare Player but wasn't sure which I'd need for Sage 3.4.1. Options seem to include VMWare Player 2.5.1, 2.5.0 and then 2.0.5 and earlier. Can anyone say which versions of the Player should be compatible with Sage 3.4.1 please? Many thanks for your help. Kevin --~--~-~--~~~---~--~~ 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: VMWare Player versions for Sage 3.4.1
On May 14, 10:43 am, Alberto vand...@gmail.com wrote: 2.5.1 for sure that work. I has using 2.5.2 (that works fine with sage 3.2.2) but it seems to keep sage 3.4.1 in a continuous loop when entering notebook option. Interesting. I'll lok out for that when I get that far! Have you check if during instalation the authorizations to wmware networks adapters in the windows firewall? I wasn't asked for any authorizations by VMWare during the installation which actually asks me very little indeed - just about where I want the installation and what menu start/desktop menu options I want. I was asked by ZoneAlarm which is my firewall as you indicate. This detected two new networks, both of which I said I trusted. I get no firewall notifications when I actually try to start the VMWare player and even tried to start it with the firewall switched off but it still forced my PC to reboot. I did get a tray icon indicating VMNet was trying to acquire a network address for about 10 minutes after I'd done the requested post- installation restart. Then the icon went away. I've used the same installation file on an alternative WinXP PC and that doesn't crash windows (and didn't generate the network acquisition icon). This PC does not run ZoneAlarm so maybe there's a challenge with ZA. I've posted my problems on the VMWare forum for the Player and may learn more through them too. But meanwhile I wondered if a change of Player version might help. Given your comment above I may try v 2.5.1. Thanks On May 13, 9:18 pm, kilucas kevin.lu...@concave.co.uk wrote: I've had two attempts at installing the VMWare Player v2.5.2 on a Windows XP Pro PC. Both times the Player will not start correctly - it crashes Windows almost immediately the player has started. So I'm not even getting as far as starting Sage. So I'm tempted to try earlier versions of the VMWare Player but wasn't sure which I'd need for Sage 3.4.1. Options seem to include VMWare Player 2.5.1, 2.5.0 and then 2.0.5 and earlier. Can anyone say which versions of the Player should be compatible with Sage 3.4.1 please? Many thanks for your help. Kevin- Hide quoted text - - Show quoted text - --~--~-~--~~~---~--~~ 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Simplification
Hello x,y=var('x,y') s = x*y2 + x*(-y2 - x2 + 1) + x3 - x print simplify(s) Answer : 2 22 3 x y + x (- y - x + 1) + x - x + I'm quite disappointed that Sage do not notice that s=0. Do I miss something ? Btw, the function simplify_full does not exist ... so I suppose that I *do* miss something. My version is extracted from the tar.gz downloaded from the website : | Sage Version 3.4.1, Release Date: 2009-04-21 | | Type notebook() for the GUI, and license() for information.| -- Should I install some additional proposed packages ? http://www.sagemath.org/download-packages.html Thanks Laurent --~--~-~--~~~---~--~~ 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Simplification
On May 14, 3:57 am, Laurent moky.m...@gmail.com wrote: Hello Hi Laurent, x,y=var('x,y') s = x*y2 + x*(-y2 - x2 + 1) + x3 - x print simplify(s) Answer : 2 2 2 3 x y + x (- y - x + 1) + x - x + I'm quite disappointed that Sage do not notice that s=0. Do I miss something ? Btw, the function simplify_full does not exist ... so I suppose that I *do* miss something. Yes, it does exist for me :) -- | Sage Version 3.4.2, Release Date: 2009-05-04 | | Type notebook() for the GUI, and license() for information.| -- sage: x,y=var('x,y') sage: s = x*y^2 + x*(-y^2 - x^2 + 1) + x^3 - x; s x*y^2 + x*(-y^2 - x^2 + 1) + x^3 - x sage: s.simplify() x*y^2 + x*(-y^2 - x^2 + 1) + x^3 - x sage: s.simplify_full() 0 My version is extracted from the tar.gz downloaded from the website : | Sage Version 3.4.1, Release Date: 2009-04-21 | | Type notebook() for the GUI, and license() for information. | -- Should I install some additional proposed packages ?http://www.sagemath.org/download-packages.html Thanks Laurent Cheers, Michael --~--~-~--~~~---~--~~ 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Simplification
Dear Laurent, On May 14, 12:57 pm, Laurent moky.m...@gmail.com wrote: Btw, the function simplify_full does not exist ... so I suppose that I *do* miss something. Yes. simplify_full is not a function but a method (after all, python is object oriented). So, you can do: sage: x,y=var('x,y') sage: s = x*y^2 + x*(-y^2 - x^2 + 1) + x^3 - x sage: s x*y^2 + x*(-y^2 - x^2 + 1) + x^3 - x sage: s.simplify_full() 0 Btw, for getting a list of methods, the TAB-Key helps. For example, type in sage: s.sim and press the TAB-key. Then a list appears: s.simplify s.simplify_log s.simplify_trig s.simplify_exp s.simplify_radical s.simplify_full s.simplify_rational And these are all attributes/methods of s whose names start with 'sim'. Best regards, Simon --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Simplification
On May 14, 2009, at 3:57 AM, Laurent wrote: Hello x,y=var('x,y') s = x*y2 + x*(-y2 - x2 + 1) + x3 - x print simplify(s) Answer : 2 22 3 x y + x (- y - x + 1) + x - x + I'm quite disappointed that Sage do not notice that s=0. Do I miss something ? Btw, the function simplify_full does not exist ... so I suppose that I *do* miss something. Simplification doesn't expand by default. This is by design (e.g. one might argue that (1+x)^100 is more simplified than its expanded form). However, Sage is able to tell that this is zero: sage: var('x,y') (x, y) sage: s = x*y^2 + x*(-y^2 - x^2 + 1) + x^3 - x sage: s.simplify() x*y^2 + x*(-y^2 - x^2 + 1) + x^3 - x sage: s.simplify_full() 0 sage: s.simplify_rational() 0 sage: s.expand() 0 Or over the (orders of magnitude faster) polynomial ring: sage: R.x,y = QQ[] sage: s = x*y^2 + x*(-y^2 - x^2 + 1) + x^3 - x; s 0 - Robert --~--~-~--~~~---~--~~ 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Simplification
On May 14, 12:57 pm, Laurent moky.m...@gmail.com wrote: Btw, the function simplify_full does not exist ... so I suppose that I *do* miss something. Yes. simplify_full is not a function but a method (after all, python is object oriented). Thanks all. Indeed, simplify_all(s) provokes an error while s.simplify_all() provides 0. Quite logical. I still have some psychological inability to speak with Sage as I speak with my python interpreter ;) Good afternoon Laurent --~--~-~--~~~---~--~~ 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: cube roots
On Thu, May 14, 2009 at 1:56 AM, Robert Bradshaw wrote: On May 13, 2009, at 9:11 PM, Bill Page wrote: On Wed, May 13, 2009 at 11:54 PM, Robert Bradshaw wrote: This is because the branch in which the positive real root is real is taken. We're opting for continuity and consistency with complex numbers. If I wrote: sage: ComplexField(53)(-2.0)^(1/3) 0.629960524947437 + 1.09112363597172*I that looks ok to me, but sage: RealField(53)(-2.0)^(1/3) 0.629960524947437 + 1.09112363597172*I looks very strange. Could you explain the advantage? I can try :) Thanks. I appreciate your willingness to re-hash this old subject. :-) sage: a -2.00 sage: a^(1/3) # what should happen here? The real field automatically promotes to complex in many instances (e.g. sqrt, or all other non-integral powers or negative numbers), so that's why I don't find it too strange. Also, it provides continuity in the exponent: sage: [(-2.0)^a for a in [0..1, step=1/10]] [1.00, 1.01931713553736 + 0.331196214043796*I, 0.929316490603148 + 0.675187952399881*I, 0.723648529606410 + 0.996016752925812*I, 0.407750368641006 + 1.25492659684357*I, 8.65956056235493e-17 + 1.41421356237309*I, -0.468382177707358 + 1.44153211743623*I, -0.954859959434831 + 1.31425198474794*I, -1.40858040033850 + 1.02339356496073*I, -1.77473421303888 + 0.576646101394740*I, -2.00] I would find it odd if every other value here were real. I would not find it odd and I guess in a way it is just a matter of taste. But 1/3 is an element of a Rational Field. It is not naturally continuous anyway. sage: b=1/3 sage: parent(b) Rational Field sage: (-2.0)^b ... On the other hand if I wrote: sage: b=1.0/3.0 sage: parent(b) Real Field with 53 bits of precision sage: (-2.0)^b 0.629960524947437 + 1.09112363597172*I I can explain this result as you indicate above. Note that we're not the only ones doing this: sage: mathematica((-2.0)^(1/3)) 0.6299605249474367 + 1.0911236359717214*I sage: maple((-2.0)^(1/3);) .6299605250+1.091123636*I sage: matlab((-2.0)^(1/3);) 0.6300 + 1.0911i sage: pari((-2.0)^(1/3);) 0.629960524947437 + 1.09112363597172*I The difference is that none of these system have the notion of type (or parent). Regards, Bill Page. --~--~-~--~~~---~--~~ 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: cube roots
On Thu, May 14, 2009 at 4:59 AM, John Cremona wrote: This debate has been going on for as long as computers have been in existence. Yes, there is a case to be made the odd roots of negative reals should return a negative real instead of the principal complex root. But that leads to more subtle problems in other places. Granted. Choose your poison. If all of mathematica, maple and matlab do the non-obvious thing there must be a good reason for it! There is but I think these reasons do not necessarily apply to Sage. And as Mike said, you can always get the real root by inserting brackets. ??? Consider the problem to define f(x) = x^(1/3) so that it takes the real branch for x 0. The best I have been able to come up with so far is: sage: f = lambda x: RealField(53)(x).sign()*(RealField(53)(x).sign()*x)^(1/3) sage: plot(f,(-2,2)) I think there should be a more obvious way. Regards, Bill Page. --~--~-~--~~~---~--~~ 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: cube roots
Bill Page wrote: On Thu, May 14, 2009 at 4:59 AM, John Cremona wrote: This debate has been going on for as long as computers have been in existence. Yes, there is a case to be made the odd roots of negative reals should return a negative real instead of the principal complex root. But that leads to more subtle problems in other places. Granted. Choose your poison. If all of mathematica, maple and matlab do the non-obvious thing there must be a good reason for it! There is but I think these reasons do not necessarily apply to Sage. And as Mike said, you can always get the real root by inserting brackets. ??? Consider the problem to define f(x) = x^(1/3) so that it takes the real branch for x 0. The best I have been able to come up with so far is: sage: f = lambda x: RealField(53)(x).sign()*(RealField(53)(x).sign()*x)^(1/3) sage: plot(f,(-2,2)) plot(lambda x: RR(x).nth_root(3), -5, 5, plot_points=20) This is from a mailing list discussion last year (Feb 2008?) on the same issue. In fact, there have been several discussions of this. Search sage-devel for plotting cube roots, for example. I thought the above plot was in the faq, but I can't find it now. Jason --~--~-~--~~~---~--~~ 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: cube roots
On Thu, May 14, 2009 at 11:06 AM, Jason Grout wrote: Bill Page wrote: Consider the problem to define f(x) = x^(1/3) so that it takes the real branch for x 0. The best I have been able to come up with so far is: sage: f = lambda x: RealField(53)(x).sign()*(RealField(53)(x).sign()*x)^(1/3) sage: plot(f,(-2,2)) plot(lambda x: RR(x).nth_root(3), -5, 5, plot_points=20) This is from a mailing list discussion last year (Feb 2008?) on the same issue. In fact, there have been several discussions of this. Search sage-devel for plotting cube roots, for example. Ok thanks. I recall the discussion and I can indeed write: sage: f=lambda x:RR(x).nth_root(3) sage: f(-2.0) -1.25992104989487 but I think I'll let my earlier comment stand: I think there should be a more obvious way. Regards, Bill Page. --~--~-~--~~~---~--~~ 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: solving for numeric values.
On May 14, 1:57 am, Josephine Ame elanma4je...@yahoo.com wrote: What am I doing wrong? z=(g+u)^2 + j^2*w^2 -c_0*exp(-g*L)*(cos(j*w*L)*(g+u)-j*w*sin(j*w*L))/c_0*exp(-g*L)*(cos(j*w*L)* (g+u)-j*w*sin(j*w*L)) Exponentials written as exp(foo) ... OK. Z = 1/P - 1 - (e^2/4)/z Written as e^foo ... OK. b=((g+u)-c_0*exp^(-g*L))/c_0*exp^(-g*L) Written as exp^foo ... I'm guessing that's incorrect. Looks like Sage is carrying exp^foo through to the results. [g == (6 - 5*exp^g)/(60*exp^g)] , etc. HTH Robert Dodier --~--~-~--~~~---~--~~ 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: cube roots
Bill Page wrote: On Thu, May 14, 2009 at 11:06 AM, Jason Grout wrote: Bill Page wrote: Consider the problem to define f(x) = x^(1/3) so that it takes the real branch for x 0. The best I have been able to come up with so far is: sage: f = lambda x: RealField(53)(x).sign()*(RealField(53)(x).sign()*x)^(1/3) sage: plot(f,(-2,2)) plot(lambda x: RR(x).nth_root(3), -5, 5, plot_points=20) This is from a mailing list discussion last year (Feb 2008?) on the same issue. In fact, there have been several discussions of this. Search sage-devel for plotting cube roots, for example. Ok thanks. I recall the discussion and I can indeed write: sage: f=lambda x:RR(x).nth_root(3) sage: f(-2.0) -1.25992104989487 but I think I'll let my earlier comment stand: I think there should be a more obvious way. Of course, you're welcome to suggest a way. Note that in earlier threads, having a switch that determines which root to pick has been negatively viewed. What about changing the name of the above function to: RR(x).real_root(3) ? That would certainly be easier to find and would be a bit more descriptive. Of course, right now, there is an nth_root function for complex numbers that also would have to be addressed. Or what about making real_root a method for any number (or real_nth_root, or make nth_root take an argument for a target domain, like RR or RDF)? Jason --~--~-~--~~~---~--~~ 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: cube roots
On Thu, May 14, 2009 at 12:34 PM, Jason Grout wrote: Bill Page wrote: Ok thanks. I recall the discussion and I can indeed write: sage: f=lambda x:RR(x).nth_root(3) sage: f(-2.0) -1.25992104989487 but I think I'll let my earlier comment stand: I think there should be a more obvious way. Of course, you're welcome to suggest a way. Note that in earlier threads, having a switch that determines which root to pick has been negatively viewed. -1 What about changing the name of the above function to: RR(x).real_root(3) ? That would certainly be easier to find and would be a bit more descriptive. Of course, right now, there is an nth_root function for complex numbers that also would have to be addressed. -0 Or what about making real_root a method for any number (or real_nth_root, or make nth_root take an argument for a target domain, like RR or RDF)? Perhaps we should continue this discussion on sage-devel if there is some reall interest in resolving this issue? What I personally would really prefer is that x^(1/3) call '.nth_root(3)' because (1/3) is an element of Rational Field. I suppose this requires some small change to the coercion system. Then x^(1.0/3.0) or equivalently x^RR(1/3) could continue to behave as it does now. Regards, Bill Page. --~--~-~--~~~---~--~~ 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: cube roots
I like Jason's idea (specifically real_nth_root) as a method. However, to me the real issue is plotting. If someone tries to get a cube root of -1 and gets a complex number, at least they see there is an output! And then someone can help them understand why they get that answer. But there is a well-defined real plot for the cube root of x, with domain the whole real line, and Sage should somehow be able to better than what is in the plot documentation (from all our previous discussions): sage: plot(lambda x : RR(x).nth_root(3), (x,-1, 1)) I hesitate to say we should be able to globally import and have something like sage: plot(real_nth_root(x,3), (x,-1,1)) and afaict having semantics to check for every case out there like when plotting x^(2/3)+x^(1/3) would be ridiculous. Plus I'm not even sure Python/Sage allow us to call functions partly and then plot them, based on previous discussions here. But any idea for how to make this class of plots a little more straightforward (i.e. doable in one command without lambdas or semicolons) would be very helpful. - kcrisman --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] (most) Sage 3.4.2 binaries posted
Hello folks, most 3.4.2 binaries are up on sagemath.org and being mirrored out. From the usual suspects some are still missing, i.e. * Fedora Core 10 32 bit * Atom * RHEL 5.2/SLES 10 Itanium * OSX 10.4 Intel Most of the missing binaries will show up in the next 24 hours. We also have some new ones that are not regularly posted: * Solaris 10/x86 (two trivial failures for long doctests) * Solaris 10/sparc (two trivial failures for long doctests) * OSX 10.5 MacIntel 64 bit (passes all long doctests) Those three above have selected fixes from 4.0.a0 and all three binaries should work and pass all doctests out of the box once Sage 4.0 is out early next week. Let us know if you find any problem. Cheers, Michael --~--~-~--~~~---~--~~ 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: twist.py
On May 14, 2009, at 9:27 AM, RALPH THOMAS wrote: Here is what I put into Sage --- sage: from sage.server.misc import find_next_available_port sage: port = find_next_available_port(, verbose=False) sage: from sage.server.notebook.notebook_object import test_notebook sage: passwd = str(randint(1,1128)) sage: nb = test_notebook(passwd, secure=False, address='localhost', port=port, verbose=True) #doctest: +ELLIPSIS sage: import urllib, re sage: def get_url(url): h = urllib.urlopen(url); data = h.read(); h.close(); return data sage: sleep(1) sage: login_page = get_url('http://localhost:%s/simple/login? username=adminpassword=%s' % (port, passwd)) sage: print login_page # random session id sage: session = re.match(r'.*session: ([^]*)', login_page, re.DOTALL).groups()[0] sage: sleep(0.5) sage: print get_url('http://localhost:%s/simple/compute?session=% scode=2*2' % (port, session)) sage: n = factorial(10) sage: print get_url('http://localhost:%s/simple/compute?session=% scode=factor(%s)timeout=0.1' % (port, session, n)) sage: print get_url('http://localhost:%s/simple/status?session=% scell=2' % (port, session)) sage: _ = get_url('http://localhost:%s/simple/interrupt?session=%s' % (port, session)) sage: code = h = open('a.txt', 'w'); h.write('test'); h.close() sage: print get_url('http://localhost:%s/simple/compute?session=% scode=%s' % (port, session, urllib.quote(code))) sage: print get_url('http://localhost:%s/simple/file?session=% scell=3file=a.txt' % (port, session)) sage: _ = get_url('http://localhost:%s/simple/logout?session=%s' % (port, session)) sage: nb.dispose() -- - And all the calculations are accomplished. (2*2, factorial, text file) Now what do I do to get the Sage calculation into a html page? That depends on what you're trying to do, e.g. are you serving up webpages using php? Another Python program? Something else? Basically, you can get the same series of url's in any programming language. - Robert --~--~-~--~~~---~--~~ 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: twist.py
On May 14, 2009, at 12:25 PM, RALPH THOMAS wrote: What I would like to do is have page(form) come up in a browser that would let the user enter a lets say an equation then Sage would solve the equation and show the answer. Or an integral then Sage would calculate the value and display the solution. Is this doable with your script? Yes, that is very doable. You might want to be careful about sanitizing the input if you're going to be exposing this to the web though, i.e. never pass the user's strings right into the code parameter. PHP, javascript, etc. Just translate the script below into PHP. Imagine allow_url_fopen is on. Then one would have $login_page = file_get_contents(http://localhost:$notebook_server: $notebook_port/simple/login?username=adminpassword=$password' ) preg_match('.*session: ([^]*)', $login_page, $matches) $session = $matches[1] ... - Robert Ralph CC: rthomas...@msn.com From: rober...@math.washington.edu Subject: Re: twist.py Date: Thu, 14 May 2009 11:15:47 -0700 To: sage-support@googlegroups.com On May 14, 2009, at 9:27 AM, RALPH THOMAS wrote: Here is what I put into Sage --- sage: from sage.server.misc import find_next_available_port sage: port = find_next_available_port(, verbose=False) sage: from sage.server.notebook.notebook_object import test_notebook sage: passwd = str(randint(1,1128)) sage: nb = test_notebook(passwd, secure=False, address='localhost', port=port, verbose=True) #doctest: +ELLIPSIS sage: import urllib, re sage: def get_url(url): h = urllib.urlopen(url); data = h.read(); h.close(); return data sage: sleep(1) sage: login_page = get_url('http://localhost:%s/simple/login? username=adminpassword=%s' % (port, passwd)) sage: print login_page # random session id sage: session = re.match(r'.*session: ([^]*)', login_page, re.DOTALL).groups()[0] sage: sleep(0.5) sage: print get_url('http://localhost:%s/simple/compute?session=% scode=2*2' % (port, session)) sage: n = factorial(10) sage: print get_url('http://localhost:%s/simple/compute?session=% scode=factor(%s)timeout=0.1' % (port, session, n)) sage: print get_url('http://localhost:%s/simple/status?session=% scell=2' % (port, session)) sage: _ = get_url('http://localhost:%s/simple/interrupt?session= %s' % (port, session)) sage: code = h = open('a.txt', 'w'); h.write('test'); h.close() sage: print get_url('http://localhost:%s/simple/compute?session=% scode=%s' % (port, session, urllib.quote(code))) sage: print get_url('http://localhost:%s/simple/file?session=% scell=3file=a.txt' % (port, session)) sage: _ = get_url('http://localhost:%s/simple/logout?session=%s' % (port, session)) sage: nb.dispose() -- - And all the calculations are accomplished. (2*2, factorial, text file) Now what do I do to get the Sage calculation into a html page? That depends on what you're trying to do, e.g. are you serving up webpages using php? Another Python program? Something else? Basically, you can get the same series of url's in any programming language. - Robert --~--~-~--~~~---~--~~ 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: twist.py
On May 14, 2009, at 1:44 PM, RALPH THOMAS wrote: Do you mean this ?php $login_page = file_get_contents(http://localhost:$notebook_server: $notebook_port/simple/login?username=adminpassword=$password' ) preg_match('.*session: ([^]*)', $login_page, $matches) $session = $matches[1] ? Nothing running in Sage? Ralph Yes, exactly. Sage is running on the notebook server (you have to set that up by running sage -notebook separately). (My example had a typo, it should be $notebook_server *instead* of localhost unless of course it is localhost.) - Robert CC: sage-support@googlegroups.com From: rober...@math.washington.edu Subject: Re: twist.py Date: Thu, 14 May 2009 12:35:04 -0700 To: rthomas...@msn.com On May 14, 2009, at 12:25 PM, RALPH THOMAS wrote: What I would like to do is have page(form) come up in a browser that would let the user enter a lets say an equation then Sage would solve the equation and show the answer. Or an integral then Sage would calculate the value and display the solution. Is this doable with your script? Yes, that is very doable. You might want to be careful about sanitizing the input if you're going to be exposing this to the web though, i.e. never pass the user's strings right into the code parameter. PHP, javascript, etc. Just translate the script below into PHP. Imagine allow_url_fopen is on. Then one would have $login_page = file_get_contents(http://localhost:$notebook_server: $notebook_port/simple/login?username=adminpassword=$password' ) preg_match('.*session: ([^]*)', $login_page, $matches) $session = $matches[1] ... - Robert Ralph CC: rthomas...@msn.com From: rober...@math.washington.edu Subject: Re: twist.py Date: Thu, 14 May 2009 11:15:47 -0700 To: sage-support@googlegroups.com On May 14, 2009, at 9:27 AM, RALPH THOMAS wrote: Here is what I put into Sage --- sage: from sage.server.misc import find_next_available_port sage: port = find_next_available_port(, verbose=False) sage: from sage.server.notebook.notebook_object import test_notebook sage: passwd = str(randint(1,1128)) sage: nb = test_notebook(passwd, secure=False, address='localhost', port=port, verbose=True) #doctest: +ELLIPSIS sage: import urllib, re sage: def get_url(url): h = urllib.urlopen(url); data = h.read(); h.close(); return data sage: sleep(1) sage: login_page = get_url('http://localhost:%s/simple/login? username=adminpassword=%s' % (port, passwd)) sage: print login_page # random session id sage: session = re.match(r'.*session: ([^]*)', login_page, re.DOTALL).groups()[0] sage: sleep(0.5) sage: print get_url('http://localhost:%s/simple/compute? session=% scode=2*2' % (port, session)) sage: n = factorial(10) sage: print get_url('http://localhost:%s/simple/compute? session=% scode=factor(%s)timeout=0.1' % (port, session, n)) sage: print get_url('http://localhost:%s/simple/status? session=% scell=2' % (port, session)) sage: _ = get_url('http://localhost:%s/simple/interrupt? session= %s' % (port, session)) sage: code = h = open('a.txt', 'w'); h.write('test'); h.close() sage: print get_url('http://localhost:%s/simple/compute? session=% scode=%s' % (port, session, urllib.quote(code))) sage: print get_url('http://localhost:%s/simple/file?session=% scell=3file=a.txt' % (port, session)) sage: _ = get_url('http://localhost:%s/simple/logout? session=%s' % (port, session)) sage: nb.dispose() -- - And all the calculations are accomplished. (2*2, factorial, text file) Now what do I do to get the Sage calculation into a html page? That depends on what you're trying to do, e.g. are you serving up webpages using php? Another Python program? Something else? Basically, you can get the same series of url's in any programming language. - Robert --~--~-~--~~~---~--~~ 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] How would I list just the 3 cycles in AlternatingGroup()
I can generate a list from any given group, but how would I go about generating a list of just 3 or 5 cycles? --~--~-~--~~~---~--~~ 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: How would I list just the 3 cycles in AlternatingGroup()
I must be missing something. Why can't you just check the order of the element? On Thu, May 14, 2009 at 7:53 PM, jimfar jamesfar...@mac.com wrote: I can generate a list from any given group, but how would I go about generating a list of just 3 or 5 cycles? --~--~-~--~~~---~--~~ 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: How would I list just the 3 cycles in AlternatingGroup()
I can find the order of the element, but I am looking to generate a list of all of the 3 cycles in something like AlternatingGroup(5) where the list will not go on for too long. On May 14, 5:04 pm, David Joyner wdjoy...@gmail.com wrote: I must be missing something. Why can't you just check the order of the element? On Thu, May 14, 2009 at 7:53 PM, jimfar jamesfar...@mac.com wrote: I can generate a list from any given group, but how would I go about generating a list of just 3 or 5 cycles? --~--~-~--~~~---~--~~ 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: How would I list just the 3 cycles in AlternatingGroup()
Why doesn't the obvious 1-liner [x for x in AlternatingGroup(5) if x.order()==3] work? Again, am I missing something? On Thu, May 14, 2009 at 8:57 PM, jimfar jamesfar...@mac.com wrote: I can find the order of the element, but I am looking to generate a list of all of the 3 cycles in something like AlternatingGroup(5) where the list will not go on for too long. On May 14, 5:04 pm, David Joyner wdjoy...@gmail.com wrote: I must be missing something. Why can't you just check the order of the element? On Thu, May 14, 2009 at 7:53 PM, jimfar jamesfar...@mac.com wrote: I can generate a list from any given group, but how would I go about generating a list of just 3 or 5 cycles? --~--~-~--~~~---~--~~ 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: How would I list just the 3 cycles in AlternatingGroup()
Thanks, I was confusing myself with the definition of the order of an element with order of the cycle. On May 14, 6:52 pm, David Joyner wdjoy...@gmail.com wrote: Why doesn't the obvious 1-liner [x for x in AlternatingGroup(5) if x.order()==3] work? Again, am I missing something? On Thu, May 14, 2009 at 8:57 PM, jimfar jamesfar...@mac.com wrote: I can find the order of the element, but I am looking to generate a list of all of the 3 cycles in something like AlternatingGroup(5) where the list will not go on for too long. On May 14, 5:04 pm, David Joyner wdjoy...@gmail.com wrote: I must be missing something. Why can't you just check the order of the element? On Thu, May 14, 2009 at 7:53 PM, jimfar jamesfar...@mac.com wrote: I can generate a list from any given group, but how would I go about generating a list of just 3 or 5 cycles? --~--~-~--~~~---~--~~ 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Is nullity of matrix is right nullity of matrix?
Ah... message is gone, so I write again. OTL... I solve the Linear Algebra course problems on Sage. Now I get the nullity of matrix to use nullity function, but it's weird. If I get the nullity of matrix A to use nullity function like that, A.nullity() but the result of this is same as left nullity of A. So rank + nullity is not columns of A. According to the Rank-Nullity Theorem, rank A + nullity A = number of columns of A. It's weird. So I read the source file. On SAGEROOT/devel/sage/sage/matrix/matrix2.pyx line 1546, (ver 3.4.1) nullity = left_nullity and definition of left_nullity function's comments # Use that rank + nullity = number of rows, since matrices act # from the right on row vectors. But left null space of A is same as null space of transpose A. http://en.wikipedia.org/wiki/Null_space#Left_null_space So I think it is wrong, I modified the code like that. nullity = left_nullity = nullity = right_nullity The result of this is here. http://121.169.55.178:8000/home/pub/2/ (It's my desktop computer, so it's slow.) Nullity function's document is here. http://www.sagemath.org/doc/reference/sage/matrix/matrix2.html#sage.matrix.matrix2.Matrix.nullity It said this function return the left nullity of matrix. Is it wrong, or right? 누구나가 다, 자기 옆에서 눈물을 흘리며 신음하는 불행한 사람들에 비해 자기가 훨씬 더 불행하다고 생각하지요. 이게 바로 우리 가련한 인간들의 오만 중의 하나입니다. - 몬테크리스토 백작 it is the infirmity of our nature always to believe ourselves much more unhappy than those who groan by our sides! - The Count of Monte Cristo c'est un des orgueils de notre pauvre humanité, que chaque homme se croie plus malheureux qu'un autre malheureux qui pleure et qui gémit à côté de lui - Le Comte de Monte-Cristo 박진영 - Bak Jin Yeong 학부재학생 - Undergraduate 컴퓨터공학전공 - Department of Computer Engineering 정보통신공학부 - School of Information Communication Engineering 성균관대학교 - SungKyunKwan University 블로그 - http://nosyu.pe.kr 이메일 - don...@skku.edu --~--~-~--~~~---~--~~ 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Is nullity of matrix is right nullity of matrix?
NoSyu wrote: Ah... message is gone, so I write again. OTL... I solve the Linear Algebra course problems on Sage. Now I get the nullity of matrix to use nullity function, but it's weird. If I get the nullity of matrix A to use nullity function like that, A.nullity() but the result of this is same as left nullity of A. You did a great job tracking this down. You're right; nullity in Sage refers to left nullity (i.e., dealing with vectors on the left, like v*M). You're also correct that this is different than most standard linear algebra, where the term nullity means right nullity. This is a historical thing in Sage that unfortunately, at least at this point, is not going to change. Rather, Sage provides the explicit functions right_nullity and left_nullity. We encourage you to use right_nullity or left_nullity to make it clear which nullity you are talking about. Eventually (not in the near future), the nullity function may be deprecated and no longer available, as it is ambiguous, or at least confusing. The Sage decision is not right or wrong; it's just a different convention. Moving to more explicit functions (left_nullity and right_nullity) is better, as it makes sure that everyone understands exactly what you mean. Jason --~--~-~--~~~---~--~~ 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Is nullity of matrix is right nullity of matrix?
Thanks to reply my message. I understand it. You're right. From now, I use explicit function likes right_nullity. I learned right nullity convention, so rank + nullity = number of columns. I discuss about it with my Prof. Thanks again. Have a nice weekend.^^ 누구나가 다, 자기 옆에서 눈물을 흘리며 신음하는 불행한 사람들에 비해 자기가 훨씬 더 불행하다고 생각하지요. 이게 바로 우리 가련한 인간들의 오만 중의 하나입니다. - 몬테크리스토 백작 it is the infirmity of our nature always to believe ourselves much more unhappy than those who groan by our sides! - The Count of Monte Cristo c'est un des orgueils de notre pauvre humanité, que chaque homme se croie plus malheureux qu'un autre malheureux qui pleure et qui gémit à côté de lui - Le Comte de Monte-Cristo 박진영 - Bak Jin Yeong 학부재학생 - Undergraduate 컴퓨터공학전공 - Department of Computer Engineering 정보통신공학부 - School of Information Communication Engineering 성균관대학교 - SungKyunKwan University 블로그 - http://nosyu.pe.kr 이메일 - don...@skku.edu On 5월15일, 오전11시43분, Jason Grout jason-s...@creativetrax.com wrote: NoSyu wrote: Ah... message is gone, so I write again. OTL... I solve the Linear Algebra course problems on Sage. Now I get the nullity of matrix to use nullity function, but it's weird. If I get the nullity of matrix A to use nullity function like that, A.nullity() but the result of this is same as left nullity of A. You did a great job tracking this down. You're right; nullity in Sage refers to left nullity (i.e., dealing with vectors on the left, like v*M). You're also correct that this is different than most standard linear algebra, where the term nullity means right nullity. This is a historical thing in Sage that unfortunately, at least at this point, is not going to change. Rather, Sage provides the explicit functions right_nullity and left_nullity. We encourage you to use right_nullity or left_nullity to make it clear which nullity you are talking about. Eventually (not in the near future), the nullity function may be deprecated and no longer available, as it is ambiguous, or at least confusing. The Sage decision is not right or wrong; it's just a different convention. Moving to more explicit functions (left_nullity and right_nullity) is better, as it makes sure that everyone understands exactly what you mean. Jason --~--~-~--~~~---~--~~ 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---