ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 01 Apr 2021 04:51:59 +0200Is there a way to specify that `\sqrt{}`s should be avoided in favor of exponents when using the `latex()` function?https://ask.sagemath.org/question/56447/is-there-a-way-to-specify-that-sqrts-should-be-avoided-in-favor-of-exponents-when-using-the-latex-function/**Background:** I'm using Sage to do some computations for a LaTeX document I'm preparing. My preferred approach is to include the script directly in the markup, using SageTeX to parse the code and print the results in TeX-readable form. The computations relevant to this question result in a longish list of numbers, most of which are of the form `something*sqrt(pi)`. My intention is to include this list in a table, which I'm constructing using a little Python script I wrote. The script takes a lists of TeX-formatted strings and returns a string with the markup for a table with those strings as rows.
**The problem:** When I call the `latex()` function on the list elements to prepare them for serialization into the table, I get results like this: `\frac{3}{7} \sqrt{7} \sqrt{\pi}`. This is not at all how I would type this if I were "TeXifying" it myself---I'd much prefer `\frac{3}{7} \sqrt{7 \pi}`. Even `\frac{3}{7} (7 \pi)^{1/2}` would be preferable IMO.
Obviously, I could just generate a table and then copy-paste it into my document, tweaking where necessary. I could also try writing a little Python function to massage the output into the desired form. But it made me wonder if there is any way to control or customize the output of `latex()` beyond the basic delimiter-setting functions I found in the docs, and I think that'd be worthwhile to know in any event.
**Specific question:** Is there a way to "tell" Sage to avoid using `\sqrt{}` in its LaTeX output in favor of fractional exponents?perfectly_oddThu, 01 Apr 2021 04:51:59 +0200https://ask.sagemath.org/question/56447/What mean "**kwds" in the option of a command?https://ask.sagemath.org/question/35190/what-mean-kwds-in-the-option-of-a-command/Im trying to figure what are the options of the command "line", then I used the help command "line?" for a brief description of it structure and usage.
In the position for option it says "**kwds", I figure that these are some kind of abbreviations but I dont found on the search of the documentation of sagemath something about this, can someone explain to me or leave a link to this information? Thank you.MasacrosoWed, 19 Oct 2016 19:00:21 +0200https://ask.sagemath.org/question/35190/how to set latex options on graph to make them ultra small ?https://ask.sagemath.org/question/29488/how-to-set-latex-options-on-graph-to-make-them-ultra-small/I am currently playing with functions indexed by unlabeled graphs. The following method (belonging to my parent class which models linear combinations of graphs) tells my parent how to print basis element indexed by a graph m (m is in fact an integer vector modeling a graph up to isomorphism).
def _latex_term(self, m):
r"""
"""
G = m.to_graph()
opt = G.latex_options()
opt.set_option('tkz_style', 'Simple')
opt.set_option('vertex_labels', False)
opt.set_option('scale', 0.25)
opt.set_option('vertex_size', 0.0)
return '\mathcal{M}_{' + latex(G) + '}'
I tried to set the option 'vertex_size' to zero but the size of the vertex was not affected. I realize that some combinations of options can rapidly become incoherent. Currently, I do not manage to do smaller than in the copy-pasted proposition of code.
I just want a very small (but readable) unlabeled graph.nborieFri, 18 Sep 2015 19:06:18 +0200https://ask.sagemath.org/question/29488/passing options to superclass methodhttps://ask.sagemath.org/question/24327/passing-options-to-superclass-method/ I would like to modify the plot code of a plot attribute in a derived class
class Foo(Bar):
def plot(self, **options):
super(Foo, self).plot(options)
This does not seem to work. What is the right way to pass the options?
Hartmut MonienMon, 29 Sep 2014 21:05:39 +0200https://ask.sagemath.org/question/24327/Wasn't there an option to switch between shift enter evaluates and enter evaluates?https://ask.sagemath.org/question/23708/wasnt-there-an-option-to-switch-between-shift-enter-evaluates-and-enter-evaluates/ I seem to remember switching it to enter evaluates after doing several one line python type things. Can you switch it back so that shift enter evaluates? Thanks.EmergencyTemporalShiftThu, 07 Aug 2014 19:20:10 +0200https://ask.sagemath.org/question/23708/Use of constraint_generation in MixedIntegerLinearProgramhttps://ask.sagemath.org/question/10915/use-of-constraint_generation-in-mixedintegerlinearprogram/I would like to solve an LP problem using row generation (aka constraint generation), where I wish to be able to choose how the constraints are generated (this will be done using SAT, or WPMaxSAT through a binary MIP).
Now, in MixedIntegerLinearProgram, there is a boolean option `constraint_generation`. I do not find an explanation of its use and therefore whether it can be used for my stated purpose. So, can I, and if so, how?
Information found, but which did not make th option clear to me:
From the [documentation](http://www.sagemath.org/doc/reference/numerical/sage/numerical/mip.html):
> constraint_generation whether to require the returned solver to support constraint generation (excludes Coin). False by default.
From the [source code documentation](http://https://github.com/sagemath/sage/blob/master/src/sage/numerical/backends/generic_backend.pyx#L983):
> - ``constraint_generation`` (boolean) -- whether the solver returned is to be used for constraint/variable generation. As the interface with Coin does not support constraint/variable generation, setting ``constraint_generation`` to ``False`` ensures that the backend to Coin is not returned when ``solver = None``. This is set to ``False`` by default.
(N.B.: Shouldn't that be: backend to Coin is not returned -> Coin backend may be returned?)Erik QuaeghebeurWed, 15 Jan 2014 09:51:10 +0100https://ask.sagemath.org/question/10915/setting plot optionshttps://ask.sagemath.org/question/10078/setting-plot-options/After a plot has been made, how can one change options but not using show() or save()?
Does command "change_options" in this code exists ?
<pre>
p = plot(some plot)
p.change_options(ticks=[None, 1.5/4])
</pre>
later on
<pre>
p.show()
</pre>
PedroMon, 29 Apr 2013 12:51:43 +0200https://ask.sagemath.org/question/10078/IE9: Loss of Sage Functionalityhttps://ask.sagemath.org/question/8284/ie9-loss-of-sage-functionality/I'm using Sage in the high-school second-year Algebra course I teach, and many of my students use Internet Explorer 9.
When I open Sage in IE9, I lose some functionality. Shift-Enter does not evaluate, and "command( + Tab" does not open an options menu. There are probably more problems I haven't seen.
Is there a way to get full Sage functionality in IE9?Brad BurkmanWed, 24 Aug 2011 11:33:23 +0200https://ask.sagemath.org/question/8284/Setting Precision in Sagehttps://ask.sagemath.org/question/7653/setting-precision-in-sage/ integral(integral(e^(-0.00260657639223762*(h - 11.1600000000000)^2 - 1.34372480515*(d - 2.85000000000000)^2)/pi, d, 0,Infinity), h, 0, Infinity).n()
I have been working through an error I am receiving with the above command. The error I get when I run it is:
TypeError: Error executing code in Maxima
CODE:
sage297 : integrate(sage293,sage294,sage295,sage296)$
Maxima ERROR:
rat: replaced -0.0026065763922 by -200/76729 = -.00260657639223762
rat: replaced -11.16 by -279/25 = -11.16
rat: replaced -1.343724 by -3233/2406 = -1.34372402327515
rat: replaced -2.85 by -57/20 = -2.85
Maxima encountered a Lisp error:
5883790627 is not of type FIXNUM.
Automatically continuing.
To enable the Lisp debugger set *debugger-hook* to nil.
However if I shorten the decimals to something like:
integral(integral(e^(-0.0026*(h - 11.1600000000000)^2 - 1.343724*(d - 2.85)^2)/pi, d, 0,Infinity), h, 0, Infinity).n()
Then the command runs fine without any issues. Now perhaps this is a bug, but really I do not need the level of precision that is in these commands. Of course I do not want numbers here but variables and it is evaluating the variables to this level of precision that is causing the issue. For example I say:
sage: f(d,h) = (1/(2*pi*0.61*13.85))*exp(-1/2*((d-2.85)^2/0.61^2+(h-13.85)^2/13.85^2))
sage: f
(h, d) |--> 0.05918210333195241758892111025625850742735*e^(-0.002606576392237615503916381029337017294634*(h - 11.16000000000000000000000000000000000000)^2 - 1.343724805159903251814028486965869389949*(d - 2.850000000000000000000000000000000000000)^2)/pi
Any ideas?
P.S.
I have searched around, but I have not found any that apply to just basic numbers in Sage.willmwadeMon, 30 Aug 2010 16:27:44 +0200https://ask.sagemath.org/question/7653/What happens in insecure mode?https://ask.sagemath.org/question/7593/what-happens-in-insecure-mode/What happens in insecure mode?
It's a command-line option listed when I type ./sage --help or ./sage -h
"-inotebook [options] -- start the *insecure* Sage notebook"
Aside: Why is the usage convention single dashes/minuses for long options on the command-line?ccanoncThu, 19 Aug 2010 15:24:01 +0200https://ask.sagemath.org/question/7593/What is a common use-case for "./sage -min"?https://ask.sagemath.org/question/7594/what-is-a-common-use-case-for-sage-min/Is the "./sage -min" option purely preference driven (for a person who simply prefers a clean namespace)? Is it commonly used?ccanoncThu, 19 Aug 2010 15:49:52 +0200https://ask.sagemath.org/question/7594/What does "./sage -cleaner" do?https://ask.sagemath.org/question/7595/what-does-sage-cleaner-do/What does "./sage -cleaner" do?
Does it just clean the build files in the currently selected branch? The usage output from "./sage -advanced" doesn't specify.ccanoncThu, 19 Aug 2010 16:04:54 +0200https://ask.sagemath.org/question/7595/