[sage-support] Re: latex/sagetex display of matrix
I don't think the easiest way that you describe is possible. In my .tex file i write: \begin{sagesilent} a=matrix(QQ,[[1,1],[2,-1],[1,-1]]) \end{sagesilent} $\sage{a.transpose()}\cdot\sage{a}=\sage{(a.transpose()*a).inverse()}$\ \ The latex-code for the matrices is not visible here. I only get the resulting .dvi, .ps and .pdf-files. I found out that the latex()-command in sage uses a file called latex.py, and even if i haven't done anything in python before, i think I will be able to edit that file. I have not yet found out how to compile latex.py to get latex.pyc, and I don't know if I have to do anything more than that, like rebuilding sage. Is there a chance that this will work? On Dec 17, 6:27 pm, "David Joyner" wrote: > The easiest way is probably to simply do a global search+replace of \left( > and \right) on the file:-) > > The much harder way is to create a clone, then track down > the method for the latex code (try M._latex_??, where M is your matrix), > edit it and rebuild Sage using "sage -b". > > If you think your request is of general interest, you could also ask on > sage-devel if having a square bracket option is something others would > want. Maybe someone will implement it! > > On Wed, Dec 17, 2008 at 7:08 AM, Geodet wrote: > > > I have just begun using sagetex (in Kile on Ubuntu Linux) for writing > > math lecture notes. I would like sagetex to display the matrices with > > square brackets [] instead of round brackets or parentheses (). I > > guess that the change must be done in SAGE, so that the latex()- > > command produces matrices with square brackets. Do anyone know how > > this can be done? --~--~-~--~~~---~--~~ 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] Type error
Hi In this worksheet: http://users.aims.ac.za/~jan/type_of_variable.sws The type of a symbolic variable multiplied by a rational matrix does not return a rational matrix, but a sage.modules.free_module_element.FreeModuleElement_generic_dense, interfering with further calculations. A strange workaround is to mutiply by an identify matrix. (This exercise is intended for students to do some brute force experimentation and investigation, which becomes slow at higher dimensions.) Is this a bug or intended? regards, Jan -- .~. /V\ Jan Groenewald /( )\www.aims.ac.za ^^-^^ --~--~-~--~~~---~--~~ 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?
On Dec 18, 2008, at 12:12 AM, Jason Grout wrote > Oh, I understood the above to mean that you could define a matrix B, > for > example, without defining the elements of the matrix. I don't know > how > to do that in Mathematica; maybe I'm confused. It's actually done implicitly, see: http://reference.wolfram.com/mathematica/tutorial/MultiplyingVectorsAndMatrices.html So, D[Transpose[a].B.c, c] should just work. > At any rate, for now, > I'll assume that you mean that you define "vectors" a and c and a > "matrix" B in Mma by specifying the entries as symbolic > expressions. I > put vectors and matrix in quotes since I just ran into some trouble > trying to do an example session in Mma. To my knowledge, Mma really > has > no notion of a "vector" or a "matrix", but instead has just the notion > of a list and a list of lists. This gave me problems in trying to do > what what you did below. Here, I define n to be a "vector" and try to > compute NN^T > > In[2]:= n = {1, t, Cos[t]} > > Out[2]= {1, t, Cos[t]} > > In[3]:= b=n.Transpose[n] > > Transpose::nmtx: >The first two levels of the one-dimensional list {1, t, Cos[t]} > cannot be transposed. > Yeah, that won't work since they aren't defined as a vector. > > Instead, I assume you mean to define n as literally a column vector > (i.e., a column "matrix")? > Yes, I mean a column vector/matrix. > In[6]:= n = {{1, t, Cos[t]}}//Transpose > > Out[6]= {{1}, {t}, {Cos[t]}} > > In[7]:= b=n.Transpose[n] > > 2 2 > Out[7]= {{1, t, Cos[t]}, {t, t , t Cos[t]}, {Cos[t], t Cos[t], > Cos[t] }} > > >> D[Transpose[a].B.c, c] >> or >> D[Transpose[a].B.c, a] >> >> If they conform, the operation is valid, and has a simple solution. > > Pardon my ignorance, but what do you mean by a "solution"? Do you > mean > that the derivatives yield a result, or that there is another solving > step which involves an equation? > I mean that the derivatives yield a result. > I think that this might be possible in Sage using > http://trac.sagemath.org/sage_trac/ticket/3941 and > http://trac.sagemath.org/sage_trac/ticket/4493. Can you give a > specific > Mathematica example session? I'll try to duplicate it in Sage. > The problem is that I don't have a copy of Mathematica any more. I last had a license for version 4 for a different machine that I don't use anymore. I know the first ticket isn't what I mean, I'm not sure about the second. I want to define a set of column vectors, a, c, and N (without specifying the length aside from it being length n or contents). Then, perform a^T.N.N^T.c (1xn).(nx1).(1xn).(nx1) = 1x1 so everything conforms. and carry out the derivative with respect to the vectors c or a. This derivative is easy to carry out by hand, but since the operations aren't really supported, it isn't easily done in most CAS packages. I hope this helps clarify things. Cheers, Tim. --~--~-~--~~~---~--~~ 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?
Tim Lahey wrote: > > On Dec 17, 2008, at 8:03 PM, Jason Grout wrote: > >> Tim Lahey wrote: >>> There are certainly some things you can do with general matrices and >>> vectors, but I think doing something like defining A as an nxm matrix >>> and allowing various operations on it is a very useful thing. >>> Mathematica has some support for this, but I don't think it has a >>> general solve. >> >> Could you maybe give an example session in Mathematica doing something >> like this? >> > > You can define a, and c as vectors and B as a matrix and then do, > Oh, I understood the above to mean that you could define a matrix B, for example, without defining the elements of the matrix. I don't know how to do that in Mathematica; maybe I'm confused. At any rate, for now, I'll assume that you mean that you define "vectors" a and c and a "matrix" B in Mma by specifying the entries as symbolic expressions. I put vectors and matrix in quotes since I just ran into some trouble trying to do an example session in Mma. To my knowledge, Mma really has no notion of a "vector" or a "matrix", but instead has just the notion of a list and a list of lists. This gave me problems in trying to do what what you did below. Here, I define n to be a "vector" and try to compute NN^T In[2]:= n = {1, t, Cos[t]} Out[2]= {1, t, Cos[t]} In[3]:= b=n.Transpose[n] Transpose::nmtx: The first two levels of the one-dimensional list {1, t, Cos[t]} cannot be transposed. Instead, I assume you mean to define n as literally a column vector (i.e., a column "matrix")? In[6]:= n = {{1, t, Cos[t]}}//Transpose Out[6]= {{1}, {t}, {Cos[t]}} In[7]:= b=n.Transpose[n] 2 2 Out[7]= {{1, t, Cos[t]}, {t, t , t Cos[t]}, {Cos[t], t Cos[t], Cos[t] }} > D[Transpose[a].B.c, c] > or > D[Transpose[a].B.c, a] > > If they conform, the operation is valid, and has a simple solution. Pardon my ignorance, but what do you mean by a "solution"? Do you mean that the derivatives yield a result, or that there is another solving step which involves an equation? I think that this might be possible in Sage using http://trac.sagemath.org/sage_trac/ticket/3941 and http://trac.sagemath.org/sage_trac/ticket/4493. Can you give a specific Mathematica example session? I'll try to duplicate it in Sage. Thanks Jason --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: how do i embed sage in latex using \input files?
On Wed, 17 Dec 2008 at 09:36AM -0800, dsoto wrote: > i am using the sagetex package to embed sage in latex documents and it > is working fabulously. some of my documents are very large and i > split them up and use \input to assemble into one document. when i > try to run sagetex on this there is only a .sage file for the main > file and not the files included using \input. the resulting document > has ?? instead of the equation intended. SageTeX right now has no support at all for documents that use \include or \input, unfortunately. This is simply because I never thought of it! I'll start investigating this and see what I can do. In the meantime, there's probably nothing you can do except put everything into one big document. I thought there was a LaTeX package or script that would do that, but I can't find anything right now. Dan -- --- Dan Drake - KAIST Department of Mathematical Sciences --- http://mathsci.kaist.ac.kr/~drake signature.asc Description: Digital signature
[sage-support] Re: is it possible?
On Dec 17, 2008, at 8:03 PM, Jason Grout wrote: > > Tim Lahey wrote: >> >> There are certainly some things you can do with general matrices and >> vectors, but I think doing something like defining A as an nxm matrix >> and allowing various operations on it is a very useful thing. >> Mathematica has some support for this, but I don't think it has a >> general solve. > > > Could you maybe give an example session in Mathematica doing something > like this? > You can define a, and c as vectors and B as a matrix and then do, D[Transpose[a].B.c, c] or D[Transpose[a].B.c, a] If they conform, the operation is valid, and has a simple solution. This comes up in Variational Calculus, particularly in relation to Finite Element Analysis. In FEA, B is actually NN^T where N is the basis vector and a and c are equal and are the vector of nodal displacements/values. I've discussed this once before in a different thread on PDEs. Since Maple didn't support this kind of operation and was my CAS of choice at the time, I wrote a bunch of code to derive element matrices much of which could have been skipped if I could do the above. Cheers, Tim. --- Tim Lahey PhD Candidate, Systems Design Engineering University of Waterloo http://www.linkedin.com/in/timlahey --~--~-~--~~~---~--~~ 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?
Tim Lahey wrote: > > There are certainly some things you can do with general matrices and > vectors, but I think doing something like defining A as an nxm matrix > and allowing various operations on it is a very useful thing. > Mathematica has some support for this, but I don't think it has a > general solve. Could you maybe give an example session in Mathematica doing something like this? Thanks, Jason --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Problems plotting slopefield with maxima (plotdf)
Robert Dodier wrote: > > Maybe there is some other way to plot a direction field in Sage. See plot_vector_field and plot_slope_field. Jason --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Dealing with large finite fields?
2008/12/17 dmharvey : > > On Dec 17, 5:32 pm, Alasdair wrote: >> What facilities are available to me here? For example, the following: >> >> p=211 >> F.=GF(p)[] >> G.=GF(p^17,name='a',modulus=x^17+2*x^2+1) >> g=G.multiplicative_generator() >> r=G.random_element() >> discrete_log(r,g) >> >> ties up my computer for several minutes while using all possible CPU, >> then finally Sage gives up the ghost and crashes. > > The order of your field has a prime factor of > 473657018821793557815477348357239, which has ~108 bits, so the best > algorithms I know would need to do a search of size about 2^54, which > is kind of big. Probably computationally infeasible on the hardware > you are using. But maybe there are better algorithms, and I don't know > exactly what algorithm Sage is using. Sage is using a completely generic dlog algorithm based on baby-step-giant-step, which is of course extremely inefficient for large fields. If someone out there would like to implement something better, that would be very good! Also: the multiplicative_generator() function is pretty stupid. If the field's generator does not generator the multiplicative group it just tries elements at random until one is found that does. That would be much easier to improve. John Cremona > > david > > > > --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Defining linear/bilinear operators over a vector field
Hi, Any suggestions/hints for how to define/use symbolic linear/bilinear operators over a vector field? I'd like to define operators with behaviors like linearOp(scalar*vector) -> scalar*linearOp(vector) linearOp(vector1+vector2) -> linearOp(vector1) + linearOp(vector2) bilinearOp(scalar*vector1,vector2) -> scalar*bilinearOp (vector1,vector2) bilinearOp(vector1,vector2+vector3) -> bilinearOp (vector1,vector2)+bilinearOp(vector1,vector3) I'm at a loss for how to achieve this (in any CAS). Help much appreciated. - Rhys --~--~-~--~~~---~--~~ 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: Dealing with large finite fields?
On Dec 17, 5:32 pm, Alasdair wrote: > What facilities are available to me here? For example, the following: > > p=211 > F.=GF(p)[] > G.=GF(p^17,name='a',modulus=x^17+2*x^2+1) > g=G.multiplicative_generator() > r=G.random_element() > discrete_log(r,g) > > ties up my computer for several minutes while using all possible CPU, > then finally Sage gives up the ghost and crashes. The order of your field has a prime factor of 473657018821793557815477348357239, which has ~108 bits, so the best algorithms I know would need to do a search of size about 2^54, which is kind of big. Probably computationally infeasible on the hardware you are using. But maybe there are better algorithms, and I don't know exactly what algorithm Sage is using. david --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Dealing with large finite fields?
What facilities are available to me here? For example, the following: p=211 F.=GF(p)[] G.=GF(p^17,name='a',modulus=x^17+2*x^2+1) g=G.multiplicative_generator() r=G.random_element() discrete_log(r,g) ties up my computer for several minutes while using all possible CPU, then finally Sage gives up the ghost and crashes. Thanks, Alasdair --~--~-~--~~~---~--~~ 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: Two questions concerning solve
Dear Michael, On Dec 17, 9:08 pm, mabshoff wrote: > The 0.07 seconds is the CPU time we spend on the Sage side to > communicate with Maxima, the rest is probably starting Maxima, > communicating and then the solve on Maxima's side also. As you well > know there is this general slowdown effect when one communicates with > Maxima from Sage's end, so unless this is a clean session this could > play a role here. I am not convinced. I find that first (and very quickly) the result of the time command (the 0.07 s) is shown, and *after that* one has to wait, and finally the solution appears. I think that Robert's example > sage: print soln # fast > sage: str(soln) # fast > sage: repr(soln) # fast > sage: soln # slow !? indicates where this comes from. More explicit, compare with the following variant: sage: ct = cputime() sage: time sln=solve([x^2+y^2 == 1, y^2 == x^3 + x + 1], x, y, solution_dict=True) CPU times: user 0.06 s, sys: 0.02 s, total: 0.08 s Wall time: 0.17 s # indeed fast sage: time sln CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s Wall time: 0.00 s # then: Wait for a long time! And finally comes: [{y: -sqrt(3 - sqrt(3)*I)/sqrt(2), x: (-sqrt(3)*I - 1)/2}, {y: sqrt(3 - sqrt(3)*I)/sqrt(2), x: (-sqrt(3)*I - 1)/2}, {y: -sqrt(sqrt(3)*I + 3)/sqrt(2), x: (sqrt(3)*I - 1)/2}, {y: sqrt(sqrt(3)*I + 3)/sqrt(2), x: (sqrt(3)*I - 1)/2}, {y: -1, x: 0}, {y: 1, x: 0}] sage: cputime(ct) 2.42015106 Cheers, Simon --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] OpenOpt 0.21 (free optimization framework)
Hi all, OpenOpt 0.21 (free Python-written optimization framework) has been released Changes since previous release 0.19 (September 15, 2008): * major changes for NLP / NSP solver ralg * new converter: qp2nlp * new converter: lp2nlp * new converter: nllsp2nlp * new converter: nlsp2nlp * new converter: minimax to NLP * Introducing OpenOpt GUI * PSwarm 1.3 has been connected instead of v 1.1. It has much more parameters to modify and ability to use user-supplied callback function. * Lots of changes related to oofun syntax: add oovar and oolin, now fixed oovars can be correctly handled * enhanced iterfcn connection for scipy fmin_cobyla * some doc updates for result structure * new openopt API func: oosolver * some code cleanup and bugfixes * some other minor changes Backward incompatibility: * instead of "from scikits.openopt" now you should use "from openopt import ..." * LSP has been renamed to NLLSP * oofun with ordinary variables (x) support had been ceased (it's hard to keep maintaining), use oovars instead. Currently we are moving OpenOpt website into new location (openopt.org) Let me also invite you to the numerical optimization forum at openopt.org: http://forum.openopt.org Regards, Dmitrey. --~--~-~--~~~---~--~~ 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: question about visualization/animation of surfaces
Thanks a lot !! Wonderfull, this a really nice example containing many things to learn from ... greetings, Georg --~--~-~--~~~---~--~~ 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: Two questions concerning solve
On Dec 17, 2008, at 11:49 AM, David Joyner wrote: > > On Wed, Dec 17, 2008 at 2:41 PM, Simon King jena.de> wrote: >> >> Dear Sage supporters, >> >> inspired by http://groups.google.com/group/sage-support/ >> browse_thread/thread/729f4a557d970195?hl=en, >> I was playing around with the solve command. >> >> I found two questions: >> 1. How can one add assumptions (such as x>0 or x is an integer)? >> The following does not work: >> sage: assume(x>0) >> sage: solve(x^2-1,x) >> [x == -1, x == 1] >> The Sage Tutorial doesn't mention assumptions in the section about >> solving equations. > > > I don't know the answer The problem is that maxima ignores the assume command in solving. I don't know if this is intentional behavior or a bug. (%i1) assume(x>0); (%o1) [x > 0] (%i2) solve(x^2-1=0, x); (%o2) [x = - 1, x = 1] Assumptions that something is an integer while solving would be highly nontrivial. Imagine sage: var('a,b,c,n') sage: assume(a, 'integer') sage: assume(b, 'integer') sage: assume(c, 'integer') sage: assume(d, 'integer') sage: assume(n > 2) sage: solve(a^n + b^n == c^n, n) > but if assume doesn't work then I would vote to > deprecate it and replace it by an option such as > > solve(x^2-1,x,assume="x>0") > or > solve(x^2-1,x,options="assume(x>0)") > or something. Then just pass the assume statement to > maxima before the solve statement. Usually I like to avoid using strings to carry more structured mathematical information. I do think solve(x^2-1, x, assume=x>0) wouldn't be a bad thing to support. This all depends on how assumptions are going to be done in the new symbolics. >> 2. Why does it take so long to return the solution dictionary? >> From the solve-docstring: >> sage: ct=cputime() >> sage: time solve([x^2+y^2 == 1, y^2 == x^3 + x + 1], x, y, >> solution_dict=True) >> CPU times: user 0.07 s, sys: 0.00 s, total: 0.07 s >> Wall time: 0.18 s >> [{y: -sqrt(3 - sqrt(3)*I)/sqrt(2), x: (-sqrt(3)*I - 1)/2}, >> {y: sqrt(3 - sqrt(3)*I)/sqrt(2), x: (-sqrt(3)*I - 1)/2}, >> {y: -sqrt(sqrt(3)*I + 3)/sqrt(2), x: (sqrt(3)*I - 1)/2}, >> {y: sqrt(sqrt(3)*I + 3)/sqrt(2), x: (sqrt(3)*I - 1)/2}, >> {y: -1, x: 0}, >> {y: 1, x: 0}] >> sage: cputime(ct) >> 2.61216289 >> >> So, for computing the solutions 0.07 CPU-seconds suffice, but for >> printing them 2.6 CPU-seconds are needed?? cputime only measures the time of the Sage process (formatting the equations, feeding them to maxima, and parsing and printing the result). The forked maxima process, which is actually doing all the work in this example, takes the rest. As for printing, I'm not sure what's taking so long (simplifying each result individually?), but it shouldn't. sage: time soln = solve([x^2+y^2 == 1, y^2 == x^3 + x + 1], x, y, solution_dict=True) CPU times: user 0.02 s, sys: 0.01 s, total: 0.03 s Wall time: 0.14 s sage: print soln # fast sage: str(soln) # fast sage: repr(soln) # fast sage: soln # slow !? - Robert --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Two questions concerning solve
On Dec 17, 11:41 am, Simon King wrote: > Dear Sage supporters, Hi Simon, > 2. Why does it take so long to return the solution dictionary? > From the solve-docstring: > sage: ct=cputime() > sage: time solve([x^2+y^2 == 1, y^2 == x^3 + x + 1], x, y, > solution_dict=True) > CPU times: user 0.07 s, sys: 0.00 s, total: 0.07 s > Wall time: 0.18 s > [{y: -sqrt(3 - sqrt(3)*I)/sqrt(2), x: (-sqrt(3)*I - 1)/2}, > {y: sqrt(3 - sqrt(3)*I)/sqrt(2), x: (-sqrt(3)*I - 1)/2}, > {y: -sqrt(sqrt(3)*I + 3)/sqrt(2), x: (sqrt(3)*I - 1)/2}, > {y: sqrt(sqrt(3)*I + 3)/sqrt(2), x: (sqrt(3)*I - 1)/2}, > {y: -1, x: 0}, > {y: 1, x: 0}] > sage: cputime(ct) > 2.61216289 > > So, for computing the solutions 0.07 CPU-seconds suffice, but for > printing them 2.6 CPU-seconds are needed?? The 0.07 seconds is the CPU time we spend on the Sage side to communicate with Maxima, the rest is probably starting Maxima, communicating and then the solve on Maxima's side also. As you well know there is this general slowdown effect when one communicates with Maxima from Sage's end, so unless this is a clean session this could play a role here. > Best regards, > Simon Cheers, Michael --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Two questions concerning solve
On Wed, Dec 17, 2008 at 2:41 PM, Simon King wrote: > > Dear Sage supporters, > > inspired by > http://groups.google.com/group/sage-support/browse_thread/thread/729f4a557d970195?hl=en, > I was playing around with the solve command. > > I found two questions: > 1. How can one add assumptions (such as x>0 or x is an integer)? > The following does not work: > sage: assume(x>0) > sage: solve(x^2-1,x) > [x == -1, x == 1] > The Sage Tutorial doesn't mention assumptions in the section about > solving equations. I don't know the answer but if assume doesn't work then I would vote to deprecate it and replace it by an option such as solve(x^2-1,x,assume="x>0") or solve(x^2-1,x,options="assume(x>0)") or something. Then just pass the assume statement to maxima before the solve statement. > > 2. Why does it take so long to return the solution dictionary? > From the solve-docstring: > sage: ct=cputime() > sage: time solve([x^2+y^2 == 1, y^2 == x^3 + x + 1], x, y, > solution_dict=True) > CPU times: user 0.07 s, sys: 0.00 s, total: 0.07 s > Wall time: 0.18 s > [{y: -sqrt(3 - sqrt(3)*I)/sqrt(2), x: (-sqrt(3)*I - 1)/2}, > {y: sqrt(3 - sqrt(3)*I)/sqrt(2), x: (-sqrt(3)*I - 1)/2}, > {y: -sqrt(sqrt(3)*I + 3)/sqrt(2), x: (sqrt(3)*I - 1)/2}, > {y: sqrt(sqrt(3)*I + 3)/sqrt(2), x: (sqrt(3)*I - 1)/2}, > {y: -1, x: 0}, > {y: 1, x: 0}] > sage: cputime(ct) > 2.61216289 > > So, for computing the solutions 0.07 CPU-seconds suffice, but for > printing them 2.6 CPU-seconds are needed?? > > Best regards, >Simon > > > > --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Two questions concerning solve
Dear Sage supporters, inspired by http://groups.google.com/group/sage-support/browse_thread/thread/729f4a557d970195?hl=en, I was playing around with the solve command. I found two questions: 1. How can one add assumptions (such as x>0 or x is an integer)? The following does not work: sage: assume(x>0) sage: solve(x^2-1,x) [x == -1, x == 1] The Sage Tutorial doesn't mention assumptions in the section about solving equations. 2. Why does it take so long to return the solution dictionary? >From the solve-docstring: sage: ct=cputime() sage: time solve([x^2+y^2 == 1, y^2 == x^3 + x + 1], x, y, solution_dict=True) CPU times: user 0.07 s, sys: 0.00 s, total: 0.07 s Wall time: 0.18 s [{y: -sqrt(3 - sqrt(3)*I)/sqrt(2), x: (-sqrt(3)*I - 1)/2}, {y: sqrt(3 - sqrt(3)*I)/sqrt(2), x: (-sqrt(3)*I - 1)/2}, {y: -sqrt(sqrt(3)*I + 3)/sqrt(2), x: (sqrt(3)*I - 1)/2}, {y: sqrt(sqrt(3)*I + 3)/sqrt(2), x: (sqrt(3)*I - 1)/2}, {y: -1, x: 0}, {y: 1, x: 0}] sage: cputime(ct) 2.61216289 So, for computing the solutions 0.07 CPU-seconds suffice, but for printing them 2.6 CPU-seconds are needed?? Best regards, Simon --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: question about visualization/animation of surfaces
Here is an example which might help. For it to work you need to install ffmpeg. It generates a rotating icosahedron movie. For what you want to do list_plot3d might be more appropriate: {{{ c = polytopes.icosahedron() label = 'Ico_movie' # Numerical pi predefined for some speed npi = RDF(pi) #A rotation matrix def rot(i,j,th): q = matrix(RDF,3) for k in range(3): q[k,k] = 1.0 q[i,i] = cos(th) q[j,j] = cos(th) q[i,j] = sin(th) q[j,i] = -sin(th) return q index = 0 for theta in srange(0,2*npi,npi/10): vs = c.vertices()[:] #rotate the vertices: vs = [rot(0,1,theta)*vector(v) for v in vs] edgedata = c.vertex_adjacencies() facedata = c.triangulated_facial_incidences() #Set up Tachyon. #use small xres, yres for speed. antialiasing helps things look better. t = Tachyon(xres = 250, yres = 250, antialiasing = True) t.texture('e1', color = (0,0,1)) t.texture('f1',opacity = .5, color = (1,0,0)) t.light((2,2,2), 0.1, (1,1,1)) #Draw edges: edges = [] for anedge in edgedata: v0 = anedge[0] for v1 in anedge[1]: if v1 > v0: edges.append([vs[v0],vs[v1]]) for anedge in edges: t.fcylinder(anedge[0],anedge[1],.01,'e1') #Draw transparent faces: for atri in facedata: t.triangle(vs[atri[1][0]],vs[atri[1][1]],vs[atri[1][2]],'f1') #Make file names in order for ffmpeg str_index = '0'*(3-len(str(index)))+str(index) t.save(DATA+label+ str_index + '.png') index += 1 #Add a black final frame, since otherwise the compression in ffmpeg gets confused. t = Tachyon(xres = 250, yres = 250, antialiasing = True) str_index = '0'*(3-len(str(index)))+str(index) t.save(DATA+label+ str_index + '.png') #Use ffmpeg to animate: os.system('ffmpeg -qmax 2 -i ' + DATA + label + '%3d.png ./test.mp4') }}} On Dec 9, 5:02 am, ggrafendorfer wrote: > Hi Marshall, > thanks for the answer, if you once have the frames I also know these > two projects, but I did not try them out yet: > > http://www.onyxbits.de/giftedmotion > > http://www.lcdf.org/~eddietwo/gifsicle/ > > Is it possible to make the frames, i.e. .jpg or .png files with > tachyon from within sage or python? > > Actually I was hoping for an easy "on the fly" solution, to keep all > the data of all surfaces in one file and produce the moving surface > directly from that file > > thanks, > Georg --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] how do i embed sage in latex using \input files?
i am using the sagetex package to embed sage in latex documents and it is working fabulously. some of my documents are very large and i split them up and use \input to assemble into one document. when i try to run sagetex on this there is only a .sage file for the main file and not the files included using \input. the resulting document has ?? instead of the equation intended. thx, drs --~--~-~--~~~---~--~~ 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] sage ipython interactive plotting
Can the sage contained ipython -pylab in the sage tree be made to print interactively like ipython -pylab in /usr/bin. I am running ubuntu 8.1 on a amd_64 turion processor. By interactive I mean that entering plot([1,2]) make a figure pop up. V/R Scott A --~--~-~--~~~---~--~~ 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: latex/sagetex display of matrix
The easiest way is probably to simply do a global search+replace of \left( and \right) on the file:-) The much harder way is to create a clone, then track down the method for the latex code (try M._latex_??, where M is your matrix), edit it and rebuild Sage using "sage -b". If you think your request is of general interest, you could also ask on sage-devel if having a square bracket option is something others would want. Maybe someone will implement it! On Wed, Dec 17, 2008 at 7:08 AM, Geodet wrote: > > I have just begun using sagetex (in Kile on Ubuntu Linux) for writing > math lecture notes. I would like sagetex to display the matrices with > square brackets [] instead of round brackets or parentheses (). I > guess that the change must be done in SAGE, so that the latex()- > command produces matrices with square brackets. Do anyone know how > this can be done? > > > > --~--~-~--~~~---~--~~ 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] Fwd: SAGE Crash Report
I got this. The sender's email address doesn't work... -- Forwarded message -- From: Levon Ghazaryan Date: Wed, Dec 17, 2008 at 8:55 AM Subject: SAGE Crash Report To: wst...@gmail.com *** IPython post-mortem report IPython version: 0.8.1 SVN revision : 2280 Platform info : os.name -> posix, sys.platform -> darwin *** Current user configuration structure: {'Version': 0, '__allownew': False, 'alias': [], 'args': [], 'autocall': 0, 'autoedit_syntax': 0, 'autoindent': 1, 'automagic': 1, 'banner': 0, 'c': '\nimport sage.misc.misc; print sage.misc.misc.branch_current_hg_notice(sage.misc.misc.branch_current_hg()); from sage.misc.interpreter import preparser; preparser(True);import sage.all_cmdline; sage.all_cmdline._init_cmdline(globals());from sage.all import Integer, RealNumber;import os; os.chdir("/Users/levon");import sage.misc.interpreter;from sage.misc.interpreter import attached_files;from sage.all_cmdline import *;_=sage.misc.interpreter.load_startup_file("/Users/levon/.sage//init.sage");', 'cache_size': 1000, 'classic': 0, 'color_info': 1, 'colors': 'NoColor', 'confirm_exit': 0, 'debug': 0, 'deep_reload': 0, 'editor': '/usr/local/bin/vim', 'embedded': False, 'execfile': [], 'execute': ['', "def view_all(): view([(i, globals()[i]) for i in variables()], title='All SAGE Variables')", "def variables(): return [k for k in globals() if not k in iglob and len(k) > 0 and k[0] != '_']", 'import sage.misc.preparser_ipython; sage.misc.preparser_ipython.magma_colon_equals=True'], 'gthread': 0, 'help': 0, 'ignore': 0, 'import_all': [], 'import_mod': [], 'import_some': [[]], 'include': [], 'ipythondir': '/Users/levon/.sage/ipython', 'log': 0, 'logfile': '', 'logplay': '', 'magic_docstrings': 0, 'messages': 1, 'multi_line_specials': 1, 'nosep': 0, 'object_info_string_level': 0, 'opts': Struct({'__allownew': True, 'c': '\nimport sage.misc.misc; print sage.misc.misc.branch_current_hg_notice(sage.misc.misc.branch_current_hg()); from sage.misc.interpreter import preparser; preparser(True);import sage.all_cmdline; sage.all_cmdline._init_cmdline(globals());from sage.all import Integer, RealNumber;import os; os.chdir("/Users/levon");import sage.misc.interpreter;from sage.misc.interpreter import attached_files;from sage.all_cmdline import *;_=sage.misc.interpreter.load_startup_file("/Users/levon/.sage//init.sage");'}), 'pdb': 0, 'pprint': 1, 'profile': '', 'prompt_in1': '${sage_prompt()}: ', 'prompt_in2': "${'.'*len(sage_prompt())}: ", 'prompt_out': '', 'prompts_pad_left': 0, 'pylab': 0, 'pylab_import_all': 1, 'q4thread': 0, 'qthread': 0, 'quick': 0, 'quiet': 0, 'rcfile': 'ipythonrc', 'readline': 1, 'readline_merge_completions': 1, 'readline_omit__names': 2, 'readline_parse_and_bind': ['tab: complete', '"\\C-l": possible-completions', 'set show-all-if-ambiguous on', '"\\C-o": tab-insert', '"\\M-i": ""', '"\\M-o": "\\d\\d\\d\\d"', '"\\M-I": "\\d\\d\\d\\d"', '"\\C-r": reverse-search-history', '"\\C-s": forward-search-history', '"\\C-p": history-search-backward', '"\\C-n": history-search-forward', '"\\e[A": history-search-backward', '"\\e[B": history-search-forward', '"\\C-k": kill-line', '"\\C-u": unix-line-discard'], 'readline_remove_delims': '-/~', 'screen_length': -1, 'separate_in': '', 'separate_out': '', 'separate_out2': '', 'system_header': 'IPython system call: ', 'system_verbose': 0, 'term_title': 1, 'tk': 0, 'upgrade': 0, 'wildcards_case_sensitive': 1, 'wthread': 0, 'wxversion': '0', 'xmode': 'Context'} *** Crash traceback: *** History of session input: notebook() *** Last line of input (may not be in above history): notebook() -- William Stein Associate Professor of Mathematics University of Washington http://wstein.org --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to 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)
On Wed, Dec 17, 2008 at 10:58 AM, Robert Dodier wrote: > > 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) Thanks, I didn't know this. > 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. akkogve: You can either install tcl/tk in Sage (which is slightly non-trivial) or just install the system tcl/tk, which I'm sure is some rpm easy to install in Fedora. I think it should work after that. Please report if this doesn't solve the problem. > >> 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: 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: is it possible?
Hi, I hope it is ok to stay on this thread with my question: On Dec 17, 11:15 am, Simon King wrote: --snip-- > sage: solve((A*A.transpose()-MatrixSpace(QQ,2)(1)).list(), A.list()) > --- > ValueErrorTraceback (most recent call > last) > ... > ValueError: Unable to solve [a_0_1^2 + a_0_0^2 - 1, a_0_1*a_1_1 + > a_0_0*a_1_0, a_0_1*a_1_1 + a_0_0*a_1_0, a_1_1^2 + a_1_0^2 - 1] for > ([a_0_0, a_0_1, a_1_0, a_1_1],) Why is it not possible to find solutions? After a substitution, everything works: sage: solve([X.substitute({A[1,1]:sin(x)}) for X in (A*A.transpose ()-1).list()], A.list()) [[a_0_0 == -sin(x), a_0_1 == sqrt(1 - sin(x))*sqrt(sin(x) + 1), a_1_0 == sqrt(1 - sin(x)^2), a_1_1 == r13], [a_0_0 == -sin(x), a_0_1 == -sqrt (1 - sin(x))*sqrt(sin(x) + 1), a_1_0 == -sqrt(1 - sin(x)^2), a_1_1 == r14], [a_0_0 == sin(x), a_0_1 == -sqrt(1 - sin(x))*sqrt(sin(x) + 1), a_1_0 == sqrt(1 - sin(x)^2), a_1_1 == r15], [a_0_0 == sin(x), a_0_1 == sqrt(1 - sin(x))*sqrt(sin(x) + 1), a_1_0 == -sqrt(1 - sin(x)^2), a_1_1 == r16]] I thought that such substitution has the same effect as saying that A [1,1] is between -1 and 1. But it won't help: sage: assume(A[1,1]>=-1) sage: assume(A[1,1]<=1) sage: solve((A*A.transpose()-1).list(), A.list()) --- ValueErrorTraceback (most recent call last) ... ValueError: Unable to solve [a_0_1^2 + a_0_0^2 - 1, a_0_1*a_1_1 + a_0_0*a_1_0, a_0_1*a_1_1 + a_0_0*a_1_0, a_1_1^2 + a_1_0^2 - 1] for ([a_0_0, a_0_1, a_1_0, a_1_1],) Just out of curiosity: What goes wrong? Cheers, Simon --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: Problems plotting slopefield with maxima (plotdf)
Doesn't maxima call gnuplot, unless you specify some options? Do you have that installed (for example, using sage -i ...)? 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". > > I installed sage 3.2.1 under Fedora 9, and used these commands (in the > notebook()): > > load("plotdf") > result: "/home/aasmund/sage-3.2.1-fc9-i686-Linux/local/share/maxima/ > 5.16.3/share\ > /dynamics/plotdf.lisp" > > plotdf([x-8*y, -x-y]) > result: 127 > > Does anybody know which settings I've got wrong? > > Thank you! > > > > > --~--~-~--~~~---~--~~ 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] latex/sagetex display of matrix
I have just begun using sagetex (in Kile on Ubuntu Linux) for writing math lecture notes. I would like sagetex to display the matrices with square brackets [] instead of round brackets or parentheses (). I guess that the change must be done in SAGE, so that the latex()- command produces matrices with square brackets. Do anyone know how this can be done? --~--~-~--~~~---~--~~ 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] Problems plotting slopefield with maxima (plotdf)
When I try to plot a slopefield with maxima (inside sage) I get the cryptic message "127". I installed sage 3.2.1 under Fedora 9, and used these commands (in the notebook()): load("plotdf") result: "/home/aasmund/sage-3.2.1-fc9-i686-Linux/local/share/maxima/ 5.16.3/share\ /dynamics/plotdf.lisp" plotdf([x-8*y, -x-y]) result: 127 Does anybody know which settings I've got wrong? Thank you! --~--~-~--~~~---~--~~ 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: sage ecm-interface
On Dec 17, 2:48 am, Paul Zimmermann wrote: Hi Paul, > sorry to answer late to this thread. :) > > Paul -- does GMP-ECM have a by-design hard limit of 4095 digits? > > the answer is no, this problem is likely related to pexpect. > > >> The real longterm solution to this problem is to totally rewrite the... > > Thanks to Robert Miller that is already in Sage: > > yes instead of the pexpect interface one should use now ecmfactor. I am myself > using it continuously and it is quite robust (unlike the pexpect interface > which runs out of ttys after a few minutes). Ok, the problem here is likely that we use popen3 and do not properly close the tty, so we are leaking file descriptors. Something similar happened with the phc interface, so if this could keeps on living we should fix it. > > Is there any reason we're still shipping the old interface? > > How can I obtain the old functionality? > > I see no reason. However indeed the new interface performs only one curve. > It is easy to extend to run several curves until a factor is found: > > # n is composite, returns a prime factor of n > def Ecmfactor (n): > b1 = 100 > while True: > p = ecmfactor (n, b1)[1] > if is_pseudoprime(p): > return p > b1 = b1 + isqrt(b1) > > Paul Zimmermann Yep, I would recommend we open a new ticket to improve the library interface so that it can do everything that the current pexpect interface can do and once that is done open another ticket do switch the old interface over to use the library interface. Cheers, Michael --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] sage ecm-interface
sorry to answer late to this thread. > Paul -- does GMP-ECM have a by-design hard limit of 4095 digits? the answer is no, this problem is likely related to pexpect. >> The real longterm solution to this problem is to totally rewrite the... > Thanks to Robert Miller that is already in Sage: yes instead of the pexpect interface one should use now ecmfactor. I am myself using it continuously and it is quite robust (unlike the pexpect interface which runs out of ttys after a few minutes). > Is there any reason we're still shipping the old interface? > How can I obtain the old functionality? I see no reason. However indeed the new interface performs only one curve. It is easy to extend to run several curves until a factor is found: # n is composite, returns a prime factor of n def Ecmfactor (n): b1 = 100 while True: p = ecmfactor (n, b1)[1] if is_pseudoprime(p): return p b1 = b1 + isqrt(b1) Paul Zimmermann --~--~-~--~~~---~--~~ 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?
On Dec 17, 2008, at 5:05 AM, Simon King wrote: > > Hi all, > > On Dec 17, 10:07 am, Jason Grout wrote: >> Could you give us a example of precisely what you would like to >> type and >> what you would like Sage to return? > > Of course I don't know what things olfa wants to solve. But my > impression from various previous posts about "solving systems with > symbolic matrices" was the following feature request: > > sage: solve([A*A.transpose()=MatrixSpace(QQ,n)(1)], A in MatrixSpace > (QQ,n)) > (or another meaningful syntax) > > Expected output: A parametrization of all orthogonal (nxn)-matrices. > > And this feature request can occur in two flavours: > a) n is a number, e.g., you specify n=5 and then ask sage to create > the above equations and solve them > b) n is symbolic; it is only assumed that n is a positive integer, and > sage is supposed to try and solve the system in full generality. > > While I think b) is not realistic, a) could in principle be > implemented (but AFAIK, it is not implemented yet, or am I mistaken?). There are certainly some things you can do with general matrices and vectors, but I think doing something like defining A as an nxm matrix and allowing various operations on it is a very useful thing. Mathematica has some support for this, but I don't think it has a general solve. I'd like to be able to define nxm matrices (and by extension vectors), apply transposes and take derivatives. This boils down to a special case non-commutative algebra (because it needs to support the transpose). Cheers, Tim. --- Tim Lahey PhD Candidate, Systems Design Engineering University of Waterloo http://www.linkedin.com/in/timlahey --~--~-~--~~~---~--~~ 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?
Hi again, On Dec 17, 11:05 am, Simon King wrote: --snip-- > Namely, one can do the following: > sage: n=2 > sage: A=Matrix([[var('a_%d_%d'%(i,j)) for j in range(n)] for i in range > (n)]) > sage: solve((A*A.transpose()).list(), A.list()) Oops, I forgot that I wanted orthogonal matrices. But Helas: sage: solve((A*A.transpose()-MatrixSpace(QQ,2)(1)).list(), A.list()) --- ValueErrorTraceback (most recent call last) ... ValueError: Unable to solve [a_0_1^2 + a_0_0^2 - 1, a_0_1*a_1_1 + a_0_0*a_1_0, a_0_1*a_1_1 + a_0_0*a_1_0, a_1_1^2 + a_1_0^2 - 1] for ([a_0_0, a_0_1, a_1_0, a_1_1],) Bad luck indeed. Best regards, Simon --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: is it possible?
Hi all, On Dec 17, 10:07 am, Jason Grout wrote: > Could you give us a example of precisely what you would like to type and > what you would like Sage to return? Of course I don't know what things olfa wants to solve. But my impression from various previous posts about "solving systems with symbolic matrices" was the following feature request: sage: solve([A*A.transpose()=MatrixSpace(QQ,n)(1)], A in MatrixSpace (QQ,n)) (or another meaningful syntax) Expected output: A parametrization of all orthogonal (nxn)-matrices. And this feature request can occur in two flavours: a) n is a number, e.g., you specify n=5 and then ask sage to create the above equations and solve them b) n is symbolic; it is only assumed that n is a positive integer, and sage is supposed to try and solve the system in full generality. While I think b) is not realistic, a) could in principle be implemented (but AFAIK, it is not implemented yet, or am I mistaken?). Namely, one can do the following: sage: n=2 sage: A=Matrix([[var('a_%d_%d'%(i,j)) for j in range(n)] for i in range (n)]) sage: solve((A*A.transpose()).list(), A.list()) [[a_0_0 == r1, a_0_1 == -1*I*r1, a_1_0 == r2, a_1_1 == -1*I*r2], [a_0_0 == r3, a_0_1 == I*r3, a_1_0 == r4, a_1_1 == I*r4], [a_0_0 == r5, a_0_1 == I*r5, a_1_0 == 0, a_1_1 == 0], [a_0_0 == r6, a_0_1 == -1*I*r6, a_1_0 == 0, a_1_1 == 0]] Cheers, Simon --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: is it possible?
olfa wrote: > Helo Sage community, > > I want to know if Sage could deal with symbolic arrays and lists (by > symbolic I mean without specifying the concrete contents of list or > array) > For example I want to solve a system of equations containing lists > and > arrays like this (here A and B are arrays; C and D lists; > x,y,z,t,j,l,i,f and j,j' are variables and c is a constant): > > > solve(x+Sum[A[k],k=i..N]==y+Sum[B[k],k=m..N], > j-Length[C]==l-Length[D], > z/(c power i)==t/(c power f), > ...) Could you give us a example of precisely what you would like to type and what you would like Sage to return? Thanks, Jason --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] is it possible?
Helo Sage community, I want to know if Sage could deal with symbolic arrays and lists (by symbolic I mean without specifying the concrete contents of list or array) For example I want to solve a system of equations containing lists and arrays like this (here A and B are arrays; C and D lists; x,y,z,t,j,l,i,f and j,j' are variables and c is a constant): solve(x+Sum[A[k],k=i..N]==y+Sum[B[k],k=m..N], j-Length[C]==l-Length[D], z/(c power i)==t/(c power f), ...) Thank you very much, --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---