[sage-support] Re: about inverse_erf
In fact you don't really need MathWorld: erf is continuous monotone R-(-1,1), so must have an inverse function (-1,1)-R. How you tell Sage this needs a Sage expert. On Saturday, 28 December 2013 19:46:49 UTC, Buck Golemon wrote: I've found here: http://mathworld.wolfram.com/InverseErf.html [image: erf^(-1)(erf(x))][image: =][image: x,] (2) with the identity holding for [image: x in R] Is this a bit of information that can be added (by me?) to sage? On Saturday, December 28, 2013 11:32:02 AM UTC-8, Buck Golemon wrote: Yes, I can, but it doesn't have the intended (or any) effect: sage: assume(x, 'real') sage: assume(y, 'real') sage: assumptions() [x is real, y is real] sage: solve(erf(x) == erf(y), x) [x == inverse_erf(erf(y))] On Saturday, December 28, 2013 11:27:09 AM UTC-8, Buck Golemon wrote: Thanks. If I understand you, the problems lie in the complex domain, where I was only thinking of the real numbers. Can I not do something to the effect of assume(x, 'real') ? On Saturday, December 28, 2013 10:07:41 AM UTC-8, JamesHDavenport wrote: erf, as a function C-C, is not 1:1 (see 7.13(i) of DLMF), so this simplification would be incorrect. I do not know how to tell Sage that you want real-valued functions/variables, when of course it would be correct to do the simplification. On Friday, 27 December 2013 22:40:40 UTC, Buck Golemon wrote: 1) Sage seems unable to reduce `erf(x) == erf(y)` to `x == y`. How can I help this along? solve(erf(x) == erf(y), x)[0].simplify_full() Actual output: x == inverse_erf(erf(y)) Expected output: x == y I had expected that sage would trivially reduce `inverse_erf(erf(y))` to `y`. 2) This output references 'inverse_erf', which doesn't seem to be importable t from anywhere in sage. Am I correct? --- My concrete problem is re-deriving the formula for the normal-distribution cdf. I get a good solution from sage, but fail in showing that it's equivalent to a known solution because: var('x sigma mu') assume(sigma 0) eq3 = (-erf((sqrt(2)*mu - sqrt(2)*x)/(2*sigma)) == -erf((sqrt(2)*(mu - x))/(2*sigma))) bool(eq3) Actual output: False Expected output: True However this quite similar formula works fine: eq3 = (-erf(sqrt(2)*mu - sqrt(2)*x) == -erf(sqrt(2)*(mu - x))) bool(eq3) Output: True --- Include: Platform (CPU) -- x86_64 Operating System -- Ubuntu 13.10 Exact version of Sage (command: version()) -- 'Sage Version 5.13, Release Date: 2013-12-15' -- You received this message because you are subscribed to the Google Groups sage-support group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/groups/opt_out.
[sage-support] Re: about inverse_erf
erf, as a function C-C, is not 1:1 (see 7.13(i) of DLMF), so this simplification would be incorrect. I do not know how to tell Sage that you want real-valued functions/variables, when of course it would be correct to do the simplification. On Friday, 27 December 2013 22:40:40 UTC, Buck Golemon wrote: 1) Sage seems unable to reduce `erf(x) == erf(y)` to `x == y`. How can I help this along? solve(erf(x) == erf(y), x)[0].simplify_full() Actual output: x == inverse_erf(erf(y)) Expected output: x == y I had expected that sage would trivially reduce `inverse_erf(erf(y))` to `y`. 2) This output references 'inverse_erf', which doesn't seem to be importable t from anywhere in sage. Am I correct? --- My concrete problem is re-deriving the formula for the normal-distribution cdf. I get a good solution from sage, but fail in showing that it's equivalent to a known solution because: var('x sigma mu') assume(sigma 0) eq3 = (-erf((sqrt(2)*mu - sqrt(2)*x)/(2*sigma)) == -erf((sqrt(2)*(mu - x))/(2*sigma))) bool(eq3) Actual output: False Expected output: True However this quite similar formula works fine: eq3 = (-erf(sqrt(2)*mu - sqrt(2)*x) == -erf(sqrt(2)*(mu - x))) bool(eq3) Output: True --- Include: Platform (CPU) -- x86_64 Operating System -- Ubuntu 13.10 Exact version of Sage (command: version()) -- 'Sage Version 5.13, Release Date: 2013-12-15' -- You received this message because you are subscribed to the Google Groups sage-support group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/groups/opt_out.
[sage-support] Re: about inverse_erf
Furthermore, DLMF 7.17 only defines the inverse error function on the real line (in fact (-1,1)) I do not recall ever seeing a discussion of the complex inverse error function. Strecok (1968) shows that it satisfies y''=2yy'y', but this is nonlinear, so the methodology of the paper below doesn't help. Chyzak,F., Davenport,J.H., Koutschan,C. Salvy,B., On Kahan's Rules for Determining Branch Cuts. Proc. SYNSAC 2012 (ed. D. Wang et al.), IEEE Computer Society Press, Los Alamitos, CA, pp. 47-51 On Friday, 27 December 2013 22:40:40 UTC, Buck Golemon wrote: 1) Sage seems unable to reduce `erf(x) == erf(y)` to `x == y`. How can I help this along? solve(erf(x) == erf(y), x)[0].simplify_full() Actual output: x == inverse_erf(erf(y)) Expected output: x == y I had expected that sage would trivially reduce `inverse_erf(erf(y))` to `y`. 2) This output references 'inverse_erf', which doesn't seem to be importable t from anywhere in sage. Am I correct? --- My concrete problem is re-deriving the formula for the normal-distribution cdf. I get a good solution from sage, but fail in showing that it's equivalent to a known solution because: var('x sigma mu') assume(sigma 0) eq3 = (-erf((sqrt(2)*mu - sqrt(2)*x)/(2*sigma)) == -erf((sqrt(2)*(mu - x))/(2*sigma))) bool(eq3) Actual output: False Expected output: True However this quite similar formula works fine: eq3 = (-erf(sqrt(2)*mu - sqrt(2)*x) == -erf(sqrt(2)*(mu - x))) bool(eq3) Output: True --- Include: Platform (CPU) -- x86_64 Operating System -- Ubuntu 13.10 Exact version of Sage (command: version()) -- 'Sage Version 5.13, Release Date: 2013-12-15' -- You received this message because you are subscribed to the Google Groups sage-support group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/groups/opt_out.
[sage-support] Re: Spurious numerical solutions of polynomial equation
Curious. The polynomial does not seem particularly ill-conditioned, in the sense that its discriminat is roughly what one might expect (unlike, say, Wilkinson's). Maple gives 50 roots with |f(x)|10^{-12}, and one with f(x)=, i.e. much larger. On Thursday, 12 December 2013 15:35:53 UTC, AWWQUB wrote: Consider the equation *(I*x^51+sum(x^k,k,0,50))==0* Try to solve it numerically using *solve([(I*x^51+sum(x^k,k,0,50))==0,x==x],x,solution_dict=True)* and you obtain 51 solutions of which 50 have modulus approximately 1 and the other is close to 1+I. Substituting back gives residuals of around at most 10^-6. That looks fine and Mathematica gives similar solutions. Now substitute x-1-I for x, so that one of the solutions should now be close to zero. Sage now gives solutions with real and imaginary parts both between -1 and +4, but none are particularly close to zero.The residuals now range up to 10^20. Mathematica gives completely different answers but which are also wrong, namely all 51 are approximately 1. Any ideas? Tony Wickstead -- You received this message because you are subscribed to the Google Groups sage-support group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/groups/opt_out.
[sage-support] Re: Spurious numerical solutions of polynomial equation
Sorry - I was looking at the original *(I*x^51+sum(x^k,k,0,50))==0.* Note that if you make the x-x-1 substitution, the polynomial now has coefficient as large as 10^18. The discriminant is unchanged, but the value you would expect it to be, given the size of the coefficient, is roughly10^800 times greater, so the polynomial is now amazingly ill-conditioned. Note that if you evaluate the translated polynomial in machine floating-point, and then translate back, you get coefficients of size 10^15. This translation is not feasible in floating-point! On Saturday, 14 December 2013 17:37:16 UTC, JamesHDavenport wrote: Curious. The polynomial does not seem particularly ill-conditioned, in the sense that its discriminant is roughly what one might expect (unlike, say, Wilkinson's). Maple gives 50 roots with |f(x)|10^{-12}, and one with f(x)=, i.e. much larger. On Thursday, 12 December 2013 15:35:53 UTC, AWWQUB wrote: Consider the equation *(I*x^51+sum(x^k,k,0,50))==0* Try to solve it numerically using *solve([(I*x^51+sum(x^k,k,0,50))==0,x==x],x,solution_dict=True)* and you obtain 51 solutions of which 50 have modulus approximately 1 and the other is close to 1+I. Substituting back gives residuals of around at most 10^-6. That looks fine and Mathematica gives similar solutions. Now substitute x-1-I for x, so that one of the solutions should now be close to zero. Sage now gives solutions with real and imaginary parts both between -1 and +4, but none are particularly close to zero.The residuals now range up to 10^20. Mathematica gives completely different answers but which are also wrong, namely all 51 are approximately 1. Any ideas? Tony Wickstead -- You received this message because you are subscribed to the Google Groups sage-support group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/groups/opt_out.
[sage-support] Re: Documentation and Learning Material for Basic Structures and the CategoryObject class
Although not SAGE-specific, some of the issues are discussed in our Davenport,J.H. Trager,B.M., Scratchpad's View of Algebra I: Basic Commutative Algebra. Proc. DISCO '90 (Springer Lecture Notes in Computer Science Vol. 429, ed. A. Miola) pp. 40-54. http://opus.bath.ac.uk/32336/. Davenport,J.H., Gianni,P. Trager,B.M., Scratchpad's View of Algebra II: A Categorical View of Factorization. Proc. ISSAC 1991 (ed. S.M. Watt), ACM, New York, pp. 32--38. http://opus.bath.ac.uk/32335/. On Saturday, 30 November 2013 23:04:01 UTC, Nehal Patel wrote: Hello -- I am interested in learning how one goes about modeling the abstract concepts of modern mathematics such as Groups, Rings, Ideals, Fields, etc. in an object oriented way (as well as learning a bit about Category Theory along the way). I seems like a pretty tricky software engineering problem and there must be all sorts of lessons people have learned along the way. Given the openness of Sage, I figured this was a great place to start. I'm reading through the Basic Structures section of the Reference Manual and intend to browse through some of the code, but I thought I would ask the lists as well. ++ Is there any documentation that describes how the Sage developers decided to design their class hierarchy? ++ How similar is it to what is used in Magma? ++ Are there good resources that discuss the software design issues (rather than just algorithms) related to CAS Ideally there would be something equivalent to the section in William Stein's overview video in which he discusses the history and implementation of the Calculus functionality. thanks! -- You received this message because you are subscribed to the Google Groups sage-support group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/groups/opt_out.
[sage-support] Re: Definite integral disagrees with Maple and mathworld
You may be right - my University Maple 16 gets the right answer, but my 17beta does not. I've reported this as a Maple beta bug. On Tuesday, 27 August 2013 06:34:07 UTC+1, Georgi Guninski wrote: Thank you for the note. You claim: For \int_{1/3}^1 fra(1/x) dx Maple returns ln 3 - 1/3. I can't reproduce this on Maple 13 on linux, here is a session: fra1:=x-1/2+I/(2*Pi)*log(-exp(-2*Pi*I*x)): ii:=int(fra1(1/x),x=1/3..1); ii := - 5/6 + ln(3) What about this: i2:=int(cos(x)*fra1(1/x),x=1 .. infinity); i2 := -Ci(1) Wolfram Alpha (and possibly Mathematice) return the same: http://www.wolframalpha.com/input/?i=integral+from+1+to+infinity+of+cos%28x%29*frac%281%2Fx%29 i3:=int(sin(x)*fra1(1/x),x=1 .. infinity); i3 := -1/2 I Ei(1, -I) + 1/2 I Ei(1, I) On Mon, Aug 26, 2013 at 09:56:41PM +0100, James Davenport wrote: On Sun, 25 Aug 2013, Georgi Guninski wrote: Well, after full simplification fra1() no longer equals {x}: Like Maple's simplify(,symbolic). See attached for some thoughts. James Davenport -- You received this message because you are subscribed to the Google Groups sage-support group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/groups/opt_out.
[sage-support] Re: Definite integral disagrees with Maple and mathworld
Well, the derivative of the fractional part is indeed 1 where it is defined, as lim((fra(x+eps)-fra(x))/eps)=lim(eps/eps)=1 unless adding eps crosses a boundary, which it won't do for eps small enough. Maxima (5.29) returns (4 pi log 2 + i log(-1) +pi)/(4 pi). Depending on the value of log(-1), this is either log(2) or log(2)+1/2, which I must confess I don't understand. I conjecture Sage is getting log(2) from taking the conventional log(-1)=i pi in Maxima's result. On Saturday, 24 August 2013 12:59:41 UTC+1, Georgi Guninski wrote: Don't claim this is a bug, but don't understand this. Define {x} the fractional part of x by (source mathworld): def fra1(x): fractional part return 1/2+I/(2*pi)*log(-exp(-2*pi*I*x)) sage: var('x') x sage: ii=integrate(fra1(1/x),x,1/2,1);ii log(2) According to Maple and mathworld this integral equals -1/2 + ln(2) Part of the problem is log() is multivalued, but I suppose for all branches of log(), fra1() should be correct $\mod 1$, yet the result is not correct $\mod 1$. Probably this is related: sage: diff(fra1(x),x) 1 Why so? -- You received this message because you are subscribed to the Google Groups sage-support group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/groups/opt_out.
[sage-support] Re: Left and right limits (is default of 'dir' None?)
Maxima, from memory supplemented with an experiment with 5.27, has a) infinity, which is the infinity of the (one-point compactification of the) complex plane b) inf, which is the positive one of the two-point compactification of the reals (plus infinity) c) minf, which is the negative one of the two-point compactification of the reals (minus infinity) The back-translation from Maxima to Sage appears to confuse inf and infinity. James Davenport PS Note the confusing fact that the reals are a subset of the complexes, but the usual (two-point) compactification of the reals is NOT a subset of the compactification of the complexes. On Monday, 19 August 2013 19:17:28 UTC+1, kcrisman wrote: On Monday, August 19, 2013 1:55:04 PM UTC-4, Vince wrote: When computing the limit of a function I don't quite seem to be getting the behaviour that I expected. --- sage: f(x) = 1 / x sage: print f.limit(x=0) sage: print f.limit(x=0, dir='minus') --- The first limit returns infinity, but I would expect it to return that the limit is not defined. I think we have an unsigned infinity and a signed infinity. It should return the former, from Maxima. The second (directional) limit confirms this (it returns -infinity). I was assuming that the default 'direction' for a limit is None and that a two directional limit would be computed (which in this case does not exist). Here's some of the help file that shows why I am perhaps confused: --- INPUT: - ``dir`` - (default: None); dir may have the value 'plus' (or '+' or 'right') for a limit from above, 'minus' (or '-' or 'left') for a limit from below, or may be omitted (implying a two-sided limit is to be computed). --- If anyone could clarify this I'd appreciate it. Vince -- You received this message because you are subscribed to the Google Groups sage-support group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/groups/opt_out.
[sage-support] Re: Disturbing Equality (from askSAGE)
No - because sqrt is multivalued, the answer can be, and in this case is, multivalued: sometimes true and sometimes false. This isn't desperately helpful, or course, and can be cast in other ways in terms of the defect Bradford,R.J., Algebraic Simplification of Multiple-Valued Functions. Proc. DISCO '92 (Springer Lecture Notes in Computer Science 721, ed. J.P. Fitch), Springer, 1993, pp. 13-21. or the unwinding number Corless,R.M. Jeffrey,D.J., The Unwinding Number. SIGSAM Bulletin 30(1996) 2, pp. 28-35. On Tuesday, 30 July 2013 18:45:07 UTC+1, rickhg12hs wrote: On Tuesday, July 30, 2013 1:40:29 PM UTC-4, JamesHDavenport wrote: On Tuesday, 30 July 2013 15:29:43 UTC+1, rickhg12hs wrote: sage: var('a b') (a, b) sage: assume(a, 'real') sage: assume(b, 'real') sage: bool( sqrt((a+b)^2) == sqrt(a^2) + sqrt(b^2) ) True sage:bool( (sqrt((a+b)^2) == sqrt(a^2) + sqrt(b^2)).subs(a=1,b=-1) ) False sage: Why the strange equality? Because square root is multivalued. Consider sqrt(1-z)*sqrt(1+z)=sqrt(1-z^2) and sqrt(z-1)*sqrt(z+1)=sqrt(z^2-1). More academically, consider Bradford,R.J. Davenport,J.H., Towards Better Simplification of Elementary Functions. Proc. ISSAC 2002 (ed. T. Mora), ACM Press, New York, 2002, pp. 15-22. So you are saying the `True` Bool is the desired behavior? -- You received this message because you are subscribed to the Google Groups sage-support group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/groups/opt_out.
[sage-support] Re: Disturbing Equality (from askSAGE)
On Tuesday, 30 July 2013 15:29:43 UTC+1, rickhg12hs wrote: sage: var('a b') (a, b) sage: assume(a, 'real') sage: assume(b, 'real') sage: bool( sqrt((a+b)^2) == sqrt(a^2) + sqrt(b^2) ) True sage:bool( (sqrt((a+b)^2) == sqrt(a^2) + sqrt(b^2)).subs(a=1,b=-1) ) False sage: Why the strange equality? Because square root is multivalued. Consider sqrt(1-z)*sqrt(1+z)=sqrt(1-z^2) and sqrt(z-1)*sqrt(z+1)=sqrt(z^2-1). More academically, consider Bradford,R.J. Davenport,J.H., Towards Better Simplification of Elementary Functions. Proc. ISSAC 2002 (ed. T. Mora), ACM Press, New York, 2002, pp. 15-22. -- You received this message because you are subscribed to the Google Groups sage-support group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/groups/opt_out.
[sage-support] Re: Simplifying expression, 'x' vs. 'y'
On Wednesday, 12 December 2012 02:28:19 UTC, kcrisman wrote: On Tuesday, December 11, 2012 6:52:53 PM UTC-5, JamesHDavenport wrote: Pedantic Note. Jacques Carette's paper: Understanding Expression Simplification. Proc. ISSAC 2004 (ed. J. Gutierrez), ACM Press, New York, 2004, pp. 72-79. http://www.cas.mcmaster.ca/~carette/publications/simplification.pdf. defines it in a useful way, just not in a computable way (that I can see in practice). Very interesting paper. I guess I was referring to the sense that (1+x)(1-x) and 1-x^2 might each be considered simpler depending on the context, which is the way a lot of people who don't know about decidability would perceive this question (or so my experience has been interacting with a lot of people who ask about why Sage doesn't simplify this or that). I suppose the answer to my example would depend on what you pick for your axiomoids? RJF always seems to have a useful comment about these things as well. Carette would argue that 1-x^2 requires fewer characters (or tree nodes, or whatever), so is definitely 'simpler'. I would add 'if the user wants 'factor', he/she should ask for it! -- You received this message because you are subscribed to the Google Groups sage-support group. 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. Visit this group at http://groups.google.com/group/sage-support?hl=en.
[sage-support] Re: Simplifying expression, 'x' vs. 'y'
On Tuesday, 11 December 2012 13:15:09 UTC, kcrisman wrote: I wouldn't worry about it, since in general there is no way to define simpler expression that is fully useful at all times, and for more complicated expressions more detail work would be needed anyway. Pedantic Note. Jacques Carette's paper: Understanding Expression Simplification. Proc. ISSAC 2004 (ed. J. Gutierrez), ACM Press, New York, 2004, pp. 72-79. http://www.cas.mcmaster.ca/~carette/publications/simplification.pdf. defines it in a useful way, just not in a computable way (that I can see in practice). -- You received this message because you are subscribed to the Google Groups sage-support group. 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. Visit this group at http://groups.google.com/group/sage-support?hl=en.
[sage-support] Re: Keeping rational functions simple throughout gaussian elimination
I have no idea whether SAGE supports this, but basically what you need is fraction-free Gaussian elimination: See section 3.2.3 of http:/staff.bath.ac.uk/masjhd/JHD-CA.pdf On Wednesday, 22 August 2012 13:04:08 UTC+1, Erik Aas wrote: I'm trying to solve a system of linear equations over the field Q(x1,...,xn) of rational functions in x1,...,xn. The system is Ax = 0 where A has entries from the field and has rather large size (500 rows and columns for example). One way to do it is to compute kernel(A). In my case it is 1-dimensional. The basis vector returned has coordinates of the form (polynomial/polynomial + polynomial) / (polynomial - polynomial) et.c. Calling .denominator() and .numerator() on the expression does not terminate before my patience does. Is there a way to make sure the equation solver keep all coefficients on the form polynomial / polynomial? -- You received this message because you are subscribed to the Google Groups sage-support group. 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. Visit this group at http://groups.google.com/group/sage-support?hl=en.
[sage-support] Re: Multiplicity of roots nummerical
But this is a rather fragile concept: see http://whww.sagenb.org/home/pub/4840 http://www.sagenb.org/home/pub/4840 If you can't, expand f below as x^2-2*x+1 then try perturbing the +1 term, e.g. +1+10^(-20). What you really need in the approximate square-free decomposition of f: see, e.g. Chin,P., Corless,R.M. Corliss,G.F., Optimization Strategies for Floating-Point GCD. Proc. ISSAC '98 (ed. O.Gloor), ACM, New York, 1998, pp. 228-235. Nagasaka,K., Approximate polynomial GCD over integers. J. Symbolic Comp. 46(2011) pp. 1306-1317. On Friday, 29 June 2012 11:46:25 UTC+1, achrzesz wrote: Notice that roots gives you the multiplicity sage: f=(x-1)^2 sage: f.roots(ring=RealField()) [(1.00, 2)] sage: f=x^3-x-1 sage: f.roots(ring=RealField()) [(1.32471795724475, 1)] sage: f.roots(ring=RDF) [(1.32471795724, 1)] sage: f.roots(ring=CDF) [(-0.662358978622 - 0.562279512062*I, 1), (-0.662358978622 + 0.562279512062*I, 1), (1.32471795724 - 1.11022302463e-16*I, 1)] On Friday, June 29, 2012 11:57:33 AM UTC+2, Noud wrote: Hi, I have some polynomials over the RealField() and I would like to find the approximate roots of the polynomials numerical. This is not really a problem, sicne find_root does a good job finding these. But now I also want to know the (approximate) multiplicity of these roots. Is it possible to do this numerically? I would guess that you cannot use the GCD algorithm on this one. I already know that the zeros of these polynomials are not algebraic over the rationals. Best regards, Noud -- 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: Integration issue
It may be branch cut strangeness, but if so it is very strange. The integrand is clearly well-behaved, and the integral, while in terms of the incomplete gamma function, seems to be off the usual branch cut (negative real axis). On Monday, 14 May 2012 15:35:01 UTC+1, Robert Dodier wrote: On 2012-05-14, kcrisman kcris...@gmail.com wrote: This is now http://trac.sagemath.org/sage_trac/ticket/12947. We've had some issues with incomplete gamma functions translating properly in the past, and/or errors in Maxima, but I didn't have time to either look into that or whether there was another ticket open for this, apologies if there is one - just wanted to make sure this was opened. My first guess is that there is branch cut strangeness going on. Sorry, I don't have any details. But if you want to investigate, try integrate(x*cos(x^3), x, 0, u) and then differentiate w.r.t. u, as a point of departure. best, 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 URL: http://www.sagemath.org
[sage-support] Re: Determining if a ring has any non-trivial idempotents
I would doubt it very much. I imagine the same techniques as Fr\ohlich,A. Shepherdson,J.C., Effective Procedures in Field Theory. Phil, Trans. Roy. Soc. Ser. A 248(1955-6) pp. 407-432, can be used to construct a ring which has nontrivial idempotents iss we can determine membership in a recursively enumerable sequence. I think you would need to know how the ring was constructed. On Tuesday, 17 April 2012 19:37:29 UTC+1, diophan wrote: Is there any way in sage to determine if a commutative ring with unity R has any idempotents other than 0 or 1? My R's have infinitely many elements so squaring all the elements isn't going to work. This is equivalent to R being isomorphic to a product of two non-trivial rings. -- 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: Simplification Issue Implicates Canonical Form
Try http://www.cas.mcmaster.ca/~carette/publications/simplification.pdf The real point is that GiNaC's canonical form has different goals from a 'simplify' command in the sense of minimal complexity. One really needs to separate the two, and I don;t know how easy that is with the current design. James On Feb 22, 5:18 pm, Mark Rahner rah...@alum.mit.edu wrote: On Feb 22, 2:37 am, JamesHDavenport j.h.davenp...@bath.ac.uk wrote: Canonical form and simplify aren't the same thing (necessarily). See Carette,J., Understanding Expression Simplification. Proc. ISSAC 2004 (ed. J. Gutierrez), ACM Press, New York, 2004, pp. 72-79. I don't have access to that source but I completely agree, noting that the passage you quoted discusses the results of full_simplify(). What I've reported is primarily a bug in Sage simplification. However, the underlying cause appears to be an issue with the GiNaC canonical form, which apparently tends to proliferate radicals of small integers. Given Sage's dependence upon GiNaC's canonical form, unless Sage aggressively simplifies such expressions, Sage users will see many more expressions like -(3*sqrt(-2/3*(2*(3*sqrt(-2*sqrt(5) + 5) - 2*sqrt(5) +3)/ (sqrt(-2*sqrt(5) + 5) - sqrt(5) + 2) - 3)*el + 1/9*(3*sqrt(-2*sqrt(5)+ 5) - 2*sqrt(5) + 3)^2/(sqrt(-2*sqrt(5) + 5) - sqrt(5) + 2)^2) - (3*sqrt(-2*sqrt(5) + 5) - 2*sqrt(5) + 3)/(sqrt(-2*sqrt(5) + 5) - sqrt(5)+ 2))/(2*(3*sqrt(-2*sqrt(5) + 5) - 2*sqrt(5) + 3)/ (sqrt(-2*sqrt(5) + 5)- sqrt(5) + 2) - 3) My system engineering gut feel is that it would be desirable to address this particular simplification issue closer to the source rather than to try to engineer around it on the simplification end. When I get some free time, I'm going to raise this issue on GiNaC- list. I'm not sure how soon that will be though. -Mark -- 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: Simplification Issue Implicates Canonical Form
On Feb 21, 9:36 pm, Mark Rahner rah...@alum.mit.edu wrote: So once it comes back to Sage, its internal representation goes back to the Ginac one. My initial problem was the severe obfuscation that resulted when extra factors added by the canonical form refused to cancel and then replicated geometrically. Severe obfuscation is obviously a bad thing. It grows out of simple obfuscation of much simpler expressions. Should ( 1/7 * sqrt(21) ).full_simplify() produce 1/7*sqrt(3)*sqrt(7) when sqrt(3)/sqrt(7) is an option? Having fewer factors is an important part of being simpler. In the more complicated expression, the factors involving 7s aren't even adjacent. I don't know if the more complicated forms are required for GiNaC to perform efficiently. However, from an interactive user's perspective, this issue is perplexing because it only involves the representation of constants. What could be simpler? (pun intended) Canonical form and simplify aren't the same thing (necessarily). See Carette,J., Understanding Expression Simplification. Proc. ISSAC 2004 (ed. J. Gutierrez), ACM Press, New York, 2004, pp. 72-79. -- 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: Simplifying log expressions
I was using sagenb,org, so the output isn't actually a SAGE session, but pasting from sagenb.org. It says it is 4.7.2. Glad it's fixed. I guess I ought to download a 4.8 if I'm really going to comment in more detail, given the apparent changes. On Jan 14, 1:47 am, Michael Orlitzky mich...@orlitzky.com wrote: On 01/13/2012 07:38 PM, JamesHDavenport wrote: Unfortunately, full_simplify has its own problems, notably with branch cuts. sage: f = (1/2)*log(2*t) + (1/2)*log(-t) sage: f.full_simplify() 1/2*log(2) In my session, I had the difference of two logarithms. In yours above, you've got the sum. Is that an actual sage session? I get something different on 4.8.alpha6: sage: f = (1/2)*log(2*t) + (1/2)*log(-t) sage: f.full_simplify() 1/2*I*pi + 1/2*log(2) + log(t) In the example below, with t=-1, both logs should have imaginary part pi and real parts log(2) and zero respectively? There's no global function for it, but what you want is to call full_simplify() on the expression. sage: f = (1/2)*log(2*t) - (1/2)*log(t) sage: f.full_simplify() 1/2*log(2) -- 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: Simplifying log expressions
Unfortunately, full_simplify has its own problems, notably with branch cuts. sage: f = (1/2)*log(2*t) + (1/2)*log(-t) sage: f.full_simplify() 1/2*log(2) Unfortunately, when t=-1, we have the sum of the logarithms of two negative numbers, and therefore the imaginary part is 2i pi, not 0 On Jan 12, 10:24 pm, Michael Orlitzky mich...@orlitzky.com wrote: On 01/12/12 17:16, Tom Judson wrote: I would like to simplify the difference of two log expressions to show that I get a constant, but simplify((1/2)*log(2*t) - (1/2)*log(t)) just returns the expression. Does anyone know of an easy fix for this? Preferably, I would like something that Calculus II students could easily use. There's no global function for it, but what you want is to call full_simplify() on the expression. sage: f = (1/2)*log(2*t) - (1/2)*log(t) sage: f.full_simplify() 1/2*log(2) -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
[sage-support] Re: Error: Converting from p-adics to rationals.
As I said previously, you are only going to reconstruct RATIONALs with num,den less than sqrt((1/2)*p^k), i.e. 92 in this case. It is true that the integers are a subset of the rationals, but the convert to integer problem is not a sub-problem of the convert to rational problem. On Jun 16, 3:22 pm, Mel chemmyg...@gmail.com wrote: I do want to convert to an integer in this particular case...but integers are rationals, so I don't understand why I don't just get the integer 344 when I try the following code: sage: K=Qp(7,5) sage: Q=QQ sage: a=344 sage: b=K(a) sage: a=Q(b) -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org
[sage-support] Re: Error: Converting from p-adics to rationals.
I know very little about SAGE, but surely the point is that this is not well-defined: what rational were you expecting? You can only guarantee to get a number with (num,den) sqrt(p^k/2), and there isn't one, as 1 itself doesn't work. Did you wnat to convert to integer? On May 26, 1:53 am, Mel chemmyg...@gmail.com wrote: Specifically, there are certain p-adic numbers that I cannot convert to rationals. As an example, if 1+7^3+O(7^5) is a 7-adic integer with capped relative precision 5, I cannot convert it to a rational. I get the error ValueError: Rational reconstruction of 344 (mod 16807) does not exist. -- 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: Bug in genus of an ideal
The fact that the number of singularities quoted is precisely 2^32-1 makes me suspect a faulty return fo -1 from somewhere. On Nov 21, 5:22 am, VictorMiller victorsmil...@gmail.com wrote: sage: T.t1,t2,u1,u2 = QQ[] sage: TJ = Ideal([t1^2 + u1^2 - 1,t2^2 + u2^2 - 1, (t1-t2)^2 + (u1- u2)^2 -1]) sage: TJ.genus() 4294967295 sage: TJ.dimension() 1 -- 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: Bug (?) in full_simplify()
Disclaimer: I do not know the SAGE code here, just general theory. As BFJ pointed out, there is no 'canonical' form for such expressions, where 'canonical' means (see 2.3.1, p.79 of Davenport, Siret Tournier) that there is a unique representation for every expression. But there may well be a 'normal' form, in the sense that zero only has one representation, so you could try full_simplify(A-B)==0 rather than full_simplify(A)==full_simplify(B). On Nov 20, 3:57 pm, pevzi pevz...@gmail.com wrote: Thank you for your reply. But so is there any way to check if the expressions are equivalent? On 20 ноя, 05:05, BFJ benjaminfjo...@gmail.com wrote: The two expressions you give may be algebraically equivalent, but they're not identical. There is no canonical fully simplified form for a general algebraic expression, so you can't expect full_simplify() to output this non-existant form. If the expressions are simple enough, like polynomials, you might, but not in general. On Nov 19, 3:31 pm, pevzi pevz...@gmail.com wrote: I have two expressions: (x/(2*sqrt(x+1)) + 1/(2*sqrt(x+1)*(sqrt(x+1)+1))) ((x*(sqrt(x+1)+1)+1)/(2*sqrt(x+1)*(sqrt(x+1)+1))) As you see, they are identical, so full_simplify() method should return the same result for both expressions. But: sage: (x/(2*sqrt(x+1)) + 1/(2*sqrt(x+1)*(sqrt(x +1)+1))).full_simplify() 1/2*(x + sqrt(x + 1))/(sqrt(x + 1) + 1) sage: ((x*(sqrt(x+1)+1)+1)/(2*sqrt(x+1)*(sqrt(x +1)+1))).full_simplify() 1/2*(sqrt(x + 1)*x + x + 1)/(x + sqrt(x + 1) + 1) Although sage: ((1/2*(x + sqrt(x + 1))/(sqrt(x + 1) + 1))/(1/2*(sqrt(x + 1)*x + x + 1)/(x + sqrt(x + 1) + 1))).full_simplify() 1 Is this really a bug or I misunderstand something? -- 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: problem with integral (Maxima)
My maxima (5.19.2) also generates an error here. On Nov 8, 8:24 am, pong wypon...@gmail.com wrote: I have encountered a problem in using integral integral(x * sqrt((-2*cos(x))^2 + (2*sin(x))^2), x, 0, pi) correctly gives pi^2 but integral(sin(x) * sqrt((-2*cos(x))^2 + (2*sin(x))^2), x, 0, pi) results in a complaint that Maxima encountered a Lisp error: 2 is not of the type LIST. Why so? Any help? Thanks in advance -- 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: Implication
On Sep 3, 6:56 pm, Jason Bandlow jband...@gmail.com wrote: For polynomial equations, the following should work in general. sage: R.x,y = CC['x','y'] sage: f = x-y sage: g = x^2 - y^2 sage: I = R.ideal([f]).radical() sage: g in I True In general, to see if the equation g == 0 is implied by the equations f1==0, f2==0, ..., fn==0 you can do I = R.ideal([f1, f2, ..., fn]).radical() g in I Assuming that you are working over the complexes (or more generally any algebraically closed field, subject to changing CC appropriately), yes. Ove rthe reals it is solved, but more difficult and I don't know if SAGE has the tools. and sage should appropriately return True or False. I should mention that I don't actually use this very much, so there may be some caveats that I'm not aware of. -- 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: sage.numerical.optimize.minimize() returns without returning a value
On Jul 16, 11:14 pm, Daniel Friedan dfrie...@gmail.com wrote: an update: minimize() is much improved using Harald Schilly's suggestion to provide an explicit gradient function defined with fast_float(). succeeded: minimizing a quartic polynomial in 100 variables containing 1,100,411 terms (in 22329s of cpu time using 100% of one stock Intel core w 64GB RAM) failed : on a quartic polynomial in 120 variables containing 2,217,743 terms. I am in no sense a SAGE epert, and don't even know what software SAGE is using for this. Clearly derivatives are helpful, BUT (even assuming you mean total degree =4), the derivatives will be substantially bigger than the original. Is it worth your while looking at cheap means for derivative evaluation: Morgenstern,J., How to Compute Fast a Function and all its Derivatives: a variation on the theorem of Baur-Strassen. SIGACT News 16(1985) 4 pp. 60-62. -- 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: rational function arithmetic
On May 5, 10:09 am, Mike Hansen mhan...@gmail.com wrote: Hello, On Wed, May 5, 2010 at 5:03 AM, Matt Bainbridge bainbridge.m...@gmail.com wrote: I wrote a sage program which does a lot of arithmetic in the field of rational functions Frac(Q[x,y,z]). The problem is that sage doesn't check for common divisors of the numerator and denominator, so after doing a lot of arithmetic operations, I end up with rational functions whose numerator and denominator are divisible by huge integers (on the order of 2^3000). Is there a reasonable way to get sage to eliminate common factors after each arithmetic operation? Currently, the easiest way to do this is just to work over Frac(ZZ[x,y,z]) which is equivalent. Yes indeed. The basic problem is that QQ is, morally Frac(ZZ), so you are nesting Frac constructors. This is, generally speaking, a bad idea, as we found in Axiom, but hard to prevent. -- 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] Consider a demo at PLMMS 2010
I am a co-organizer of Programming Languages for Mechanized Mathematics Systems (PLMMS 2010): have you considered mounting a demonstration of SAGE at the conference, which is part of CICM 2010 in Paris in early July? There may well be sme SAGE peple at CICM, but I can't find out easily. The details are: --- CALL FOR DEMOS (AND PAPERS) --- In co-operation with ACM SIGSAM, the International Workshop on Programming Languages for Mechanized Mathematics Systems (PLMMS 2010) Part of CICM-2010, in CNAM, Paris, France; 8th of July 2010 Joint with Calculemus, AISC, MKM, and DML --- Important Dates --- ** Abstract submission: Tue 6 April 2010 ** Paper submission:Fri 9 April 2010 * Reviews sent to authors: Mon 10 May 2010 * Author's response deadline: Mon 17 May 2010 ** Demo proposal submission:Mon 17 May 2010 * Notification of acceptance: Mon 24 May 2010 * Camera ready copy due: Mon 7 June 2010 * Workshop:Thu 8 July 2010 Invited Speaker: Jacques Carette (McMaster University, Canada) PLMMS Scope --- The program committee welcomes submissions on programming language issues related to all aspects of mechanised mathematics systems (MMS). In particular: - Mathematical algorithms - Tactics and proof search - Proofs - Mathematical notation Of particular interest are the dimensions of: - Expressiveness - Efficiency - Correctness - Understandability and Usability - Modularity and Extensibility - Design and implementation Mechanised mathematics systems, whether stand-alone or embedded in larger systems, include but are not limited to: - Dependent typed programming languages - Proof assistants - Computer algebra systems - Proof planning systems - Theorem proving systems - Theory formation systems These issues have a very colourful history. Why are all the languages of mainstream computer algebra systems untyped? (Not for lack of trying: Axiom and Magma both enjoy type systems, although they have not (yet) become mainstream.) Why are the (strongly typed) proof assistants so much harder to use than a typical computer algebra systems? What forms of polymorphism exist in mathematics? What forms of dependent types may be used in mathematical modelling? How can MMS regain the upper hand on issues of genericity and modularity? What are the biggest barriers when using more mainstream languages for computer algebra systems, proof assistants or theorems provers? Many programming language innovations appeared in either computer algebra or proof systems first, before migrating into more mainstream programming languages. This workshop is an opportunity to present the latest innovations in the design of MMS that may be relevant to future programming languages, or conversely novel programming language principles that improve upon the implementation and deployment of MMS. Submission Details -- We welcome submission of proposals to present a demo, as well as submissions of papers presenting original unpublished work which is not been submitted for publication elsewhere. Accepted papers will appear in the ACM Digital Library. System demos will be presented at the workshop, and the material from the demo will be made available online. Papers and demos should be submitted via the PLMMS 2010 easychair website: http://www.easychair.org/conferences/?conf=plmms2010 At least one author of each accepted paper/demo is expected to attend PLMMS 2010 and present her or his paper/demo. Papers should be no more than 8 pages in length and are to be submitted in PDF format. They must conform to the ACM SIGPLAN style guidelines using 9-point font size (see http://www.acm.org/sigs/sigplan/authorInformation.htm - this also provides latex templates). Each submission must also adhere to SIGPLAN's republication policy (http://www.sigplan.org/republicationpolicy.htm). Papers will be reviewed by at least three reviewers and the authors will have an opportunity for rebuttal by the response deadline. Demo proposals may be formatted as the author finds most suitable, but should include a brief description of the system and proposed contents of the demo. Links - * http://www.easychair.org/conferences/?conf=plmms2010 abstract and paper submission webpage * ttp://www.acm.org/sigs/sigplan/authorInformation.htm submission style guide * http://www.sigplan.org/republicationpolicy.htm republication policy * http://dream.inf.ed.ac.uk/events/plmms-2010/ the PLMMS 2010 web site * http://cicm2010.cnam.fr/ the CICM 2010 conference web site James Davenport Recently: Visiting Full Professor, University of Waterloo