[sage-support] Re: Find_root not finding a root
On 2018-03-15, Dima Pasechnik wrote: > it could be a different function, which potentially would run much longer, > by repetitive splitting of the interval > (I guess that's what Mathematica is doing) I have toyed with the idea of repurposing whatever adaptive splitting code is in the plotting functions to finding initial intervals for the 1-d numerical root finder. There is a similar need in the plotting code to try to assess the wiggles of the function in order to judge if the plot is smooth enough. In any event, reusing the plotting code's splitting algorithm would at least mean that a multi-root finder would find the same roots as a human inspecting a plot and calling the root finder accordingly. (I'm guessing that look at plot + call root finder is the most common heuristic; I don't really have any evidence for that.) Maxima, which I'm familiar with, has its own plotting code, dunno about Sage, in any event just reusing the splitting algorithm isn't any big deal. best, Robert Dodier -- 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 https://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
[sage-support] Re: Error with simple integral, "CEXPT only defined for non-negative integral exponents."
On 2017-11-09, Ralf Stephan wrote: > On Tuesday, November 7, 2017 at 6:06:05 PM UTC+1, saad khalid wrote: >> integral(525.87*(x)^(-2.35),x,.1,1) > This is user error because this works fine: > > sage: integral(52587/100*(x)^(-235/100),x,.1,1) > 8331.031741769872 > > Never use inexact values in integral terms. Well, some experimentation shows that with keepfloat = false (the default), it works OK. But keepfloat = true (as in Sage) it bumps into this error. keepfloat causes trouble in other places too ... every now and then I think we (Maxima project) should dump it. best Robert Dodier -- 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 https://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
[sage-support] Re: Integration bug?
On 2017-10-26, david.guichard wrote: > integral(sqrt(1+cos(x)^2),x,0,pi) > > 0 The bug appears to be tickled by the Maxima package abs_integrate. Without abs_integrate, integrate(sqrt(1 + cos(x)^2), x, 0, %pi) just returns a noun expression. > Zero is decidedly not correct. The problem is apparently here: > > integral(sqrt(1+cos(x)^2),x) > > -1/24*sin(3*x) + 1/8*sin(x) Hmm, for the indefinite integral I get (with abs_integrate) (%i4) integrate(sqrt(1+cos(x)^2),x); (%o4) ((2*sin(3*x)+6*sin(x))*false-sin(3*x)+3*sin(x))/24 Obviously the presence of 'false' is a bug. If you can make a bug report in the Maxima bug tracker, that would very helpful. https://sourceforge.net/p/maxima/bugs By the way I am working with Maxima 5.40+ (almost 5.41). best, Robert Dodier -- 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 https://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
[sage-support] Re: taylor(1/4*x-x^2,x,0.2,3)
On Tuesday, July 11, 2017 at 7:23:20 AM UTC-7, Marcin Kostur wrote: > sage: taylor(1/4*x-x^2,x,0.2,3) > ... > typeError: ECL says: In function GCD, the value of the first argument is > -0.6003 > which is not of the expected type INTEGER > > but > sage: taylor(1/4*x-x^2,x,0.2,3) works ;-)) > > A lot of Maxima was written assuming exact numbers (integers and rationals) -- you have found such a function. Generally Maxima converts floats to rationals in symbolic algorithms, but there is a global flag keepfloat, which is set to true by Sage, to prevent that conversion. That causes trouble, given the widespread implicit assumption about exact numbers. It's a bug of course -- perhaps you can submit a bug report to: http://sourceforge.net/p/maxima/bugs but you can work around it by setting keepfloat to false, or writing 1/5 instead of 0.2. best, Robert Dodier -- 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 https://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
[sage-support] Re: This limit seems to be wrong
On 2017-01-22, Dima Pasechnik wrote: > (%i1) limit((2^(2*x+1)+(2^x*x^100)^(3/2))/(4^x-100*2^x),x,inf); > (%o1) 2 > > Although calling this version of Maxima as > sage: ((2^(2*x+1)+(2^x*x^100)^(3/2))/(4^x-100*2^x)).limit(x=infinity) > > gives -Infinity, still, as it's not called with default settings, but with > something that breaks it sometimes. With Maxima 5.39.0 I find that domain=complex seems to tickle the bug. (%i1) domain; (%o1)real (%i2) limit((2^(2*x+1)+(2^x*x^100)^(3/2))/(4^x-100*2^x),x,inf); (%o2) 2 (%i3) domain:complex $ (%i4) limit((2^(2*x+1)+(2^x*x^100)^(3/2))/(4^x-100*2^x),x,inf); (%o4)minf I've opened https://sourceforge.net/p/maxima/bugs/3279/ for this and also https://sourceforge.net/p/maxima/bugs/3280 for a related bug. HTH Robert Dodier -- 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 https://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
[sage-support] Re: error using simple solve example
On 2016-08-24, Paul Johnson wrote: > File > "/Applications/SageMath-7.3.app/Contents/Resources/sage/local/lib/python2.7/site-packages/sage/interfaces/maxima_lib.py", > line 105, in > ecl_eval("(set-locale-subdir)") > File "sage/libs/ecl.pyx", line 1315, in sage.libs.ecl.ecl_eval > (/Applications/SageMath-7.3.app/Contents/Resources/sage/src/build/cythonized/sage/libs/ecl.c:10158) > File "sage/libs/ecl.pyx", line 1330, in sage.libs.ecl.ecl_eval > (/Applications/SageMath-7.3.app/Contents/Resources/sage/src/build/cythonized/sage/libs/ecl.c:10097) > File "sage/libs/ecl.pyx", line 343, in sage.libs.ecl.ecl_safe_eval > (/Applications/SageMath-7.3.app/Contents/Resources/sage/src/build/cythonized/sage/libs/ecl.c:5162) > RuntimeError: ECL says: The function SET-LOCALE-SUBDIR is undefined. Well, Sage is punting 'solve' to Maxima, and it looks like Maxima isn't loaded correctly or something. SET-LOCALE-SUBDIR isn't anything important, it's only setting the subdirectory for the on-line documentation. One could delete that call, but I'm guessing one would then run into a similar error with the next call to a Maxima function. Sorry I can't be more helpful, Robert Dodier -- 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 https://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
[sage-support] Re: Easy definite integral
On 2016-08-19, Montgomery-Smith, Stephen wrote: > sage: integrate(y*e^(-y),y,0,t) > > Huge amount of error messages deleted, followed by: > > ValueError: Computation failed since Maxima requested additional > constraints; using the 'assume' command before evaluation *may* help > (example of legal syntax is 'assume(t>0)', see `assume?` for more details) > Is t positive, negative or zero? > However the integral is an analytic function, and exists even if t is > negative or complex. On looking into the source code, I see Maxima is trying to classify the type of problem, and using asksign for that. Maxima can actually get the result without resorting to asksign, but it doesn't try that first. The relevant function, if anybody cares, is METHOD-BY-LIMITS in src/defint.lisp. I dunno if this is a bug. It is needlessly clumsy but not incorrect. HTH in some way. Robert Dodier -- 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 https://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
[sage-support] Re: Possible bug in numerical integration
On 2016-05-31, Peter Luschny wrote: > def T(v): > def f(t): return (tanh(exp(i*t))/exp(i*t*v)).real() > c = integral_numerical(f(t), 0, 2*pi)[0] > return (c*gamma(v+1)/(2*pi)).n() > > print [round(T(n)) for n in range(10)] > > Sage returned: [0, 1, 0, -1, 0, 8, 0, -136, 0, 3968] > I expected:[0, 1, 0, -2, 0, 16, 0, -272, 0, 7936] With Maxima built from recent source (approximately Maxima 5.38), I get results that agree with what you expected: for v:0 thru 9 do print(float(gamma(v+1)/(2*%pi)*first(quad_qags(f(t),t,0,2*%pi; => - 4.417437057588218E-17 1.0 - 5.300924469105862E-17 - 1.98 - 6.361109362927033E-16 15.81 3.180554681463517E-15 - 271.99945 6.055776113506536E-12 7936.0022 My first guess is that the real part was being computed incorrectly and now it's fixed. For realpart(tanh(exp(%i*t))/exp(%i*t*v)) I get: (sin(5*t)*sin(2*sin(t)))/(cos(2*sin(t))+cosh(2*cos(t))) +(cos(5*t)*sinh(2*cos(t)))/(cos(2*sin(t))+cosh(2*cos(t))) Are you getting something different for that? If so maybe that explains the difference. I guess I'm also assuming that Sage punts to Maxima for real() here. But integral_numerical is probably not calling Maxima, right? best Robert Dodier -- 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 https://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
[sage-support] Re: incorrect limit
On 2016-04-17, kcrisman wrote: > Thanks. In pure Maxima we get: > > (%i3) limit((x^(1/x)-1)*sqrt(x),x,inf); > (%o3) inf > (%i4) limit((x^(1/x)-1)*sqrt(x),x,0); > (%o4) und > (%i5) limit((x^(1/x)-1)*sqrt(x),x,0,plus); > (%o5) 0 > (%i6) limit((x^(1/x)-1)*sqrt(x),x,0,minus); > (%o6) inf > > From what I understand, the first of these is wrong, maybe also the last > (should it be infinity (complex infinity) instead?). I think the first and last are wrong -- last should infinity or und (undefined), I think. I've opened bug reports for these: https://sourceforge.net/p/maxima/bugs/3142/ https://sourceforge.net/p/maxima/bugs/3143/ and some other limit bugs I've run into while investigating these. gruntz is better here -- (%i5) gruntz((x^(1/x)-1)*sqrt(x),x,inf, minus); (%o5) 0 (%i6) gruntz((x^(1/x)-1)*sqrt(x),x,0, plus); (%o6) 0 (%i7) gruntz((x^(1/x)-1)*sqrt(x),x,0, minus); (%o7) gruntz(sqrt(x)*(x^(1/x)-1),x,0,minus) gruntz is one of the methods called from limit. Putting gruntz first (which I tried as an experiment) introduces its own problems though. That exposes some bugs in gruntz, and also some results which are different, so it would be necessary to trawl through them and verify that they're correct. best Robert Dodier -- 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 https://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
[sage-support] Re: wrong result for integral(sqrt(cos(x)-cos(x)^3), x, 0, pi/2)
On 2016-01-21, kcrisman wrote: >> Using SageMathCloud I was surprised to find this bug: >> >> integral(sqrt(cos(x)-cos(x)^3), x, 0, pi/2) >> -2/3 >> >> The correct result is 2/3 (luckily I noticed that something was wrong >> because the result must be positive!) > Usually such things are due to abs_integrate (see e.g. > http://trac.sagemath.org/ticket/12731 and > http://trac.sagemath.org/wiki/symbolics), but interestingly, abs_integrate > comes to the *rescue* when domain:real. The problem here is due to > domain:complex (which is our default). After looking at this, I think it's a limit bug. domain:complex comes into play because it causes integrate to return a different form of the antiderivative, for which the computed limit at 0 is incorrect (although the behavior of limit seems to be the same for domain:real and domain:complex). Reported as: https://sourceforge.net/p/maxima/bugs/3126/ best Robert Dodier -- 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 https://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
[sage-support] Re: Issue with Solve
On 2015-02-27, j wade wrote: > If I just enter > > solve(90*e^(-1)/c == 1.50, c) > > I again get []. > > But, if I enter > > b=var('b') > solve(90*e^(-1)/b == 1.50, b) > > I get the solution: > > [b == 60*e^(-1)] For the record, when I try this directly in Maxima, the equation is solved in both cases. (I assume that Sage calls Maxima to solve equations; is that right?) Heaven knows Maxima has > 1 bug in which results depend on the names of variables, but I guess this isn't one of them. best, Robert Dodier -- 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/d/optout.
[sage-support] Re: simple 'solve' error, possibly related to ecl and maxima installation
On 2014-11-23, kcrisman wrote: > See http://trac.sagemath.org/ticket/17375 for some possible details on why > if this thread hasn't said so. Anyway, hopefully we'll have a quick update > so that Maxima works correctly whether or not you have a compiler available. I'm working on it, for the record. best Robert Dodier -- 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/d/optout.
[sage-support] Re: Why solve(5^( x -1) == (0.04)^(2*x), x) returns empty set?
On 2014-11-20, Emmanuel Charpentier wrote: > BTW, Maxima has this kind of logic (for example, "is" can return "true", > "false" or "unknown") and uses it, so it's at least conceptually doable. > And useful ! But with very deep consequences. For the record, Maxima has a global flag prederror which governs the evaluation of predicates. When prederror=false (default), is(p) => unknown when p is not known (to Maxima) to be true or false, and if p then ... evaluates to a partially-evaluated conditional expression. When prederror=true, is(p) and if p then ... trigger an error. In practice, this has worked well enough, i.e. without causing too much confusion -- I don't remember any complaints about programs assuming true/false not working as expected. A more theoretical problem is that Maxima's partial evaluation policy isn't entirely consistent -- when p isn't decidable to Maxima, you can get a partially-evaluated conditional, but not a partially-evaluated loop (triggers an error), and various programming functions (e.g. length, first, integerp) might act in an unexpected way. This, too, hasn't caused trouble, from what I remember. FWIW Robert Dodier -- 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/d/optout.
[sage-support] Re: Bug in symbolic integral
On 2014-11-12, Johannes Lippmann wrote: > *symbolic way* > (I think this is wrong) > > sage: N(integral(1/log(x)^2,(x,2,3))) > *0.536566859259958* Hmm, I can't reproduce this problem. I am working w/ Maxima 5.34.1. (%i1) display2d : false $ (%i2) foo : 1/log(x)^2 $ (%i3) integrate (foo, x, 2, 3); (%o3) gamma_incomplete(-1,-log(3))-gamma_incomplete(-1,-log(2)) (%i4) %, numer; (%o4) 1.273097216447114 (%i5) integrate (foo, x); (%o5) gamma_incomplete(-1,-log(x)) (%i6) ev (%, x=3) - ev (%, x=2); (%o6) gamma_incomplete(-1,-log(3))-gamma_incomplete(-1,-log(2)) (%i7) %, numer; (%o7) 1.273097216447114 (%i8) quad_qags (foo, x, 2, 3); (%o8) [1.273097216447114,1.413421842285782E-14,21,0] Looks like Maxima handles the definite and indefinite integrals as expected. Or perhaps I have misunderstood the problem? Hope this helps, Robert Dodier -- 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/d/optout.
[sage-support] Re: Having issues with assume
On 2014-10-25, Chris Maness wrote: > When I enter in the code: > > a,b=var('a b'); > assume(4*b^2-4*a^2<0); > assume((b-a)*(b+a)<0); > integrate(1/(a-b*sin(x)),x,-oo,oo) > > It complains and asks whether (b-a)*(b+a) is negative or positive. This is > redundatnt as I have already made this clear above. Is this a bug, or am I > missing something? This is a bug. If you have time, can you please report it to the Maxima bug tracker: http://sourceforge.net/p/maxima/bugs best, Robert Dodier -- 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/d/optout.
[sage-support] Re: matrix log?
On 2014-10-21, Rafael wrote: > Does sage have built-in the analog of MatrixLog in Mathematica? > > I noticed that one can use logm in scipy: > > from scipy import linalg > matrix(linalg.logm(mat)) Well, in Maxima there is mat_function, e.g.: load ("diag"); mat_function (log, mymatrix); For large, numerical matrices, I'm sure linalg.logm is much faster. But for small or nonnumerical matrices, maybe Maxima is useful. Hope this helps, Robert Dodier -- 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/d/optout.
[sage-support] Re: solve(-(1/2*sqrt((4*w+1)+1))*t+w==0,w)
On 2014-10-15, platane wrote: > solve does not solve ? > > sage: solve(-(1/2*sqrt((4*w+1)+1))*t+w==0,w) > [w == 1/2*sqrt(4*w + 2)*t] Well, if I'm not mistaken, Sage punts to Maxima's 'solve' function, which, I'm sorry to report, is not very strong (it can solve a relatively narrow range of problems). But I find that Maxima's 'to_poly_solve' can solve it. Maybe someone here can say how to call it from Sage. > In fact, the solution is: w=t+t^2 Are you sure? Assuming some value for t, plotting the expression doesn't seem to show a solution at w = t + t^2. best Robert Dodier -- 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/d/optout.
[sage-support] Re: Fwd: [sage-cloud] Strange behavior when integrating 1/x^p
On 2014-10-15, William Stein wrote: > If I try the following integrals, the first three work, but the last > returns an error (RuntimeError: ECL says: CEXPT only defined for > non-negative integral exponents.). > > integral(1/x^(1/2),x,1,10) > integral(1/x^.5,x,1,10) > integral(1/x^(3/2),x,1,10) > integral(1/x^1.5,x,1,10) The immediate cause of the error is that Sage enables the keepfloat flag, otherwise Maxima converts floats to rationals when trying to compute integrals. Some (maybe a lot) of the code for working with polynomials and rational functions expects only integers and rationals, so the presence of floats causes trouble. I suppose that we have to decide between fixing up Maxima to handle floats everywhere that keepfloat might introduce them, or do away with keepfloat. I'm in favor of the latter. Probably would be helpful if someone would file a bug report. http://sourceforge.net/p/maxima/bugs best, Robert Dodier -- 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/d/optout.
[sage-support] Re: Segfault on integration
On 2014-09-20, Kristoffer Ryhl-Johansen wrote: > f(x)=log(1-x)*log(1+x)/(1+x) >> >> f.integrate(x,0,1) >> > Produces a segfault when I run it on my ubuntu 14.04 computer Fixed by Maxima commit f7921c5265 (bug in Risch code). best Robert Dodier -- 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/d/optout.
[sage-support] Re: Segfault on integration
On 2014-09-20, Nils Bruin wrote: > (%i1) load(abs_integrate); > (%o1) > /usr/local/sage/sage-git/local/share/maxima/5.33.0/share/contrib/integration/abs_integrate.mac > (%i2) integrate(log(1-x)*log(1+x)/(1+x),x,0,1); > Maxima encountered a Lisp error: > > BINDING-STACK overflow at size 10240. Stack can probably be resized. With Maxima 5.34.0, I find that it TRYRISCH and TRYRISCH1 call each other endlessly. At first glance, I can't see what's going on; there is some funny business with special (global) variables. Also, I looked to see if the bug is triggered by one of the other packages loaded by abs_integrate, but that doesn't seem to be the case; so I guess the problem is triggered by abs_integrate itself. I will try to investigate some more. If someone files a bug report, that will help us track it. http://sourceforge.net/p/maxima/bugs best Robert Dodier -- 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/d/optout.
[sage-support] Re: apparent numerical integration bug in sage
On 2014-08-29, kcrisman wrote: > sage: gp.eval('intnum(x=1,1000,1/sqrt(x^4+2))') > '0.88156906043147435374520375967552406680' > sage: gp.eval('intnum(x=1,1,1/sqrt(x^4+2))') > '0.88156906044791138558085421922579474969' Hmm, what method does PARI/GP use? The documentation for intnum doesn't seem to mention any algorithms. ... I just looked at the source code (intnum.c) and I can't tell what's going on. There is some code for Romberg's method (intnumromb) but it's not called from intnum. > Harald, thanks. I think now we have six or seven ways to do quadrature in > Sage! Yes, but most of them are QUADPACK, right? best Robert Dodier -- 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/d/optout.
[sage-support] Re: apparent numerical integration bug in sage
On 2014-08-29, kcrisman wrote: > sage: numerical_integral(f2,1,10^8) > (0.8815690504421161, 3.309409685784312e-09) > sage: numerical_integral(f2,1,10^9) > (0.8815690594421439, 2.7280605832086615e-08) > sage: numerical_integral(f2,1,10^10) > (0.8815690603426408, 6.194229607849825e-07) > sage: numerical_integral(f2,1,4.5*10^10) > (0.8815690604198958, 2.5079492928729825e-11) > sage: numerical_integral(f2,1,10^11) > (2.3214916598860602e-07, 4.5569931705290324e-07) > This uses the Gnu Scientific Library. Perhaps this is a limitation of how > it is constructed. But I have a feeling someone else who knows more about > the internals of quadrature methods will have more info, so for now I've > opened http://trac.sagemath.org/ticket/16905 for this bug. Thank you! Sage punts numerical integrals to QUADPACK or a translation of it, right? QUADPACK is based on Gauss-Kronrod rules which are essentially Gaussian integration + an efficient refinement scheme. To determine whether to refine the estimate, the integrand is evaluated at some points. The difficulty with 1/sqrt(x^4 + 2) is that it is nearly zero for much of the interval (1, 10^11). If it is close enough to zero at the evaluation points, the refinement heuristic can be fooled. Probably other quadrature methods can be fooled in a similar way. I guess this is a bug in the sense that the result is far from correct even though the code is a correct implementation of the method. I wonder what other heuristic could be invented -- maybe since we can see that integrals on shorter intervals are much larger and the integrand is nonnegative, the integral on the whole interval must be at least that large -- perhaps that can be formalized. I am trying the examples with QUADPACK functions in Maxima -- I find that quad_qags(f2, x, 1, 10^11) fails (with error=5, "integral is probably divergent or slowly convergent") but quad_qag(f2, x, 1, 10^11, 4) succeeds, likewise quad_qagi(f2, x, 1, inf) succeeds. If Sage is indeed calling QUADPACK, perhaps at least the error number can be reported? For what it's worth, Robert Dodier -- 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/d/optout.
[sage-support] Re: Won't Integrate
On 2014-07-04, Chris Maness wrote: > integrate(exp(-k^2/(4*a))*exp(i*k*x-i*hbar*k^2*t/(2*m)),k,-oo,oo) Well, I see the integrand is a quadratic (with constant term = 0) in k, so you can try integrate(exp(A*k^2 + B*k), k, -oo, oo) (Maxima, and therefore Sage, can solve that) and then substitute A and B into the result. You can get A and B via ratcoef(foo, k^2) and ratcoef(foo, k) where foo is the quadratic (I assume there's a way to call ratcoef). It's certainly reasonable to expect that Maxima should carry out that analysis on its own; it's not a bug although it is certainly a drawback. I don't know if e.g. SymPy could solve it; I didn't try. best Robert Dodier -- 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/d/optout.
[sage-support] Re: Having trouble with syntax and nesting integral into limit
On 2014-06-06, kcrisman wrote: > lim(1/n^2*integrate(sin((2*n+1)*x)/sinh(x),x,0,pi/2),n=infinity) I couldn't make any progress with the integral (in Maxima). Computing the integral numerically with quad_qawo (same function should be in Sage somewhere) suggests that it's pi/2 as n increases without bound. So I'm guessing the limit is zero. If you need a proof, maybe you can show the integral is bounded, therefore the limit is zero. Sorry I can't be more helpful, Robert Dodier -- 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/d/optout.
[sage-support] Re: ECL says: In function GCD, the value of the second argument is not of the expected type INTEGER
On 2014-06-03, Nils Bruin wrote: > It means Maxima, which gets used for integration, runs into a problem. > This is because sage instructs maxima to keep floating point values > rather than substitute them with rational or integer values. Apparently > you are hitting a branch in the integration code that doesn't like that. Agreed with this assessment. As for a workaround -- first thing to try is to replace literal floats with symbols, and then substitute values into the result. Second thing is to avoid floats by replacing them with equivalent rational numbers, e.g., replace 6.02e-23 with 602*10^-25. best Robert Dodier -- 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/d/optout.
[sage-support] Re: Does Sage support content mathML?
On 2014-05-27, TAM wrote: > I was wondering if Sage supports saving an equation in content and > presentation mathML? I don't know if there is anything in Sage and/or Python for that, but anyway, Maxima has a couple of add-on packages to export an expression as content MathML and presentation MathML. I tinkered with maximaMathML a couple of months ago and it seemed to work OK (after fixing some bugs). Write me off-list if you're interested. best Robert Dodier -- 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/d/optout.
[sage-support] Re: wrong or nonexistent results for various infinite sums
On 2014-04-23, Karl S wrote: > #taylor coefficient for erf(3x) > a_erf(m) = (3)^(2*m+1)*(-1)^m*2/sqrt(pi)/(factorial(m)*(2*m+1)) > > #coefficient of chebyshev polynomial > c_erf_cheb(p) = sum(a_erf(m)*binomial(2*m+1,m-p)*4^-m,m,p,oo).simplify_full > () > > Here the function c_erf_cheb(p) ends up being > > -6/11*(bessel_I(6, -9/2) - bessel_I(5, -9/2))*sqrt(e)*e^(-5)/sqrt(pi) Hmm, what is p in that result? For small values of p I get something similar but not the same. > which, to me, is a very useful answer. But other sums are simply wrong. > > k = var('k') > sum(x^(2*k)/factorial(2*k),k,0,oo) I'm working with Maxima 5.33.0. I get simplify_sum ('sum(x^(2*k)/factorial(2*k),k,0,inf)); => sqrt(%pi)*bessel_i(-1/2,x)*sqrt(x)/sqrt(2) which seems to be cosh(x). > sum(x^(3*k)/factorial(2*k),k,0,oo) I get simplify_sum ('sum(x^(3*k)/factorial(2*k),k,0,inf)); => sqrt(%pi)*bessel_i(-1/2,x^(3/2))*x^(3/4)/sqrt(2) Hope this helps, Robert Dodier -- 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/d/optout.
[sage-support] Re: How to compute sum(log(1-1/n^2),n,2,oo)?
On 2014-04-16, kcrisman wrote: > (%i11) simplify_sum(sum(log(1-1/x^2),x,2,inf)); > inf + 2 > (%o11) log(---) >2 (inf + 1) > > Which I agree is not a great answer. Using simpsum does the same thing. > I'm not sure if this is expected behavior in Maxima, though? Well, %o11 is certainly incorrect, although it is perhaps not too surprising. simplify_sum makes use of several methods, including Gosper's and Zeilberger's methods, which (if I recall correctly) are applicable to indefinite finite sums (i.e., upper limit is a symbol, say m, such that m < inf). My guess is that such a method was applied mistakenly to %i11. Of course, that's a bug in simplify_sum. For the record: (%i19) simplify_sum (sum (log (1 - 1/x^2), x, 2, m)); (%o19) log((m+1)/(2*m)) (%i20) limit (%, m, inf); (%o20) -log(2) best, Robert Dodier -- 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/d/optout.
[sage-support] Re: Integral result discrepancy between SAGE and MAPLE
On 2014-04-16, jorges wrote: > Indeed, that looks good. I still don't understand what you mean by "the > symbolic integration is not valid when q=1". I would think substituting > before or after should not make a difference. Well, if they're not the same, that's a bug in Maxima. If you have time, it would be terrific if you could make a bug report. See: http://sf.net/p/maxima/bugs > Also, I remember that I > attempted to simplify before integrating before, mainly to speed up > calculations, but had some bad experience with real numbers and maxima. I > can't recall the precise details right now, but after that I "learned" to > defer substitution to the very end. A different way to handle that is to change the floats to rational numbers, via ratsimp. Then Maxima will be happy with expressions which contain those numbers. Hope this helps, Robert Dodier -- 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/d/optout.
[sage-support] Re: simplification of symbolic expressions
On 2013-11-22, John Cremona wrote: > 1. It is a fact that if a^2+b^2=1 then arcsin(a)+arcsin(b)=pi/2, but > how can I get this to happen automatically? I have an expression > which comes out as > > arcsin(1/3*sqrt(3)*sqrt(2)) + arcsin(1/3*sqrt(3)) > > which I would like to get simplified in this way. I think this can be achieved via simplification rules in Maxima. I don't know if there are other ways to get the same result elsewhere in Sage (if so I am interested to hear about it -- I wouldn't mind adopting some ideas into Maxima). Here's what I have. matchdeclare (aa, lambda ([e], not atom(e) and op(e) = nounify(asin))); matchdeclare (xx, lambda ([e], atom(e) or op(e) # nounify(asin))); tellsimpafter (aa + xx, xx + FOO1 (aa)); FOO1(a):=if op(a) = "+" then FOO2 (a) else a; FOO2(a):=(a:args(a), for i thru length(a) do (for j from i + 1 thru length(a) do if a[i] # 0 then (FOO3 (a[i], a[j]), if %% # false then [a[i], a[j]] : [%%, 0])), apply ("+", a)); FOO3(u,v):=if is (equal (args(u)[1]^2 + args(v)[1]^2, 1)) = true then %pi/2; If there are any asin terms, call FOO1 on them. If there's more than one, FOO1 gets an expression like asin(u) + asin(v) + ... (otherwise it's just asin(u)), so call FOO2 on the "+" expression. FOO2 marches thru the list of asin terms and tries to combine them two by two (via FOO3). With that I get the following: (%i9) asin(sqrt(3)*sqrt(2)/3) + asin(sqrt(3)/3); (%o9) %pi/2 (%i10) asin(sqrt(3)*sqrt(2)/3) + asin(sqrt(3)/3) - 1; (%o10) %pi/2-1 (%i11) asin(sqrt(3)*sqrt(2)/3) + asin(sqrt(3)/3) - x + y; (%o11) y-x+%pi/2 (%i12) asin(sqrt(3)*sqrt(2)/3) + asin(sqrt(3)/3) - asin(x) + u; (%o12) -asin(x)+u+%pi/2 (%i13) asin(sqrt(3)*sqrt(2)/3) + asin(sqrt(3)/3) + asin(sqrt(1 - u^2)) + asin (u); (%o13) %pi This is just what I got from some half-hearted hacking; I'm sure there are serious limitations. Good luck, have fun, & hope this helps. Robert Dodier -- 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: Integration of formal functions
On 2013-07-27, Emmanuel Charpentier wrote: > (%i2) define(h(x),integrate(f(t),t,g1(x),g2(x))); > > defint: lower limit of integration must be real; found g1(x) > -- an error. To debug this try: debugmode(true); Well, a way to make this work is to write define(h(x), 'integrate(...)). 'integrate is a formal integral -- it doesn't invoke the code to solve definite integrals -- so it won't bump into that error. best Robert Dodier -- 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: Error summing inverses of binomial coefficients
On 2013-07-18, Ed Scheinerman wrote: > sage: sum(1/binomial(n,k),k,0,n) > (n + 1)*2^(-n) > > and that answer is wrong. That's a bug in Maxima's simplify_sum -- reported as bug # 2614. https://sourceforge.net/p/maxima/bugs/2614/ best Robert Dodier -- 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: Bug in evaluation of Maxima numbers? Or where? Or not a bug at all?
On 2013-07-19, Jesús Torrado wrote: > sage: maxima('spherical_bessel_j(50,9.5)') > 18.003620332195756l-33 > sage: spherical_bessel_J(50,9.5, algorithm=3D"maxima") # default algori= > thm > 18.0036203322*l - 33 Common Lisp allows four float types -- short, single, double, and long. These might or might not coincide. Maxima generally prefers doubles but if there were other types in some formulas, the user might see some non- double result -- I'm guessing that's the case here. Maxima also has a variable-precision software float called a bigfloat, which is not a CL type. HTH Robert Dodier -- 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: Substituting a combination of variables in a matrix
On 2013-04-23, Lorenzo Ricciardi wrote: > Basically, I've been performing various matrix operations, with > symbolic elements. > The final result is very complex, but I can see patterns within it, > so i wanted to rename those patterns with new variable names. That > way, I can express the final result in terms of these new variables only. The Maxima function 'optimize' replaces common subexpressions with made-up variables, and the result is an expression which can be evaluated to give the same result as the original (ignoring order-of-evaluation effects). Dunno what might be available in Sage proper. best Robert Dodier -- 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?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
[sage-support] Re: Bug in solve?
On 2013-02-24, Rolandb wrote: > Using 5.7 in Windows 64, I got the following message: > > solution=solve([(a*x+b*y)*x*y/c==1,3*log(a + b + c) - > log(27*a*b*x*y)],x,y,solution_dict=True) > for sol in solution: show(sol) > ;;; Detected access to protected memory, also kwown as 'bus or > segmentation fault'. > ;;; Jumping to the outermost toplevel prompt That looks like an error message from ECL. I'm guessing Sage has translated 'solve' here to Maxima's 'to_poly_solve'. I get this with ECL 12.2.1 + current (post-5.29) Maxima source on Linux. (%i1) load (to_poly_solve); Loading maxima-grobner $Revision: 1.6 $ $Date: 2009-06-02 07:49:49 $ (%o1) /home/robert/maxima/maxima-git/maxima-code/share/to_poly_solve/to_poly_s\ olve.mac (%i2) to_poly_solve ([(a*x+b*y)*x*y/c=1,3*log(a + b + c) - log(27*a*b*x*y)],[x,y]); Maxima encountered a Lisp error: BINDING-STACK overflow at size 8448. Stack can probably be resized. Automatically continuing. To enable the Lisp debugger set *debugger-hook* to nil. Maxima encountered a Lisp error: Detected access to an invalid or protected memory address. Automatically continuing. Looks like a stack overflow in to_poly_solve -- I didn't go farther. Can someone please submit a bug report. http://sourceforge.net/p/maxima/bugs best Robert Dodier -- 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?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
[sage-support] Re: Limit and variable
On 2013-01-31, Jori Mantysalo wrote: > This says e^x as it should: > > forget(); > x=var('x'); h=var('h'); > assume(x, 'integer') > f = exp(x) > limit ( (f(x+h)-f(x))/h, h=0) > > If I change assume(x, 'integer') to assume(x, 'rational') I got question > "Is x an integer?" from Maxima. Why so? Looking at the code, it appears that, among other tactics, Maxima tries to find the greatest common divisor of the exponent and something else (didn't look carefully enough to see exactly what is going on). So that would work if the exponent is an integer. However, I doubt if Maxima can do anything unless the exponent is a literal integer, so the question seems pointless. I'd have to look at it again before figuring out if the question could be skipped. best Robert Dodier -- 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?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
[sage-support] Re: solving Diophantine equations in Sage
On 2012-12-08, Volker Braun wrote: > Solving a linear diophantine equation is an application of the Smith form. > > A quadratic diophantine equation can be solved with the Hasse-Minkowski > theorem, though thats is definitely more advanced Thanks for the info. Are there implementations of these approaches in Sage or any upstream project? (e.g. PARI/GP, Singular, I don't know.) best, Robert Dodier -- 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] solving Diophantine equations in Sage
Hello, is there a way to solve Diophantine equations in Sage? If not a general method, perhaps at least some special cases. There is some interest in solving such equations in Maxima -- I am daydreaming about porting whatever implementation Sage has. Is there a generally-accepted more-or-less best method these days? (Whether it is implemented in Sage or not.) There is this web page, http://www.alpertron.com.ar/METHODS.HTM, which describes a method, and this one, http://www.alpertron.com.ar/JQUAD.HTM, which has a calculator. Would anyone care to comment on the suitability of either one as the basis for an implementation? Pointers to any other resources would be interesting. best Robert Dodier -- 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: Unable to Solve Simple Problem
On 2012-10-26, Jan wrote: > I have a similar problem I can't solve > d==b*sqrt(d)+c > for d. All suggestions (to_poly_solve, use_grobner) did not work. For the record, here's what I get with Maxima 5.28.0. I think to_poly_solve has been updated in the not so distant past so maybe Sage is using an older version? (%i2) load (to_poly_solve); (%i3) to_poly_solve (d = b * sqrt(d) + c, d); (%o3) %union(%if(?%and(-%pi/2 < parg(b-sqrt(4*c+b^2)), parg(b-sqrt(4*c+b^2)) <= %pi/2), [d = -(b*sqrt(4*c+b^2)-2*c-b^2)/2],%union()), %if(?%and(-%pi/2 < parg(sqrt(4*c+b^2)+b), parg(sqrt(4*c+b^2)+b) <= %pi/2), [d = (b*sqrt(4*c+b^2)+2*c+b^2)/2],%union())) I didn't check the result; sorry about that. best Robert Dodier -- 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: Jacobi sn
On 2012-09-16, kcrisman wrote: > I don't have access to a Maxima instance right now - can someone try to > recreate this there? For the record, here's what I get w/ Maxima 5.28.0 (current release). (%i1) u : 1.2 $ (%i2) m : 0.5 $ (%i3) jacobi_sn (u, m); (%o3) .8877154886192781 (%i4) jacobi_sn (u + 2 * %i * elliptic_kc (1 - m), m); (%o4) 0.88771548861928 - 1.884363664625109E-15 %i I don't know what version of Maxima Sage is using, and I would have to look at the revision log to see if the elliptic functions have changed since then. best, Robert Dodier -- 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: cryptic error in complex integration
On 2012-08-23, Urs Hackstein wrote: > (8*I*e^(I*t) - 24*I)*((e^(I*t) - 3)^7 + (1.52075e+14)*(e^(I*t) - 3)^6 + > (1.128e+27)*(e^(I*t) - 3)^5 + (1.35375e+38)*(e^(I*t) - 3)^4 - > (3.127e+50)*(e^(I*t) - 3)^3 - (2.929125e+60)*(e^(I*t) - 3)^2 + > (9.4875e+72)*e^(I*t) + 3.1375e+73)*e^(I*t)/((e^(I*t) - 3)^8 + > (1.738e+14)*(e^(I*t) - 3)^7 + (1.504e+27)*(e^(I*t) - 3)^6 + > (2.166e+38)*(e^(I*t) - 3)^5 - (6.254e+50)*(e^(I*t) - 3)^4 - > (7.811e+60)*(e^(I*t) - 3)^3 + (3.795e+73)*(e^(I*t) - 3)^2 + > (4.787e+74)*e^(I*t) - 2.061e+74) > > on t\in[0,2*pi], I receive the following error: > RuntimeError: ECL says: In function GCD, the value of the first argument is > 1.354500021087e74 > which is not of the expected type INTEGER Sage punts to Maxima to compute integrals symbolically, and Maxima is trying to factor the integrand or something like that. Maxima generally prefers exact numbers (integers and ratios of integers) to inexact (fixed- and variable-precision floats). Before trying the integral, can you convert all of the floats to rational numbers? I don't know how to do that in Sage. The integrand is a ratio of sums of complex exponentials. I tried a few variations (the original integrand rationalized, fewer terms, replace numbers with symbols, replace exp with sin and cos) but Maxima wasn't able to solve any of them. I don't know what general class of results one should expect for such an integrand. The presence of floats suggests (I don't know for sure) that you are looking for a numerical result. If so, you can try splitting the integrand into real and imaginary parts, and applying a numerical method (Sage has Quadpack functions) to each part. Hope this helps, Robert Dodier -- 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: numerical integration problem
On 2012-08-08, uwe.schilling wrote: > RuntimeError: ECL says: In function ZEROP, the value of the only argument is > > > ((RAT SIMP) -0.064 1.0) > > which is not of the expected type NUMBER > > > I already figured out that the problem is the decimal number. If I replace > 0.064 by 64, it works fine again. However, I don't understand where the > problem is coming from. Sage is in general able to handle decimal numbers. > Why not in this case? Sage calls Maxima to compute non-numerical integrals. The error you see originates in Maxima. The bug may be fixed in a later version of Maxima than that packaged in your version of Sage -- while working on your problem, I haven't bumped into it. Maxima prefers to work with integers or rational numbers instead of floats -- all of its symbolic computation assumes integers or rationals. So for any symbolic stuff it's best to avoid floats. For the record, here's what I get. I found Maxima cannot solve the integral with explicit numerical values -- it goes off and thinks for a long time; I suspect it is trying to factor a big expression -- so I substituted symbols for the numbers. I tried to tell Maxima something about the relative magnitude of the numerical constants; as it happens, Maxima's "assume" system isn't very strong. I'm working with the current development version. (%i1) display2d : false $ (%i2) e : exp (-a / (-b * x + c)) $ (%i3) assume (a > c, c > b, b > 0) $ (%i4) integrate (e, x, 0, 120); Is %e^(a/(c-120*b))-%e^(a/c) positive, negative, or zero? p; Is %e^(a/(c-120*b))-1 positive, negative, or zero? p; Is c-120*b positive or negative? p; STYLE-WARNING: redefining MAXIMA::SIMP-UNIT-STEP in DEFUN STYLE-WARNING: redefining MAXIMA::SIMP-POCHHAMMER in DEFUN Is c-120*b positive or negative? p; (%o4) -a*(log(a/(c-120*b))-log(-a/(c-120*b))/2+expintegral_ei(-a/(c-120*b)) +log(-(c-120*b)/a)/2 -%e^-(a/c)*(a*%e^(a/c)*log(-c/a) +(2*a*log(a/c)-a*log(-a/c) +2*a*expintegral_ei(-a/c)) *%e^(a/c)+2*c) /(2*a)+(c-120*b)*%e^-(a/(c-120*b))/a) /b (%i5) float (%o4), a = 300, b = 64/1000, c = 14; (%o5) -4687.5*(-8.232626698052029e-13*(2.0244652500289204e+9 *(1838.835087011327 -300.0 *(3.141592653589793*%i +3.064725145040943)) +6.073395750086762e+11 *(3.141592653589793*%i -3.064725145040943)+28.0) -0.5*(3.141592653589793*%i+3.860063266497435) +0.5*(3.141592653589793*%i-3.860063266497435)+3.860063266497435) (%i6) expand (%); (%o6) 4.6287797890697047e-9 If you only need a numerical approximation, you can go straight for that. Maxima has the QUADPACK functions (Sage does too). (%i7) quad_qags (e, x, 0, 120), a = 300, b = 64/1000, c = 14; (%o7) [4.6277003981664117e-9,8.034599325134321e-23,21,0] For better or worse, symbolic integration is still a hard problem -- hard enough, anyway, that the user has to help the computer along. All the 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: triple integral works with sympy but not
On 2012-06-26, Chris Kees wrote: > The following bit of code correctly computes the triple integral > (64\pi/3) for the volume of an ellipse given by 4x^2 + 4y^2 + z^2=16: > > assume(0 < 16 - 4*x**2 - 4*y**2 < 16) > i1 = integral(1,0,sqrt(16 - 4*x**2 - 4*y**2)) > show(i1) > assume(0 < 4 - x**2 < 4) > i2 = integral(i1,y,0,sqrt(4 - x**2)) > show(i2) > i3 = 8*integral(i2,x,0,2,algorithm='sympy') > RuntimeError: ECL says: Error executing code in Maxima: expt: > undefined: 0 to a negative exponent. OK, to reproduce the error looks like it's enough to say: (%i1) i2 : (x^2-4)*asin(sqrt(16-4*x^2)*sqrt(4-x^2)/(2*x^2-8)) $ (%i2) i3 : 8 * integrate (i2, x, 0, 2); expt: undefined: 0 to a negative exponent. I guess that's a bug. If the integration method fails for any reason, integrate should just return a noun expression, I think. Feel free to open a bug report (http://sourceforge.net/projects/maxima to find the bug tracker) and/or bring it up on the Maxima mailing list. I was able to get the desired result by simplifying the integrand: (%i4) radcan (i2); (%o4) -(%pi*x^2-4*%pi)/2 (%i5) i3 : 8 * integrate (%, x, 0, 2); (%o5) 64*%pi/3 although I don't think that will work in general. FTR I'm working with Maxima 5.27 + patches (from Git). 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 URL: http://www.sagemath.org
[sage-support] Re: Integration issue
On 2012-05-15, kcrisman wrote: > (%i3) domain:complex; > > (%o3) complex > (%i4) integrate(x*cos(x^3),x,0,1/2); > > (%o4) > gamma_incomplete(2/3,%i/8)/6+gamma_incomplete(2/3,-%i/8)/6-gamma(2/3)/3 Hmm. I get a different result. I am using the current Git version. domain : complex; integrate (x*cos(x^3), x, 0, 1/2); => %i*gamma_incomplete(2/3,%i/8)/(4*sqrt(3)) -gamma_incomplete(2/3,%i/8)/12-%i*gamma_incomplete(2/3,-%i/8)/(4*sqrt(3)) -gamma_incomplete(2/3,-%i/8)/12+gamma(2/3)/6 expand (float (%)); => .1247560409610377 That's gratifying, but the problem, as I'm sure you know, is that the user won't know they have to change a global variable. > I don't see any of those up here, though, and the gamma_incomplete > evaluation is correct (gives the same via W|A, Sage = Pari in my version, > mpmath, and Maxima). I think that Maxima is somehow using the "real" > antiderivative, if that makes sense - is that possible, Robert? It seems plausible, but I don't know the integration code very well. 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: Integration issue
On 2012-05-14, JamesHDavenport wrote: > 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). Try domain:complex before calling integrate; that changes the result to what I think is expected. I guess (emphasis on guess) that the problem originates not from gamma_incomplete itself but from terms of the form (-1)^(1/n) which are the result of simplifying or evaluating gamma_incomplete. Sorry I can't be more helpful. 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: Integration issue
On 2012-05-14, kcrisman 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: Integration
On Feb 7, 12:00 pm, Francois Maltey wrote: > Santanu Sarkar a crit : > > > How one can find integral abs(cos(x+y)) where x varies from 0 to pi > > and y varies from 0 to pi in Sage? > > You must help Sage (in fact Maxima bellow) for these integrals. The Maxima add-on package abs_integrate can make some progress, but craps out with an error ... load (abs_integrate); foo : integrate (abs (cos (x + y)), x, 0, %pi); => messy expression integrate (foo, y, 0, %pi); => divide by 0 error This is with Maxima 5.23. I didn't check whether the first result is correct. If anyone is interested, maybe you can bring it up on the Maxima mailing list. 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: abs(pi*i) Bug
On Feb 7, 5:05 am, Clemens Heuberger wrote: > I encountered the following bug: > > sage: abs(pi*I) > I*pi > > The correct answer would have been pi. > > Several other examples show a different behaviour, e.g. > > sage: abs(log(2)*I) > abs(I*log(2)) > > Here, the answer is correct (but not particularly helpful, log(2) > would have been better). > > I do not know whether this is related to > http://trac.sagemath.org/sage_trac/ticket/7557 For the record, various bugs fixes and improvements have been made in Maxima's abs function recently. It might be worth the trouble to review ticket 7557 and any similar items with the most recent version of Maxima (5.23). 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 URL: http://www.sagemath.org
[sage-support] Re: Problems with taylor expansion and formal symbolic functions
On Feb 5, 7:16 pm, kcrisman wrote: > More to the point, Maxima doesn't know about any 'special' things you > define like that. Our basic differentiation is handled by Ginac/ > Pynac, which does not have Taylor series (does it?). So unfortunately > I don't know that this is something one can (yet) do directly in > Sage. It might be possible in Maxima directly, if one can define > custom derivatives there. The Maxima function gradef defines derivatives. 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 URL: http://www.sagemath.org
[sage-support] Re: Fourier–Motzkin elimination
On Jan 23, 11:47 pm, tvn wrote: > hi, just wondering if the Fourier-Motzkin algorithm for eliminating > variable from a system of linear inequalities is implemented somewhere in > Sage ? Well, Maxima has the function fourier_elim. I don't know anything about it. It is undocumented, but you can ask about on the mailing list. Sorry I can't be more helpful. 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: Integrate dirichlet distribution problem
On Jun 4, 7:48 am, John Reid wrote: > Implementing a function that evaluates the multinomial beta seems > straightforward. I imagine I could do that if pointed in the right > direction. But did you mean extending maxima so that it knows how to > integrate dirichlet distributions? I wouldn't know where to start with > that. So provisionally the answer is yes, given a few pointers. Please bring it up on the Maxima mailing list. See: http://maxima.sourceforge.net/maximalist.html 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: Convolution and sine integral
On May 19, 8:58 am, Tobias Katz wrote: > Indeed I am looking for s.th. like > > g(t) = convolve(f,sin) > > I am not familiar with Maxima - I had a short look at it but I didn't > find a function like this. Maxima doesn't have a built-in symbolic convolution function although you could formulate one easily enough to just compute integrate(f(u)*g(x - u), u, minf, inf) or whatever definition. I don't know whether a direct approach like that is preferable, or if it's better to compute the convolution via Fourier or Laplace transforms or some other way. FWIW 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: Sage/Maxima desolve_rk4 problem
Looks like the rk function in Maxima doesn't try hard enough to float-ify its argument. I haven't looked at the code, but maybe rk can call COERCE-FLOAT-FUN to construct a function to evaluate the expression. At least that would bring it into line with other Maxima functions which evaluate expressions to numbers (e.g. plotting, quadpack). Follow-ups to the Maxima mailing list. I've appended the original message below. best Robert Dodier PS. On Apr 19, 8:38 am, jvkersch wrote: > Technically, this is not a Sage problem, but I figured I would post it > here anyway since others might have run into the same problem, and I'm > also trying to solve the problem using some Sage/python trickery. > > The problem concerns the use of symbolic constants such as pi in > numerical integration with desolve_rk4. The following code is adapted > from the manual page for desolve_rk4 -- note especially the constant > pi in the specification of the ODE: > > x, y = var('x y') > desolve_rk4(x*y*(2-y) + pi, y, ics=[0, 1], end_points=1, step=0.5) > > and raises the following error: > > TypeError: Error executing code in Maxima > CODE: > sage1 : rk(%pi-x*(y-2)*y,y,1,[x,0,1,0.500])$ > Maxima ERROR: Inconsistent set of equations and variables > > This same error occurs whenever you have an ODE with pi in it, no > matter how simple. The error persists when directly running this > command in Maxima, but works fine (both in Sage and Maxima) when > manually replacing pi by 3.14... Since I don't know any Maxima, I > have no idea of what the problem could be or where to look. > > So, I was wondering if there is a way to have Sage replace the %pi > when invoking Maxima by the corresponding numerical value? I guess I > could store my ODE in a string and use a regular expression to get rid > of any pi's myself, but that seems very inelegant. Is there anything > you would recommend? > > Thanks a lot, > Joris -- 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: Invoking Lisp from within Sage
On Apr 9, 11:32 pm, Adam Getchell wrote: > We've got some rather neat causal dynamical triangulation (2d quantum > gravity) code running in Lisp. The lisp environment lacking certain > facilities, I thought it would be interesting to find a way to run it within > Sage and take advantage of all the nice facilities provided. I'm looking to > avoid rewriting it in python for now, though I would certainly do it if > advised that was the only way. Well, I don't know what are the certain lacking facilities mentioned here, but if they are something provided by Maxima, seems like it would be easier to do this stuff in Maxima -- just launch Maxima and then load your own code (since Maxima is written in Lisp). It's easy to call Maxima functions directly from your code. What are the functions you are looking for? FWIW 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 To unsubscribe, reply using "remove me" as the subject.
[sage-support] Re: bug in taylor expansion with sage and maxima
On Mar 24, 10:32 am, sgouezel wrote: > sage: ( 2.0*sin(x)^3 - sin(x)).taylor(x, 0, 3) > > gives the MAXIMA error "13.0 is not of type INTEGER". This appears to be triggered by keepfloat:true which I think Sage does, right? With keepfloat:false the error is avoided, if I'm not mistaken. Please file a report in the Maxima bug tracker, http://sourceforge.net/projects/maxima/bugs or thereabouts. Maxima strongly prefers exact (integer or rational) numbers to inexact (hardware or software floats). By default (i.e. keepfloat = false) the 2.0 is replaced by 2 before doing the Taylor series. FWIW 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 To unsubscribe from this group, send email to sage-support+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
[sage-support] Re: polygon from list of points
On Feb 4, 1:31 am, Eli Brosh wrote: > I have a scanned digitized graph of a magnetic hysteresis loop. > That is, I have a list of points [(H0,B0),(H1,B1)(Hn,Bn)] > however, the points are not ordered in any meaningful way. > In order to calculate the hysteresis loss, which is the area enclosed by the > loop, I need to somehow convert the list of points into a polyngon > (clockwise or counterclockwise). Hmm, that's an interesting problem. Since you know the physical process, how about treating this as a curve fitting exercise, trying to find the hysteresis curve which best fits the data in (say) the least orthogonal squares sense. I am assuming that a hysteresis curve has some well-known parametrization. Just minimize the goodness of fit over the free parameters of the curve. (Treating the endpoints as free parameters is probably going to complicate it, but that's only a practical problem.) I am assuming that for given parameters, it is easy to compute the area inside the loop. As a bonus you'll get estimates of the physical parameters which might be interesting in themselves. Take a look at Seber & Wild, "Nonlinear Regression". Dunno if such a problem is in there but you might get some inspiration. good luck 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: probability
> On Thu, Jan 28, 2010 at 4:09 PM, michel paul wrote: > > Next week we start probability, and I'm working on a Sage worksheet for my > > students. So far I'm just working on ways to use Sage to represent the > > typical textbook probability examples - dice, cards, etc. Since a lot of > > my students are Jewish, I thought the dreidel example might be good. > > 3. Does anyone have any other ideas for good ways to illustrate probability > > using Sage? This would be for an audience of high school students who are > > very weak in their math but have passed Alg 2 and are motivated for > > college. There's a substantial opportunity here to help your students learn about decision analysis. Probability is a part of that, but it is not enough alone, and for that matter, dice, cards etc are a misleading introduction; proficiency with dice and cards won't get a student very far with practical problems. My advice to you is to get your students started on decision theory. Despite the imposing name, the concepts are elementary and one can make progress with just the simplest arithmetic. (Incidentally a pencil and paper would serve your students better for this purpose than any computer program.) Take a look at "Making Hard Decisions" by Robert Clemen. You'll get much greater interest and participation if you give the students problems to study which are really important (i.e. there is time, money, or life at stake). Some examples: medical testing; car insurance; bicycle or motorcycle accidents; guilt or innocence in court. (I'd like to suggest global warming as well, but heavier equipment is needed just to get started; too bad about that.) Good luck & all the 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: integrate(sec(t)*tan(t),t,0,pi/3), why does definite integral of trig functions give error?
On Dec 24, 11:18 am, William Stein wrote: > The problem -- which is a serious one -- is that Sage's symbolic > integration is by default done using Maxima (this is currently the > main way in which Maxima is used in Sage; the other big way is for > solving symbolic equations). Maxima has a somewhat weak assumptions > system and was designed in the 1960s when the assumption that a user > was at the terminal happily answering questions -- a sort of > conversation -- was considered reasonable. For the record, I believe that strengthening the assume system would be the shortest path towards solving the problem which started this thread. (As opposed to revising or reimplementing the code for definite integration.) FWIW 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: Symbolic convolution usage Sage
On Dec 22, 4:08 pm, Maxim wrote: > I'm trying to do something which I haven't seen any examples so far : > symbolic convolution. I know I can use lists or Piecewise defined > functions to do a convolution, but here my interest is the symbolic > solution. Well, sorry for tooting my own horn but this kind of stuff (fast & loose expression mungeing) is easier in Maxima than in Sage. Maxima doesn't have a built-in solution for the symbolic convolution of functions defined piecewise but it is easy to make some progress on it. See: http://www.math.utexas.edu/pipermail/maxima/2009/017568.html If you're interested in more general problems, write to me and let's see how far we can get. FWIW 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: forgetting assumptions
On Nov 19, 5:31 pm, Mike Witt wrote: > sage: assume(n, 'odd') > sage: assumptions() > [n is odd] > sage: foo=sin((-1)*n*pi) > sage: foo.simplify() > 0 > sage: forget(n, 'odd') > sage: assumptions() > [] > sage: foo=sin((-1)*n*pi) > sage: foo.simplify() > 0 I'm guessing that Sage punts to Maxima for this stuff. For better or worse (mostly worse) there are different ways to declare & undeclare stuff in Maxima. For the "odd" declaration, it's declare(n, odd) and remove(n, odd). I guess assume(n, 'odd') was translated to declare(n, odd) but forget(n, 'odd') was not translated to remove(n, odd). I don't know much about Sage so I could be way off here. A long-range goal for me anyway is to unify various declarations. I see a couple of possibilities. One is FOO(P(x)) where P is some predicate e.g. x is an integer, x is odd, x is less than 10, ... (and FOO is a suitable imperative like "assume", "let", or "declare"). The other is FOO(x in A) where A is a set, which could be a symbol like Z, R, or C, or a description like {x s.t. x < 10} or an enumerated set. i guess both could be recognized but I wonder whether one or the other should be the canonical representation. (I wouldn't be surprised if a lot of ink has been spilled about this problem but I am pretty naive.) If anyone has an opinion about it I would be interested to hear it. FWIW Robert Dodier (a Maxima developer) -- 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: memory limit for maxima
On Nov 13, 9:26 am, Jean-Marc Schlenker wrote: > Hello, I'm trying to do a slightly heavy computation under sage > (symbolic computation of a 9x9 determinant with some polynomials in > cos/sin as entries) but sage crashes with the message: > > "Maxima encountered a Lisp error: > Memory limit reached. Please jump to an outer point or quit program." Aside from allocating more memory, here are a couple of things to consider. (1) try to gauge the time required to find the determinant. How does the time required increase for 2 x 2, 3 x 3, 4 x 4, etc? For symbolic calculations, time & memory can increase much faster than one might expect. (2) Maxima may be able to apply different algorithms to compute determinants, I don't remember for sure. You might ask on the mailing list (max...@math.utexas.edu). Sorry I can't be more helpful. 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: Sage operations on a matrix containing constant vars fail
On Oct 5, 5:43 pm, Paul wrote: > sage: mat1 = Matrix(4,4,[[-e^-((1/2)*a*k),0,sin(-(1/2)*a*l),cos(-(1/2) > *a*l)],[0,e^(-(1/2)*a*k),-sin((1/2)*a*l),-cos((1/2)*a*l)],[-k*e^-((1/2) > *a*k),0,l*cos(-(1/2)*a*l),-l*sin(-(1/2)*a*l)],[0,k*e^(-(1/2)*a*k),l*cos > ((1/2)*a*l),-l*sin((1/2)*a*l)]]) Sage used to call Maxima to compute eigenvalues, maybe it still does. I think Maxima can find the eigenvalues for the above matrix, but it's a huge mess and it takes a long time. Maybe you can substitute a symbol for exp(a*k/2) etc or something like that to make it less messy. Just a guess. FWIW 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: English grammar of numbers
Minh Nguyen wrote: > Usually "an" comes before a word that starts with a vowel, i.e a, e, > i, o, u. So one would say "an eight o'clock meeting" or "an 8 o'clock > meeting". More examples: an amphibian, an egg, an igloo, an octopus, > an umbrella. However, there are situations when this rule doesn't > apply. In software engineering, one uses UML diagrams as part of the > design process. Although this acronym starts with a capital "u", it's > pronounced and written as "a UML diagram" not "an UML diagram", just > as in "a ewe" not "an ewe". In American English at least (I just don't know about other varieties) it is typical to change some vowels into diphthongs, in particular to change initial u into iu instead. In iu, i acts as a semivowel, and it's typical to use the article "a" in front of a word beginning with iu, e.g. a unicorn. But e.g. "urn" doesn't have the initial semivowel, so the article is "an", so "an urn". The other semivowel (there might be still others, but I can't think of them at the moment) is w as in "one". As with semivocalic i, the article for semivocalic w is "a", e.g. a one-time deal. In all varieties of English, there is a pretty broad gulf between orthography and pronunciation. (I don't know if the orthography was fixed ages ago and pronunciation continued to evolved, or if they were never really aligned to begin with.) In a fantasy world, you would see that urn has a different initial letter than unicorn, but for now you just have to listen to the pronunciation to figure out the appropriate article. Sorry for garbling up all of linguistics here. I'm sure there are others who can do a better job. 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: Memory issues with maxima in SAGE
On Aug 17, 12:06 pm, William Stein wrote: > My understanding is that one has to modify the maxima source code > itself and recompile maxima. Not so -- EXT:SET-LIMIT can be called anytime after the Maxima session is launched. To evaluate a single Lisp expression in Maxima: :lisp (ext:set-limit 'ext:heap-size ) 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: Memory issues with maxima in SAGE
Mani chandra wrote: > SB-INT:SIMPLE-READER-PACKAGE-ERROR at 21 (line 1, column 21) on > #: >package "EXT" not found > I'm not sure what implementation of lisp is being used in my Maxima > build and in the one included in SAGE. >From the package names, looks like you have SBCL in the stand-alone Maxima. You could call build_info(); to get the Lisp name for the one in Sage. Without looking it up, I don't know how to set the memory limit in SBCL. Thanks for the info about your problem, it sounds very interesting. 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Memory issues with maxima in SAGE
Mani chandra wrote: > I've attached the value of a particular func where it fails. But > this varies though. Also I restarted the code, making sure I evaluate > only the problematic part and it works. So, it must be an internal > memory limit for Maxima. Is there any way of increasing this? Memory limits are set by the underlying Lisp implementation. I assume you have Maxima + ECL >= 9.2.1. If so you can adjust the heap size (in bytes) by executing in Maxima: :lisp (ext:set-limit 'ext:heap-size n) You can get the default limit by :lisp (ext:get-limit 'ext:heap-size) It's probably something relatively small like 256 M. > sin(2*x)*cos(2*y)*cos(2*z) - (-I*u_x0*e^(-I*x - I*y - I*z) - I*u_x1*e^(-I*x - > I*y) + I guess I is the imaginary unit, right? Are u_x0, u_x1, and other u_x terms constants, or expressions containing x? There are a couple of things you can try to make this more digestible. (1) expand(foo) (where foo = expression you gave) to get a sum of simpler terms (2) map(integrate, bar) (where bar = expand(foo)) to integrate term by term. Not sure if that's really necessary. My advice is to try these heuristics in addition to increasing the heap size. Can I ask what is the purpose of solving this problem? I am always interested to hear what people are working on. 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: Memory issues with maxima in SAGE
Mani chandra wrote: > Yes, the computation of the "select_mode" function does indeed > succeed for simple expressions. But if you run the code, you will notice > that it works for some modes which probably have more complicated > expressions than the ones for which it breaks. Also the modes for which > it breaks seems to vary on different machines. Yes, well, so what is a value of func for which the operation fails? I don't have Sage installed so I can't run your code. 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: Memory issues with maxima in SAGE
Mani chandra wrote: > def select_mode(func,l,m,n): > val = (func*exp(-I*(l*x + m*y + > n*z))).integrate(x,0,2*pi).integrate(y,0,2*pi).integrate(z,0,2*pi) > return val/(8*pi**3) I guess l, m, and n are some integers between -2 and 2. What is func? (I see the definition for it in the code but I'm too lazy to try to compute it myself.) Does the computation succeed with some simpler version of func? As a wild guess in the absence of information, it is possible that intermediate results in the integration are very large expressions. 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: Is it possible to replace the list built-in type in Sage?
Robert Bradshaw wrote: > Sage lists are Python lists, which are very different than > Mathematica lists. You say that as if it's a fact of geography which can't be changed. > to change all lists would be a massive (backwards- > incompatible) change, as well as another step away from Python. Not exactly. At present something like 1 + [2, 3, 4, 5] causes Python to cough up an error, right? So extending arithmetic operators to lists wouldn't change the behavior of any existing Python program. (I'm not worried that someone might have written a program which requires an error to be triggered when number + list is encountered.) You could even pitch it in algebraic terms. The set of lists comprises an ideal in the ring of ... well, of something. Maybe the ring of all numbers and lists. Anyway maybe that would appeal to someone with an algebraic state of mind. > Of course, we support all of this without numpy as well. > > sage: a0 = vector([1,2,3,4]) That's not enough. Only vector + vector, scalar * vector, and inner product are defined, right? I'm pretty sure users would like to see vector * vector, vector ^ exponent, scalar / vector, etc. With all that said, Mathematica is more than a little confused about lists --- there is no distinction between lists and sets, and a matrix is just a list of lists. That's a mess, which Sage shouldn't duplicate. But arithmetic on lists isn't confusing. FWIW 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: Dimensional Analysis or Unit Conversion capability?
On Jun 15, 4:24 am, Maurizio wrote: > precisely, basic units (as meter, second, etc) are, by definition, > terminal unums (without references); derived units (as Newton, Joule, > etc) have a dictionary with, as keys, unums representing basic/derived > units, and, as values, their exponents; finally, any quantity may be > derived with the same idea. Well, I think this is an example of an operation (and it's pretty important to the unit conversion stuff) that could be simplified quite a bit by exploiting Sage's capabilities instead of trying to bolt on an existing package. If you had a list of equations of derived units in terms of basic units, you could immediately compute a conversion factor for two derived units. So the question is how to get such a list. Unit conversions are conveniently expressed by equations like foo = bar^m * baz^n. Any such equation defines a derived unit; basic units or other derived units might appear on the right. To get conversions to base units, just solve all the equations for all the derived units. (It's convenient to take logarithms so the equations are linear.) Then you have every derived unit expressed in terms of basic units only. When new conversions are defined, just append the new equations and solve it again. Symbolic operations (representing equations, solving equations, log and exp, substitution or evaluation) make that construction very simple. The whole business with building a hash table or a graph or whatever is just a workaround for the lack of symbolic operations. 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Dimensional Analysis or Unit Conversion capability?
On Jun 11, 11:41 pm, Robert Bradshaw wrote: > No, but I believe there are several Python packages that do this that > you could install into Sage. (There was talk about adding this at one > point, what is needed is a good list of all the best open-source > packages out there and a discussion of which one to choose and why). I'm going to suggest that interested parties just write a new package for Sage, after reviewing existing packages, instead of trying to bolt one of the existing packages onto Sage. Unit conversion and dimensions analysis isn't very complicated, so it's probably easier to just write it anew. The existing packages have various features, so someone can just pick and choose the features they want. Shameless plug --- I wrote the ezunits package for Maxima, which makes extensive use of symbolic computations, and has a very convenient syntax for annotating units and for unit conversions, and some interesting random features; I like this one: 1 ` m `` [mile, yard, foot, inch]; => [6 ` mile, 376 ` yard, 0 ` foot, 608/127 ` inch] Maybe ezunits can a source of some inspiration. FWIW 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: arg of a symbolic function
evlu...@gmail.com wrote: > def nystrom(A,g,n,zerodiagonal = false): > def boundaryMapper(Ga,a,n): Does anyone know what this is about? I am working on this a little bit and I got a messy result; I don't know if I 'm heading in the right direction or not. Googling for "nystrom boundary mapping" and other variations doesn't seem to yield anything immediately applicable. Links or other refs would be much appreciated. 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Multiplicity of solutions
Marshall Hampton wrote: > sage: z = var('z') > sage: f5 = (z^5-1)^2 > sage: f5.roots() > > [(e^(2/5*I*pi), 2), > (e^(4/5*I*pi), 2), > (e^(-4/5*I*pi), 1), > (e^(-2/5*I*pi), 1), > (1, 2)] > > Odd, very odd. I guess one of us should write about this on the > maxima list. CVS log claims this bug was fixed recently (between 5.17 & 5.18). Here's what I get with Maxima from CVS (5.18+). (%i2) solve ((z^5 - 1)^2 = 0, z); (%o2) [z = %e^(2*%i*%pi/5),z = %e^(4*%i*%pi/5), z = %e^-(4*%i*%pi/5),z = %e^-(2*%i*%pi/5),z = 1] (%i3) multiplicities; (%o3) [2,2,2,2,2] Another example which was cited: (%i5) solve ((z^3 - 1)^3 = 0, z); (%o5) [z = (sqrt(3)*%i-1)/2,z = -(sqrt(3)*%i+1)/2,z = 1] (%i6) multiplicities; (%o6) [3,3,3] FWIW 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: Creating a polynomial with symbolic coefficients
William Stein wrote: > On Wed, Jun 3, 2009 at 11:45 AM, Robert Bradshaw > wrote: > > > > Currently symbolic variables are un-indexable. What would people > > think of having indexing create new subscripted variables? > That's a pretty wild and crazy idea. Cool. Does any other math > software do that? For the record, Maxima treats subscripted variables somewhat the same as simple variables. (They should be the same but Maxima is less than entirely consistent ) A subscripted variable x[0] is distinct from x_0 and x0. Subscripted variables are the same as unevaluated function-like expressions except that they have an extra flag which shows that it's a subscript instead of a function argument. I think it's useful to consider subscripted variables as a subset of functional expressions; after all a subscripted variable is function which maps its set of indices to whatever. > Are there any obvious gotcha's? I think of two general shortcomings of Maxima's scheme. One is that x[m] and x[n] have no known relation when m and n are different; there isn't any way to apply some property across all of the subscripted variables x[foo]. The other is that x[foo] could be any of several things --- could be a list element, a matrix row, an array element, a hash table element, as well as a subscripted variable. This multitude of interpretations of x[foo] can lead to confusion. FWIW 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: `rat' replaced 1000000.0 by 1000000/1 = 1000000.0
flori wrote: > `rat' replaced 100.0 by 100/1 = 100.0 In order to carry out manipulations, Maxima changes all floats to rationals. You can suppress the messages, I forget which flag it is, but probably it's better to avoid floats until you really need them. > Maxima encountered a Lisp error: > > *: floating point overflow Try working with either rationals or bigfloats, which are limited only by available memory. (I don't know how Python types map onto Maxima's big integers and bigfloats, sorry.) FWIW 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: solving for numeric values.
On May 14, 1:57 am, Josephine Ame 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: Symbolic algebra expansion of products of sums
philabuster wrote: > This ordering makes it extremely difficult to do index association > from the j-th term of the expansion back into constituent indices of > each sum (i0,i1,i2,i3); Well, Sage punts to Maxima (for the moment, anyway) to compute the expansion. The terms are computed in the order you want, but displayed in the reverse order by default. I think powerdisp:true will give the result you expected. > What was the rationale? The default ordering displays polynomials in order of decreasing powers. > Given j, how would you calculate (i0,i1,i2,i3,...,ik) considering > Sage's expansion order? Well, you can get the addends via the args function in Maxima; e.g. powerdisp:true; foo:expand(whatever); args(foo); => some list. Likewise you can get the multiplicands of each term from args. I don't know how to get that through Sage. FWIW 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: Symbolic algebra expansion of products of sums
ma...@mendelu.cz wrote: > You can use commands orderless and ordergreat in Maxima to change the > default behavior. For the record, I recommend against that; it's not really the right way to resolve this problem. I'll post another message with a different resolution. 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: solve_linear ... how?
Drini wrote: > I'm doing a large set of symbolic linear system (about 7000) and using > solve() is slow (program takes almos an hour to finish). > > I've spent 2 days trying to optimize the surrounding code and I've > come to the conclusion that the bottleneck is the external calls to > solve. Is Sage calling Maxima in this case? If so there might be some functions in Maxima that would be faster. Before going on let's find out if Maxima is involved. 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: Small problem with limit()
On Mar 12, 2:54 pm, Mike Hansen wrote: > Maxima 5.17posthttp://maxima.sourceforge.net > Using Lisp SBCL 1.0.18.debian > Distributed under the GNU Public License. See the file COPYING. > Dedicated to the memory of William Schelter. > The function bug_report() provides bug reporting information. > (%i1) limit(2*9.81*(t^2-1)/(t-1),t,1); > (%o1) 39.2400016784668 OK, that's good news, however it appears that 9.81 has been parsed as a single-precision float (to guess by the number of correct digits in the result). Maxima is supposed to read floats as double precision. What does :lisp *read-default-float-format* report? Thanks for your help, 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: symbolic matrix multiplication in sage
alex wrote: > How can i compute the matrix multiplication (product) of two symbolic > matrices in sage ? > > I have tried: > A = maxima("matrix ([a, b], [c, d])") > AI= A.invert() > > and > A * AI > gives > matrix([a*d/(a*d-b*c),-b^2/(a*d-b*c)],[-c^2/(a*d-b*c),a*d/(a*d-b*c)]) > > so * is not the matrix product. For the record, "." is the noncommutative product operator in Maxima (while "*" is commutative). Dunno if it matters, hope this helps. 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: Problems using sagetex package
On Mar 6, 8:56 am, William Stein wrote: > That said -- I'm really looking forward to Sage switching to Maxima + ECL. I;'m pretty sure ECL will exhibit some variation on Clisp's behavior, for better or worse. 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: Problems using sagetex package
William Stein wrote: > > On Thu, 05 Mar 2009 at 10:45PM -0800, Alex Lara wrote: > >> *** - invalid byte #xC3 in CHARSET:ASCII conversion Try this: change the environment variable LC_CTYPE e.g. LC_CTYPE=ES_es or LC_CTYPE=ES_es.UTF-8 or something like that. Or maybe somehow indicated ISO 8859-1 or Latin-1 or something. Then Clisp might know how to decode the offending bytes. Another tactic: put the following in your $HOME/.clisprc file. (format t "HELLO FROM CLISPRC~%") (ignore-errors (progn (setf custom:*default-file-encoding* (ext:make-encoding :input-error-action #\?)) (setf custom:*terminal-encoding* custom:*default-file-encoding*))) That replaces undecodable bytes by '?' characters. (The "hello" message is just to verify the code is loaded ) > That's a good guess. There is a known major bug in Maxima + clisp where > it totally fails to work if there are certain non-ascii characters in the > filenames in the current directory or PATH. I can't wait until clisp isn't > in Sage. The bad news is that it's not exactly a Clisp idiosyncrasy. Clisp is trying to "do the right thing" when faced with undecodable bytes. Unfortunately the Common Lisp spec, while it recognizes the existence of character encoding issues, doesn't specify what to do when a byte can't be decoded to a character. Other Lisp implementations probably have their own ways to handle it. FWIW 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: Inverse laplace transform and Post integration formula - symbolic derivative?
On Feb 26, 4:24 pm, mabshoff wrote: > Have you check with the Maxima folks? There is quite a bit of code in > contrib that isn't particularly well integrated. IMHO this is a place > where the Maxima folks could improve Maxima a lot by integrating the > code into the main Maxima codebase, i.e. there is a solver in there > that can handle a lot more systems than the default one and most > people will not look for another solver once the one in default Maxima > does not do what they want it to do. One of the projects I have on the back burner is to do a review of the all the junk in maxima/share, to sort out the stuff that can be merged into the core, or needs clean up, or should be axed. Feel free to bother me about it if you don't hear anything. 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: solve(2*x-3 == (2 + sqrt(x+7))^2,x)
On Jan 21, 12:27 pm, David Joyner wrote: > If you are willing to work in maxima, I think the thing to do is to first > load the topoly module but I can't get it to work for me as described > here:http://www.math.utexas.edu/pipermail/maxima/2006/002666.html > Maybe you will have better luck. It appears Maxima's to_poly doesn't know how to handle 2*x-3 = (2 + sqrt(x+7))^2; the result still has sqrt in it. I've submitted a bug report about that. With a little prodding here' s what to_poly_solve returns (Maxima 5.17.1). load (topoly_solver); to_poly_solve (sqrt (2*x-3) = 2 + sqrt(x + 7), [x]); => [[x = 42]] 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: confusing output? latex(7-(-1)^(1/3))
William Stein wrote: > sage: a = 7-(-1)^(1/3) > sage: latex(a._maxima_()) > 7-\left(-1\right)^{{{1}\over{3}}} > > Don't use maxima(a), since then you'll get a in a session of maxima > that has different defaults than the calculus module uses, in > particular, roots are always assumed real, which may be bad (though > maybe ok for economists): > > sage: a = 7-(-1)^(1/3) > sage: latex(maxima(a)) > 8 FWIW in Maxima domain:complex prevents simplification of (-1)^(1/3). domain : complex; 7 - (- 1)^(1/3); => 7-(-1)^(1/3) tex (%); => $$7-\left(-1\right)^{{{1}\over{3}}}$$ Without reading the code I don't know the full extent of the wonders wrought by domain:complex. 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: why doesn`t solve() give a proper answer
William Stein wrote: > Is there any reason not to just *always* use topoly_solver? I.e., > maybe Sage's solve should just 100% always only call topoly_solver. > What do you think? to_poly_solve can only handle equations in polynomials and radicals, while solve can handle a somewhat wider range of equations. I guess one could invent heuristics -- e.g. try to_poly_solve first and if it can't find anything then try solve. Of course such heuristics could be applied within solve itself (and there are already some in place to handle different kinds of equations). If you 'd like to press for modify solve to call to_poly_solve, then I'll encourage you to take it up on the Maxima mailing list. 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: why doesn`t solve() give a proper answer
On Jan 9, 6:51 am, Slava wrote: > I`m trying to solve such simple system of equations: [sqrt(x) == 1, x > == y], > so I type: > > x,y = var('x,y'); > solve([sqrt(x) == 1, x == y], x, y); > > the answer is: [] If I understand correctly, Sage punts to Maxima to solve equations. Maxima's built-in solver is not too strong. There is an add-on package which can solve equations which contain radicals. Dunno how to call it from Sage, but in Maxima itself it's like this: load (topoly_solver); to_poly_solve ([sqrt(x) = 1, x = y], [x, y]); => [[x = 1, y = 1]] Maybe at some point in the not-too-distant future, the built-in solver would call to_poly_solve automatically 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: Problems plotting slopefield with maxima (plotdf)
David Joyner wrote: > Doesn't maxima call gnuplot, unless you specify some options? > Do you have that installed (for example, using sage -i ...)? plotdf renders its display via Openmath (included in Maxima) which is a Tcl/Tk program. If Xmaxima (user interface) is included with Maxima, then Openmath should be present. I don't know if Sage installs Tcl/Tk, maybe you have to do that separately. > On Wed, Dec 17, 2008 at 6:41 AM, akkogve wrote: > > When I try to plot a slopefield with maxima (inside sage) I get the > > cryptic message "127". It seem likely this is a Unix process exit code which indicates failure. > > load("plotdf") > > plotdf([x-8*y, -x-y]) FWIW this displays a direction field as expected when I try it (cvs Maxima + ECL + Linux). Maybe there is some other way to plot a direction field in Sage. 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 URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: numerical evaluation of integral?
On Dec 4, 2:04 pm, "William Stein" <[EMAIL PROTECTED]> wrote: > sage: f.n() > > and get back a floating point number. This is surprisingly not > implemented in Sage, but it isn't. > (That's basically because Maxima itself doesn't seem to have such > functionality.) I'm guessing that f.n() just turns on the numer flag for Maxima. numer causes any literal numbers or symbolic constants to be replaced by floating point values. However the integrate function is called as without numer. If you want a numerical integration, call quad_qags or some other Quadpack function. FWIW Robert Dodier --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: A limit question.
adrian wrote: > sage: limit(x*0,x=oo) > 0 Looks right to me. Maybe you agree, I can't tell from your message. > sage: limit(x*oo,x=0) > 0 > > This seems wrong to me; and probably the problem is that x*oo should > not be allowed to begin with... Seems wrong to me too. Since Sage calls Maxima to compute limits, could you please report this to the Maxima bug tracker and/or mailing list. http://sourceforge.net/projects/maxima/bugs http://maxima.sourceforge.net/maximalist.html Same behavior in a recent Maxima build from CVS, ftr. best Robert Dodier --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: bug in integral?
On 11/19/08, Mike Hansen <[EMAIL PROTECTED]> wrote: > Yep, these are coming from Maxima: > > (%i11) integrate(x*abs(9-x^2), x, -6, 0); > (%o11) 162 > (%i12) integrate(x*abs(9-x^2), x, -6, -3); > (%o12) -729/4 > (%i13) integrate(x*abs(9-x^2), x, -3, 0); > (%o13) -81/4 > > I've CC'd Robert Dodier on this. For future reference, please forward such reports directly to the Maxima mailing list, or, better still, make a bug report and then forward the bug report to the mailing list. If there is no bug report for this problem yet, I hope someone will make one. Thanks for your help. Robert Dodier --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Computing a sum
On Nov 10, 7:15 pm, cesarnda <[EMAIL PROTECTED]> wrote: > that is the output I was expecting, but it is not the input I gave. > Obviously, > 1/x - 1/(x+1) = 1/(x*(x+1)) > > but, if the right hand side can be done why the left hand side can't? > This is the bug I was talking about... Thanks for pointing it out. If you can file a bug report in the Maxima bug tracker (http://sourceforge.net/projects/maxima/bugs or something like that) or post a message to the mailing list, that would be helpful. It turns out that nusum (the Gosper algorithm written by Gosper himself iirc) can solve this problem, but I guess nusum is not consulted by simplify_sum before the latter gives up. I didn't look into it carefully. best Robert Dodier --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: tan(pi/2) unevaluated?
Gary wrote: > I've been trying to evaluate a symbolic double integral but am > perplexed by the unevaluated tan(pi/2) expressions in the result since > tan(pi/2) is undefined. What am I missing here and what do I need to > do to get this to evaluate to the correct value of > (4*pi - 3*sqrt(3))*a^2/6? > sage input: > *** > var('a r theta') > assume(a > 0) > integral(integral(r, r, a*csc(theta), 2*a), theta, pi/6, pi/2) > *** > > sage output: > * > (2*pi*tan(pi/2) + 1)*a^2/(2*tan(pi/2)) - (2*pi + 3*sqrt(3))*a^2/6 > * Sage punts to Maxima to do symbolic integrals. In this case, Maxima computed an antiderivative and plugged in the limits of integration. You can coax Maxima into doing the right thing by computing a limit: assume (a > 0, bb > 0, bb > %pi/6); integrate (integrate (r, r, a*csc(theta), 2*a), theta, %pi/6, bb); => (4*a^2*bb*tan(bb)+a^2)/(2*tan(bb))-(2*%pi+3*sqrt(3))*a^2/6 limit (%, bb, %pi/2, minus); => (4*%pi-3*sqrt(3))*a^2/6 I guess Maxima could apply the limit automatically -- that shouldn't change the result for most integrals, but gets the correct result in cases like this. Opinions from the Maxima crowd are welcome. best Robert Dodier --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: arcsinh(1) == ln(1+sqrt(2)) ?
William Stein wrote: > If expr is a symbolic expression in Sage, then > > bool(expr) > > evaluates to True only if expr can be proved to be True. > Otherwise it always evaluates to False. > > The actual code that decides this is currently in Maxima. Actually Maxima is equipped to return unknown as well as true or false, but in this case it is jumping to a conclusion. Maxima attempts to determine the sign of asinh(1) - log(1 + sqrt(2)) via numerical evaluation, which yields a small positive residual, and therefore the spurious result; this is a bug. The undocumented flag signbfloat governs the numerical test: is (equal (asinh(1), log(1 + sqrt(2, signbfloat=false; => unknown I know this is little consolation, but I';ll forward a bug report to the Maxima mailing list to see what we can do. FWIW Robert Dodier --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: solve, integrate, series
On Oct 27, 11:00 am, "William Stein" <[EMAIL PROTECTED]> wrote: > > sage: axiom.solve(sqrt(sqrt(4*x^2 + 1) - x^2 - 1), x) > > >+-+ +-+ > > [x= 0,x= \|2 ,x= - \|2 ] > > Sage's solve command is simply a light wrapper around Maxima's, > and Maxima doesn't solve the above: FTR there has been progress on a stronger equation solver for Maxima. All hail Barton Willis for his fine work! in Maxima 5.16.3: load (topoly_solver); to_poly_solve (sqrt(sqrt(4*x^2 + 1) - x^2 - 1), x) ; => [[x = - sqrt(2)], [x = sqrt(2)], [x = 0]] There will be further improvements in the next release. Robert Dodier --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: question on using integral() in sage. Fourier transform of unit step function.
David Joyner wrote: > sage: assume(x>0) > sage: integral( cos(2 * pi * x * t), t , 0 , Infinity) > ind > > What is "ind"? I guess this is coming from Maxima, where ind = indeterminate. Btw und = undefined if ever you run across that, and don't forget inf = positive real infinity, minf = negative real infinity, infinity = complex infinity. best Robert Dodier --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Inert Integrals and Derivatives?
David Philp wrote: > On 02/09/2008, at 6:22, Robert Dodier <[EMAIL PROTECTED]> wrote: > > * lack of syntax in programming constructs > What does this mean? If[x, y, z] instead "if x then y else z" or something like that While[a, b] instead of "while a do b" or "while (a) b" or something like that Switch[a, x, xx, y, yy, ...] instead of "switch (a) case x : xx, case y : yy, ..." or something like that The point in each case is that it helps the reader see the structure of the code to separate the arguments by keywords or other syntax elements. best Robert Dodier --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Inert Integrals and Derivatives?
Ondrej Certik wrote: > So what things do they have wrong? So that we can learn from it. * all functions are capitalized * BumpyCaseIsHardToRead * square brackets for function arguments * two square brackets for subscripts * squiggly braces for lists * sets and matrices not distinguished from lists * lack of syntax in programming constructs There's really nothing to recommend any of this. FWIW Robert Dodier --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Inert Integrals and Derivatives?
Robert Bradshaw wrote: > On Aug 30, 2008, at 4:46 PM, Robert Dodier wrote: > > From the direction this discussion has taken I'm guessing that > > nobody here is aware that selective evaluation is trivial in Lisp, > > and Maxima. In both cases a single quote marks stuff that > > isn't evaluated. > I actually did know that lisp has this feature. The real question is > how to expose such a feature in a natural way in the Sage (Python) > environment. FWICT there is not indeed any natural way to do it. It seems within the realm of possibility to develop a superset of Python which has a modified evaluation policy. Existing programs would act the same in this hypothetical language, but there could be new constructs (quoting and evaluating, unevaluated and partially-evaluated expressions, maybe more) which extend the language. > Using Python has worked out very nice both for the UI > and core library--I don't see this changing anytime soon. There are days when I want to use Python as the UI language; it is a much stronger programming language than the existing Maxima language. There is an implementation of Python in Lisp, namely CLPython. I have toyed with the idea of using CLPython as the UI language for Maxima. > And as beautiful lisp is as a language, it seems even Maxima > decided that it wasn't suited for the front end of a CAS. The Maxima language has the same code = data principle as in Lisp. That's much more important than parenthesis or the lack of them. All the best Robert Dodier --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---