ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sat, 11 Aug 2018 10:14:11 -0500Can I alias a sage command?http://ask.sagemath.org/question/29376/can-i-alias-a-sage-command/If I type `alias`, I get a list of aliases, but they all look very "bashy", and not like sage commands. Can I set an alias for a sage command? Like `alias 'meh'='load("meh.sage")'`?
I have looked on this site, the "SAGE for newbies" document I found by Ted Kosan, doc.sagemath.org, and the general web, and I haven't found *any* documentation on aliases in sage.
When I run that, I get the following output:
sage: alias 'meh'='load("meh.sage")'
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-118-7d3257e61ed9> in <module>()
----> 1 get_ipython().magic(u'alias \'meh\'=\'load("meh.sage")\'')
/usr/lib/sagemath/local/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in magic(self, arg_s)
2302 magic_name, _, magic_arg_s = arg_s.partition(' ')
2303 magic_name = magic_name.lstrip(prefilter.ESC_MAGIC)
-> 2304 return self.run_line_magic(magic_name, magic_arg_s)
2305
2306 #-------------------------------------------------------------------------
/usr/lib/sagemath/local/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in run_line_magic(self, magic_name, line)
2223 kwargs['local_ns'] = sys._getframe(stack_depth).f_locals
2224 with self.builtin_trap:
-> 2225 result = fn(*args,**kwargs)
2226 return result
2227
/usr/lib/sagemath/local/lib/python2.7/site-packages/IPython/core/magics/osm.pyc in alias(self, parameter_s)
/usr/lib/sagemath/local/lib/python2.7/site-packages/IPython/core/magic.pyc in <lambda>(f, *a, **k)
191 # but it's overkill for just that one bit of state.
192 def magic_deco(arg):
--> 193 call = lambda f, *a, **k: f(*a, **k)
194
195 if callable(arg):
/usr/lib/sagemath/local/lib/python2.7/site-packages/IPython/core/magics/osm.pyc in alias(self, parameter_s)
117 # Now try to define a new one
118 try:
--> 119 alias,cmd = par.split(None, 1)
120 except TypeError:
121 print(oinspect.getdoc(self.alias))
ValueError: need more than 1 value to unpack
rexroniMon, 31 Aug 2015 13:42:56 -0500http://ask.sagemath.org/question/29376/Error when running a commandhttp://ask.sagemath.org/question/43337/error-when-running-a-command/Why does sage say that there is an error when I type a command and run it? (even I run 1+1, the error appear)
Here is how sage says:
ERROR: 'closed'
Communication with the Sage server is failing.
Here are some actions you could try to resolve this problem:
- check your internet connection,
- run this cell again,
- close and reopen this file,
- restart the project (in project settings, wrench icon),
- reload the browser tab or even restart your browser,
- delete some of the content in the project's ~/.local directory,
(locally installed Python libraries might interfere with running this worksheet)
pizzaSat, 11 Aug 2018 09:48:34 -0500http://ask.sagemath.org/question/43337/Typing in a command of an adding-to-infinity sumhttp://ask.sagemath.org/question/43339/typing-in-a-command-of-an-adding-to-infinity-sum/1/1-x = x^0+x^1+x^2+...
How can I type in such a command of an adding-to-infinity sum?
Urgent! If anyone have any answer or suggestion, please type in here! Thanks!pizzaSat, 11 Aug 2018 10:14:11 -0500http://ask.sagemath.org/question/43339/Commands that changed expressionhttp://ask.sagemath.org/question/41258/commands-that-changed-expression/Hello!
Following a recent question about the new expressions for "find_minimum/maximum_on_interval", I have a more general concern: are commands that changed name across versions documented and collected in some form? So that old documentation and books aren't rendered irremediably obsolete by Sage's evolution.isaia.ismaeleSun, 25 Feb 2018 07:35:22 -0600http://ask.sagemath.org/question/41258/fast_callable with listshttp://ask.sagemath.org/question/34082/fast_callable-with-lists/I tried using the fast_callable function with a List and keep getting the "Unable to convert...to an integer" error. I am using the list to simply pass parameters to the function.
Are there any special rules or techniques for passing Lists or Arrays to fast-callable ?
Thanks.
GrantEThu, 14 Jul 2016 02:20:41 -0500http://ask.sagemath.org/question/34082/Anticommutator of matriceshttp://ask.sagemath.org/question/9278/anticommutator-of-matrices/Dear all.
I was playing around with matrices, and found out that the commutator is defined, however, I didn't find the anti-commutator.
**Question**
- Is it implemented?
The implementation of commutator is about 5 lines (including comments), so the inclusion of it would be marginal.
Cheers.DoxThu, 30 Aug 2012 05:52:52 -0500http://ask.sagemath.org/question/9278/Launch Jupyter notebook from Sage?http://ask.sagemath.org/question/31088/launch-jupyter-notebook-from-sage/When starting the SageMath REPL, the user is reminded how to launch the Sage Notebook:
$ sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath Version 6.9, Release Date: 2015-10-10 │
│ Type "notebook()" for the browser-based notebook interface. │
│ Type "help()" for help. │
└────────────────────────────────────────────────────────────────────┘
sage:
Is there a command to launch the Jupyter Notebook (formerly IPython Notebook) from Sage?slelievreThu, 26 Nov 2015 07:51:36 -0600http://ask.sagemath.org/question/31088/Converting sage output into static latex functionhttp://ask.sagemath.org/question/31414/converting-sage-output-into-static-latex-function/Hello!
I want to be able to use sagetex to do some work in sage, and then create a latex function with the result of that sage work, but without calling sage every time the function is called.
Here is an example of the current pseudo-code
\begin{sagesilent}
func1 = x - 3
func2 = x + 1
f = expand(func1*func2)
\end{sagesilent}
\newcommand{\foo}{\sage{f}}
Here, what would normally happen is sage silent runs sage, and creates the correct f = x^2 - 2x - 3. Then every time \foo is called, it reruns an instance of sage to go locate the definition of f in the sage file, and then sage will spit out the definition in text to \foo which then will display f. This is taking a lot of compute time unnecessarily, and when things get randomized it all goes to hell.
Is there any way to force a command to take in the (sage) definition when it's defined, and then save that definition as straight up text so that I don't have to rerun sage to go find the definition of f every time I want to call \foo?
Edit: It seems this could be accomplished if there is a way to define a latex command inside the sagesilent environment? From reading the sage doc it seems that this should be possible (there are examples doing it from a sage prompt) but I can't seem to figure out the correct syntax. Suggestions?Jason021Tue, 08 Dec 2015 10:05:53 -0600http://ask.sagemath.org/question/31414/find elements which is integral over a subringhttp://ask.sagemath.org/question/29433/find-elements-which-is-integral-over-a-subring/ Suppose $A=\mathbb{Q}[x_1,x_2,...,x_n]/(p_1,p_2,..,p_k)$ and $B$ is a subring of it ($p_i$ are polynomial ).How to find all $\{x\in A:x \text{ is integral over } B\}$?BenFri, 11 Sep 2015 13:25:56 -0500http://ask.sagemath.org/question/29433/I am a total newbie (and don't apologize for it!) What does the operator "lambda" do? What does it mean?http://ask.sagemath.org/question/25264/i-am-a-total-newbie-and-dont-apologize-for-it-what-does-the-operator-lambda-do-what-does-it-mean/ I am a total newbie (and don't apologize for it!) What does the operator "lambda" do? What does it mean?cltho2Sat, 13 Dec 2014 22:04:11 -0600http://ask.sagemath.org/question/25264/download sagemath.zip for windows,including all packages(sagetex,atlas,etcs)http://ask.sagemath.org/question/10784/download-sagemathzip-for-windowsincluding-all-packagessagetexatlasetcs/download sagemath.zip for windows,including all packages(sagetex,atlas,etcs)
what sage command can show which package is including sagemath.zip for windows?
thank you!cjshThu, 28 Nov 2013 13:53:51 -0600http://ask.sagemath.org/question/10784/How to get sage to NOT calculatehttp://ask.sagemath.org/question/10207/how-to-get-sage-to-not-calculate/I would like to be able to give some variables a value and have sage show it to me in a pritty format.
For example if i have;
a = 2
b = 3
and then I input a+b and sage returns 2+3
Is there a command that let me do this? ToddiSat, 08 Jun 2013 07:37:56 -0500http://ask.sagemath.org/question/10207/About Cython and the main Sage commandshttp://ask.sagemath.org/question/10308/about-cython-and-the-main-sage-commands/I read the "How to import some commands?" and "Importing sage functions into cython?" topics, so I know how importing new commands in Sage and also under %cython.
I found that main commands like "factor" or "identity_matrix" which are automatically available in Sage are not under %cython. Then, it's necessary to add the lines:
"from sage.rings.arith import factor"
"from sage.matrix.constructor import identity_matrix"
**Questions**:
- Why the main commands are not automatically available under %cython ?
- Is there a line importing directly all the main commands under %cython ?
- Or, is it a good idea to improve the Sage software so that it works directly ?
I read also that such imported commands are not "cythonised" (and so not 100 times faster).
- Are there cythonised equivalents of all the main commands ?
- If not, is there a project to cythonised all the main commands ?
- Why Sage does not use directly Cython ?
Sébastien PalcouxTue, 02 Jul 2013 01:16:52 -0500http://ask.sagemath.org/question/10308/plot() command in load .sage scripthttp://ask.sagemath.org/question/10143/plot-command-in-load-sage-script/Hi experts!!
When i save a .sage script (like 'lalala.sage') with the next text:
var('x')
f(x)=4*sin(x)
plot(f,(x,-3,3))
and then, in SAGE, i put
load('lalala.sage')
there doesn't appears the graph of the f(x), but if i put in SAGE (after load 'lalala.sage'):
plot(f,(x,-3,3))
then the graph of f(x) appears
The question is: Why doesn't appears the graph of f(x) when i load the scipt 'lalala.sage'?
Thanks so much!!
Best regardsmresimulatorMon, 20 May 2013 10:39:17 -0500http://ask.sagemath.org/question/10143/exponent of a primehttp://ask.sagemath.org/question/8685/exponent-of-a-prime/I am newbie in SAGE and here. My apologies for any mistake. This is an easy question.
Is there a command that for an integer $m$ and a prime number $p$ returns the exponent of $p$ in $m$?
If not, I would like if the following definition can be improved.
def exponent(p,m):
v=m
sol=0
while v%p==0:
v=v/p
sol=sol+1
return sol
Thanks.emiliocbaTue, 31 Jan 2012 10:00:19 -0600http://ask.sagemath.org/question/8685/equivalent command in sage?http://ask.sagemath.org/question/8177/equivalent-command-in-sage/Hi!
I wonder if there an equivalent command in Sage that behaves like "manipulate" in Mathematica?
Thanks,riemannTue, 21 Jun 2011 07:28:42 -0500http://ask.sagemath.org/question/8177/sage notebook does not respond to commands in cellhttp://ask.sagemath.org/question/7977/sage-notebook-does-not-respond-to-commands-in-cell/When I type a command in the cell and press 'enter' nothing happens.
Everything works fine from the command line.
I have sage 4.6.1 on ubuntu 10.10jwbalesMon, 28 Feb 2011 04:01:10 -0600http://ask.sagemath.org/question/7977/