20191120 13:00:16 0600  answered a question  How to find a short form of recursive defined sequences? This is possible with Sagemath: Maxima and Sympy have tools to work on recurrences, whose interfaces in Sage are, to say the least, not proeminently presented in Sagemath's documentation. See § 10.2 of this excellent (free) book, and Maxima's and Sympy's documentations... 
20191120 12:50:08 0600  commented question  Strange behavior of plot Before what ? 
20191120 11:27:07 0600  commented answer  How to find all roots with solve? On what subject ? Getting all Sympy results in Sage u=is a large work, already undertaken notably by someone whose trac login is rws and whose name escapes me presently (getting old isn't fun...). The present occurrence is but a special case... Do you suggest a "sympy usability" metaticket ? The Mathematica interface has other problems, most notably the lack of correct Mathematica<>Sage conversions. E. g., try to use This is true in the reverse direction also 'Sage complains of the lack of a function Since Mathematica isn't free, I doubt that polishing its interface can be considered highpriority. Sympy's can, however... 
20191119 13:53:29 0600  answered a question  obtaining all numerical roots of a function in an interval Formally, it can't be done. For example, $\sin\displaystyle\frac{1}{x}$ has an infinity of roots between 1 and 1... 
20191119 13:40:05 0600  answered a question  How to find all roots with solve? Sympy offers us a solution, but sage is not (yet) ready to parse it totally. But with a little Sympy's doc reading and a little manual unscrewing, one can get it: A bit of fooling around with $$2 \pi n + \arctan\left(\frac{2 \pi  5}{\pi \sqrt{\frac{20}{\pi}  \frac{25}{\pi^{2}} + 12}}\right)$$ $$\pi + 2 \pi n  \arctan\left(\frac{2 \pi  5}{\pi \sqrt{\frac{20}{\pi}  \frac{25}{\pi^{2}} + 12}}\right)$$ $$\pi + 2 \pi n + \arctan\left(\frac{2 \pi + 5}{2 \pi \sqrt{\frac{5}{\pi}  \frac{25}{4 \pi^{2}} + 3}}\right)$$ $$2 \pi + 2 \pi n  \arctan\left(\frac{2 \pi + 5}{2 \pi \sqrt{\frac{5}{\pi}  \frac{25}{4 \pi^{2}} + 3}}\right)$$ Note: Note 2: Substituting these values in EDIT : A few notes for the terminally curious:
I have been unable to obtain nononsensical results from One can also screw around which is: $$\pi + 2 \pi k + \arcsin\left(\frac{2 \pi + 5}{4 \pi}\right)$$ $$2 \pi k  \arcsin\left(\frac{2 \pi + 5}{4 \pi}\right)$$ $$\pi + 2 \pi k  \arcsin\left(\frac{2 \pi  5}{4 \pi}\right)$$ $$2 \pi k + \arcsin\left(\frac{2 \pi  5}{4 \pi}\right)$$ which turns out to be somewhat easier to check/prove: 
20191117 16:39:13 0600  answered a question  import error on debian WorksForMe (TM). On Python3based Sage 9.0.beta5 running on Debian testing: You'll note that Sympy insists on giving its solutions as dictionaries... You'll note that your error stack starts by quoting lines from your input file, whoch bears very little semblance to what you have given us as your input file. Did you play with hard links recently ? or have had disk troubles ? 
20191115 11:49:17 0600  commented answer  incorrect plot of simple defined function, but works with lambda Yon can also 
20191115 00:10:09 0600  answered a question  incorrect plot of simple defined function, but works with lambda Another classic Sage trap... What happens ?
Because: When the Python variable Now, in the call Oppose this to This is also true in the This trap is somewhat specific to Sage, since Python does not have evaluable symbolic expressions... HTH, 
20191112 06:55:18 0600  commented answer  Sending parameters The metacommentary is, IMHO, necessary, not only for this case, but for a multitude of other cases (reviewiong "old" quiestions is instructive...). 
20191112 00:42:04 0600  answered a question  Sending parameters From the Python docs: sys.argv The list of command line arguments passed to a Python script. To loop over the standard input, or the list of files given on the command line, see the fileinput module. Note On Unix, command line arguments are passed by bytes from OS. Python decodes them with filesystem encoding and “surrogateescape” error handler. When you need original bytes, you can get it by 
20191108 01:11:26 0600  commented answer  Does sagemath move asterisks down? Yes, I meant 
20191107 14:37:21 0600  answered a question  Does sagemath move asterisks down? I don't have your font. But I can reproduce your problem while using the "Inconsolata" mono font. OTOH, I obtain correct results by using (while I'm sure that they exist, I didn't take the time to look up the necessary idioms to set the font options you desire for your listings. I'll do that if/when I have the time...). So:
It might be worthy to open an issue on the Sagetex Github page... As for fixing that up yourself, well... First look if If so, the problem is in SageTeX, in which case you have now a reasonable chance to get your patch in a future version of SageTeX, now that the Sage core team can act on it. If not, the problem is in 
20191107 13:38:32 0600  commented answer  How to create 31tuples with nonnegative entries that sum to 1 Indeed. But the uniformity wasn't specified in the problem statement... and i'm lazy :). Generating a simplex q=with uniform density isn't that simple... 
20191107 02:37:24 0600  commented question  maximizing sum over feasible set of vectors Okay. But there are still contradictions : for example, $E(\underline{\alpha})$ is definded as a sum iover pairs $A,\,B$ with $A\cap B\neq\emptyset$, but with the "precision";
which is contradictory (disjoint sets are defined by an empty intersection...). The original poster should attempt to clarify what he's after : we (I, for the least) have limited time to play games... 
20191106 12:46:07 0600  commented question  maximizing sum over feasible set of vectors Okay. you want to (pedantly) number the components of $\underline{\alpha}$ in binary. And to ignore $\alpha_0$. Right ? $A$ is therefore an index of the 31 components of $\underline{\alpha}$,$v(\underline{\alpha})$ is $\sum_{i=1}^{32}\alpha_{i1}$. Still right ? 
20191106 12:37:42 0600  commented answer  Having trouble importing the lazy_laurent_series module Your Sage is too old (8.1 is quite old by today's standards...). From the doc:

20191106 04:48:27 0600  commented answer  Latex multicolumn is not recognized Nils, your answer is perfectly valid and correct. Just less verbose than mine... 
20191106 04:45:55 0600  commented answer  How to create 31tuples with nonnegative entries that sum to 1 Clapclapclapclapclap ! Very nice (much more general than my ad hoc solution...). 
20191105 22:22:56 0600  commented question  maximizing sum over feasible set of vectors Also, go easy on (pseudo)formalism: I can't make head or tails of your definition of $\underline{\alpha}$... For another example, you define $A$ as a subset of $[5]$ ; but now, what is $\log(A)$ ??? 
20191105 22:12:10 0600  answered a question  How to create 31tuples with nonnegative entries that sum to 1 As already pointed out by commenters, there are infinitely many such tuples. One way to generate them is: Let's check: All of this is basic Python, nothing Sagespecific... HTH, 
20191105 21:49:25 0600  commented question  maximizing sum over feasible set of vectors Homework ? 
20191105 13:15:59 0600  answered a question  Latex multicolumn is not recognized Well... In a console (or in Sage's But, indeed, in a Jupyter notebook, this fails (not only on By the way, the $${\setlength{\arraycolsep}{2ex} \begin{array}{r*{3}{r}} \multicolumn{1}{c}{\ast}&a&b&c\\hline {}a&a&a&a\ {}b&a&b&c\ {}c&a&c&b\ \end{array}}$$ This can probably worked around by saving the latex text, compiling it with an external LaTeX installation, converting the output to, say, One more reason to use $\LaTeX$ an Sagetex (or pythontex (or orgmode))... HTH, 
20191105 01:51:46 0600  answered a question  Having trouble importing the lazy_laurent_series module WorksForMe(TM). On a Python 3based 9.0.beta3 : NOTE : from the doc:
HTH, 
20191103 16:08:58 0600  answered a question  linear algebra derivative expressions I'm out of my depth here, but I'd suggest a look at the Manifolds project, implemented in Sagemath. 
20191102 07:11:56 0600  received badge  ● Nice Answer (source) 
20191101 09:17:50 0600  commented question  dynamic library not found Could you post this on sagesupport, and specify your installation (platform, mode of installation (i. e. precompiled package or selfcompiled), environment, presence of other Python environments (conda and such...) ) ? 
20191101 03:53:39 0600  answered a question  How to solve this algebraic equation by SageMath (rather than by hand) This can't be solved "automagically" by Sage's default solver (i. e. Maxima's). However, there are some worarounds. First, one can "pilot" Sage's default solver to the solution. First, we try to eliminate the radicals by squaring : isolating the radicals : and squaring again : Any solution of E is solution of E4, which is now a polynomial equation in $$\left[t = \sqrt{\frac{r^{2} u^{2}}{u^{2}  1}  \frac{a^{2}}{u^{2}  1}  \frac{r^{2}}{u^{2}  1}} u, t = \sqrt{\frac{r^{2} u^{2}}{u^{2}  1}  \frac{a^{2}}{u^{2}  1}  \frac{r^{2}}{u^{2}  1}} u\right]$$ Since we have squared our equations (twice..), we may have introduced "spurious solutions. The candidate solutions above must be checked. This is not trivial, and is therefore cowardly left to the reader "as an exercise". It turns out that One can manually extract the roots proposed by which turn out to be the same as those proposed by Maxima: $$\left[u \sqrt{\frac{r^{2} u^{2}  a^{2}  r^{2}}{{\left(u + 1\right)} {\left(u  1\right)}}}, u \sqrt{\frac{r^{2} u^{2}  a^{2}  r^{2}}{{\left(u + 1\right)} {\left(u  1\right)}}}\right]$$ EDIT : One can also directly call EDIT 2: Along the same lines, one can use FriCAS to solve the same equation (with contorsions to to convert the result, again...): EDIT 3: Ditto for Mathematica gives the same solutions (again not automagically translatable to Sage): HTH, 
20191031 04:56:17 0600  commented question  How to solve this algebraic equation by SageMath (rather than by hand) Homework ? Hint: any solution of 
20191031 03:41:46 0600  commented question  How to find the coefficient of a boolean function with respect to some variable? Please take the time to format your question to allow for easier reading (and possibly cut'n paste...). 
20191031 03:40:23 0600  answered a question  How to find the coefficient of a boolean function with respect to some variable? Apparently, you want to treat the then a ring of polynomials in Define and, lo !, it works as you intended: There are probably other ways to do this. HTH, 
20191030 09:37:07 0600  answered a question  1.5 as a fraction You've hit a wellknown snag (more precisely a pair of wellknown snags...). Mathematically, yes. But there's more to this in Sage: First snag : Sage preparses your input and (silently) converts them in terms of Sage objects. For example: In this case, Sage's preparser has read the string "3" as an element of your inut, concluded that it was a numerical integer constant and created a Sage object, element of the Integer ring (i. e $\left({\mathbb Z},\,+,\, .\right)$). The (Python) These are different from Python Such objects do not belong in the hierarchy of Sage objects: The same is true of the preparsing of fractions: Quite simply: The latter is the Sage representation of the $\left({\mathbb Q},\,+,\, .\right)$ ring. And Sage's implementation of Below the system of Sage classes and methods and their interrelation lies the notion of (mathematical) categories, which justifies this implementation. But this is a large subject, which, IIUC, is usually treated at postgrad level (at least un the US, Europeans may do things a bit differently...). See the excellent book Computational Mathematics with SageMath for a (much better) introduction... Of course, you can attempt the division of two Python integers. Which (here's the second snag) results in:
Example
Example (One may note that Python 2 objects have a This behaviour results from a change of heart by Guido van Rossum between Python 2 and Python 3... 
20191029 09:06:16 0600  answered a question  how to use key as index in nested dictionary? Alternative solution: Possibly more readable... 
20191029 08:59:46 0600  answered a question  vector equation solve Okay. On your head be it... The system is redundant: the second equation is the sum of the first and the third, or, more swiftly,
Easy check: But, are these solutions THE solution ? Since the system is redundant, Sage's default solver (i. e. Maxima's) will choke (check it yourself). So let's try solve the second equation first: Really ? One can do better (see the docs...) Aha ! We have an infinity of solutions for We have two possible solutions for Huh ? Here, it pays to have declared Left to the reader as an exercise: More advanced (requires a bit of familiarity with Sage's and Python's modules) : take a result given by Maxima's solver, and retrieve and declare (correctly) the variables created by the solver (useful also for the differential equations solve, etc...) Brief conclusion of this short story : using a computer to compute solutions does not relieve you of the obligation to think about your problem and its solutions. HTH, 
20191029 01:47:48 0600  answered a question  In booleanpolynomialring how we can find coefficient? Homework ? Just a hint, for now: if I understand you correctly, you're trying to use 