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.Sun, 28 May 2017 19:08:20 -0500Evaluate button is running forever for a simple code!?http://ask.sagemath.org/question/37724/evaluate-button-is-running-forever-for-a-simple-code/ Hi,
I installed Sage in Arch linux, almost every package and tried it in browser and command line. When I operate a simple code in command line, I get the answer quickly. But when I try same code in browser it just runs and runs without any result. I tried several browser, didn't work in any of them. I need some help.sinaSun, 28 May 2017 19:08:20 -0500http://ask.sagemath.org/question/37724/Unable to Use Array without Issue(s) bar turing redhttp://ask.sagemath.org/question/37715/unable-to-use-array-without-issues-bar-turing-red/
In my Sage/CoCalc article (Sage has recently merged with CoCalc), I am unable to create an Array without a red issue bar popping up. Morover, I am unable to cross out element in my array. The issue(s) is `PackageArrayError; illegal pream-token (1): PackageArrayError; illegal pream-token (2)`: ...... and so on.
The whole Document is below.
\documentclass{article}
% set font encoding for PDFLaTeX or XeLaTeX
\usepackage{ifxetex}
\ifxetex
\usepackage{fontspec}
\else
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\fi
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{ragged2e}
\usepackage{graphicx}
\usepackage{breqn}
\usepackage{fixltx2e}
\usepackage{hyperref}
\usepackage{titlesec}
\usepackage{amsopn}
\usepackage{array}
\newcommand{\dd}[1]{\mathrm{d}#1}
% used in maketitle
\title{Regarding Your Version of Natural Density to Rationals}
\author{Aiyappan Nair}
\begin{document}
\maketitle
Your version of asymptotic density to rationals differs from my own version. It is not a simplification but rather a change in definition. And although it is much more simple there are flaws that I would like to mention.
\subsection{Counter-Example}
As mentioned earlier, if sets $T_1,T_2,T_p$ are subsets of $\mathbb{Q}$, a density $D$ should have the following qualities.
(1) If $T_1=T_2$ then $D(T_1)=D(T_2)$
(2) If $T_1\subset{T_2}$ then $D(T_1)\le D(T_2)$
In your new version of the density
$$D=\lim_{r\to\infty}\frac{\left|T_1\cap V(r)\right|}{|V(r)|}$$
Where
$$V(r)=\left\{\left.\frac{m}{n}\right|1<m<r,1<n<r,\gcd(m,n)=1\right\}$$
and $m,n,r\in\mathbb{Z}$
If we set $T_1=\left\{\left.\frac{m}{2n+1}\right|m,n\in\mathbb{Z}\right\}$ and $T_2=\left\{\left.\frac{m}{4n+2}\right|m,n\in\mathbb{Z}\right\}$, I found that $D(T_1)>D(T_2)$ even though $T_1\subset T_2$. Which breaks requirment (2).
\subsection{Proof of Counter Example}
Imagine $V(r)$ as an array of values, restricted by $r$. The numerator is from listed as columns each labelled from $[1,r]$ and the denominator is listed as row labelled from $[1,r]$.
\begin{array}{|l|col1 col2 col3 col4 col5 col6 col7 col8}
& 1 & 2 & 3 & 4 & 5 & .. & r\\
\hline
1 & 1/1 & 2/1 & 3/1 & 4/1 & 5/1 & ..& r/1\\
2 & 1/2 & \st{2/2} & 3/2 & 4/2 & 5/2 & ..& r/2\\
3 & 1/3 & 2/3 & 3/3 & 4/3 & 5/3 & ..& r/3\\
4 & 1/4 & 2/4 & 3/4 & 4/4 & 5/4 & ..& r/4\\
5 & 1/5 & 2/5 & 3/5 & 4/5 & 5/5 & ..& r/5\\
..& .. & .. & .. & .. & .. & ..& .. \\
r & 1/r & 2/r & 3/r & 4/r & 5/r & .. & r/r\\
\end{array}
\end{document}
I have never had this problem with SageMath before it merged with CoCalc. Please help.Krishnan ArbujaFri, 26 May 2017 20:26:21 -0500http://ask.sagemath.org/question/37715/minimize_constrained for a one dimensional functionhttp://ask.sagemath.org/question/9526/minimize_constrained-for-a-one-dimensional-function/Hello all,
I have a bit of a problem with the minimize_constrained function: When I call
minimize_constrained(lambda x: x^2, [lambda x: 1], 99.6)
I get a `TypeError: iteration over a 0-d array` (why?). If I call
minimize_constrained(lambda x: x^2, \
[lambda x: vector({0:1,1:x}).inner_product(vector((0,0)))], 99.6)
I get a `TypeError: unable to find a common ring for all elements`.
This seems to be the case because the the constraint function is sometimes called
with a `numpy.ndarray` and at other times with a `sage.modules.vector_real_double_dense.Vector_real_double_dense`. In the first case
I need to call `float(x[0])`, in the latter I can use `x[0]` directly.
Is it be possible to convert the data to sage vectors throughout the iterations or
do I have to set up a handler to sanitize the input myself?MathmonMon, 12 Nov 2012 01:45:16 -0600http://ask.sagemath.org/question/9526/error in creating relocatable "runtime binaries only"http://ask.sagemath.org/question/37690/error-in-creating-relocatable-runtime-binaries-only/If I clone github.com/sagemath/binary-pkg.git, change branch from develop to master in sage.yaml, and run
$ export PACKAGE="Runtime binaries only"
$ make bdist-sage-linux
I get error messages in stage-sage saying
ERROR:root:At b'.../local/share/doc/sage/html/en/reference/calculus/sage/calculus/ode.htmlX\x1e'
ERROR:root:path terminator b'\x1e' not allowed in .../local/share/doc/sage/doctrees/ca/intro/environment.pickle
What am I doing wrong? Or should I file a bug report?millermjWed, 24 May 2017 20:51:55 -0500http://ask.sagemath.org/question/37690/How can I display a plot from a script?http://ask.sagemath.org/question/37719/how-can-i-display-a-plot-from-a-script/If I type
plot(x^2, (x,-2,2))
in sage, I get the expected plot, displayed as a png file by my default image viewer. If instead I put the line
plot(x^2, (x,-2,2)).show()
in a file test.sage and run
sage test.sage
from the command line, I get
Graphics object consisting of 1 graphics primitive
typed on the command line, but no displayed plot.
How do I display a plot from a script?
millermjSat, 27 May 2017 13:37:44 -0500http://ask.sagemath.org/question/37719/Periodic functionhttp://ask.sagemath.org/question/37699/periodic-function/ HI all,
I want to write in sage a `2pi` periodic even function defined by `f(t) = -t + pi`, for `t` in `[0, pi)`. I already checked [Defining a periodic function](https://ask.sagemath.org/question/10539/defining-a-periodic-function/) and [defining periodic functions](https://ask.sagemath.org/question/7799/defining-periodic-functions/) on this plateform, but none of the provided solutions works for me. My main issue is that I need a way to transform any real number `x` into its unique representative in the interval `[-pi, pi)`. For that I used `frac` and `%` but they both raise errors. Could anyone help me out?
Thanks.sokingFri, 26 May 2017 07:51:21 -0500http://ask.sagemath.org/question/37699/What is the meaning of 3d graph?http://ask.sagemath.org/question/37707/what-is-the-meaning-of-3d-graph/I read the reference manual. There I see only `x,y`. So how is the value of z decided?
Example:
def f(x,y):
return math.sin(y*y+x*x)/math.sqrt(x*x+y*y+.0001)
P = plot3d(f,(-3,3),(-3,3), adaptive=True, color=rainbow(60, 'rgbtuple'), max_bend=.1, max_depth=15)
P.show()
I also don't know how to paste the sage cell code, as only latex is the way here.screened00Fri, 26 May 2017 12:48:26 -0500http://ask.sagemath.org/question/37707/series solutions of higher order ODEshttp://ask.sagemath.org/question/8717/series-solutions-of-higher-order-odes/I'm trying to use Sage to find the general series solution to [$y^{(4)}=\frac{y'y''}{1+x}$](http://math.stackexchange.com/questions/109189/basic-reference-material-about-odes-such-as-saparability-with-calculations-and-e "a posted math question"). So far my best efforts to derive the coefficient recurrence relations, inspired by a good [book draft](http://wdjoyner.com/teach/DiffyQ/des-book.pdf "David Joyner (2007), Introductory Differential Equations using SAGE"), have been along these lines:
R10 = QQ['a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10']
a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10 = R10.gens()
R.<x> = PowerSeriesRing(R10)
y = a0 + a1*x + a2*x^2 + a3*x^3 + a4*x^4 + a5*x^5 + \
a6*x^6 + a7*x^7 + a8*x^8 + a9*x^9 + a10*x^10 + O(x^11)
y1 = y.derivative()
y2 = y1.derivative()
y3 = y2.derivative()
y4 = y3.derivative()
f = (1+x)*y4-y1*y2
i = ideal(f)
# g = i.groebner_fan(); g.reduced_groebner_bases() # a wish
# q = R.quotient(i) # works, but not so useful by itself
and my other approaches ended in tracebacks:
x = var('x'); y = function('y', x)
desolve(diff(y,x,4)-diff(y,x)*diff(y,x,2)/(1 + x), y, contrib_ode=True)
# NotImplementedError: Maxima was unable to solve this ODE.
desolve_laplace(diff(y,x,4) - diff(y,x)*diff(y,x,2)/(1 + x), y)
# TypeError: unable to make sense of Maxima expression
I would like to at least solve that and determine the radius of convergence. *Ideally* (more generally), it would be nice to have a good bag of tricks for working with series DEs such as I imagine [others](http://ask.sagemath.org/question/441/writing-re-usable-sage-scripts#785 "Writing re-usable sage scripts") have [already](file:///home/mike/Projects/Sage/Differential_Equations/series.sage "Are you the right mike?") created. For this, I would like to find or develop techniques to incorporate:
- more convenient coefficients, e.g. from [this thread](http://ask.sagemath.org/question/611/implicitly-defining-a-sequence-of-variables "implicitly-defining-a-sequence-of-variables")
- a way to derive the recurrence relations using Python's lambda operator or this [nice trick](http://ask.sagemath.org/question/142/generating-series#308 "LazyPowerSeriesRing.product_generator.compute_coefficients")
- a solver for higher order ODEs such as above
Any hints, links, references or suggestions would be appreciated.bginsWed, 15 Feb 2012 01:33:26 -0600http://ask.sagemath.org/question/8717/How to view multi-line output?http://ask.sagemath.org/question/37684/how-to-view-multi-line-output/I type `expand( (a+b)**20) ` but I want to see it in a single page, not as a single line?
The same for `88**800`
`I don't want to uncheck the typesetting box.`
So is there a function that can display the output in sage's `raw` format.
What is this format, and how do I see it?
I know show() and view() which show the output in the latex format, but not sage's output format.
screened00Wed, 24 May 2017 08:47:58 -0500http://ask.sagemath.org/question/37684/Matrix conjugacy classes over Z and ideal classeshttp://ask.sagemath.org/question/8244/matrix-conjugacy-classes-over-z-and-ideal-classes/I had a couple questions; the first involves matrix conjugacy classes over the integers and the second involves integral bases. I'm not sure what the algorithms in Sage are for the following procedures.
1) Is it possible to determine if two integer-valued square matrices (which are conjugate over Q) are also conjugate over Z?
2) In a number field K, given an ideal class I, we can find an integral basis for a representative ideal in I by the command:
sage: I.integral_basis()
Is it possible to work in the reverse direction, that is given a set of elements in K which form an integral basis, is it possible to find the corresponding ideal and ideal class for that integral basis?
Thanks in advance for any advice.CCThu, 28 Jul 2011 14:14:45 -0500http://ask.sagemath.org/question/8244/single element list in Rhttp://ask.sagemath.org/question/37704/single-element-list-in-r/ I'm using R to filter a large dataset to a dictionary of lists of values, and using those lists in Sage/Python to make plots. The data is a bunch of measurements between nodes, and I'm trying to automate filtering the data into a bunch of lists for the different permutations nodes. However, if a node pair only consists of one measurement, R is returning it as a float instead of a single element list (this is with the r('measurements$node1$node2$value')._sage_() interface). This is causing code later on to choke. I'd like to avoid a bunch of ugly type-checking on the return values from R if possible.
Is there a way to force R to return a single element list instead of a float some other single-value numeric type?mlantingFri, 26 May 2017 11:12:16 -0500http://ask.sagemath.org/question/37704/Eta products for S_6(Gamma0(24))http://ask.sagemath.org/question/10399/eta-products-for-s_6gamma024/We're trying to find a basis for S_6(Gamma0(24)), and we would like it to be in terms of eta products. We have some eta products that we've worked out by hand, and we want to see which on them are linearly independent. We realize that SAGE has a built in function to find the basis of any space, but our professor has asked us to try and do it by hand a few times for practice.
The problem we're encountering is how to represent out eta products in SAGE. The EtaProduct(level, dict) function only recognizes eta products of a certain kind (the powers of eta have to sum to 0).
For example, if we enter EtaProduct(24, {2:12}) we get the following error : ValueError: sum r_d (=12) is not 0
We would also like to compute the Fourier expansion, to then check for linear independence.Ă‰mileThu, 01 Aug 2013 08:13:24 -0500http://ask.sagemath.org/question/10399/exponential inequalityhttp://ask.sagemath.org/question/37692/exponential-inequality/Hi all, I am trying to solve, using sage, the inequality `exp(x) >= 5`, but this is what I get
sage: solve(exp(x)>=5,x)
#0: solve_rat_ineq(ineq=%e^_SAGE_VAR_x >= 5)
[[e^x - 5 == 0], [e^x - 5 > 0]]
Can anyone tell me what's wrong and how to solve this kind of inequalities?
Thanks
sorry for the presentation of the code, I am new on this plateform.sokingThu, 25 May 2017 02:56:44 -0500http://ask.sagemath.org/question/37692/list of divisors(p-1),pi s primehttp://ask.sagemath.org/question/26089/list-of-divisorsp-1pi-s-prime/ How to compute with sage?
list of divisors(p-1),AnneteMon, 09 Mar 2015 08:45:56 -0500http://ask.sagemath.org/question/26089/Sage seems to be improperly computing an infinite sum, and giving an incorrect answerhttp://ask.sagemath.org/question/35354/sage-seems-to-be-improperly-computing-an-infinite-sum-and-giving-an-incorrect-answer/Reference this question: https://ask.sagemath.org/question/35305/how-i-can-test-this-equality-with-sage/
Here is the evaluation of an infinite sum in sage:
var('n')
f(n) = (-1)^(n+1)/(3*n+6*(-1)^n)
sum(f(2*n)+f(2*n+1),n,0,oo)
1/3*log(2) - 7/9
Evaluating the same sum in Mathematica:
f[n_] := (-1)^(n + 1)/(3*n + 6*(-1)^n)
Sum[f[2*n] + f[2*n + 1], {n, 0, Infinity}]
1/6 (-2 + Log[4])
Sage seems to be giving an incorrect solution. Am I missing something?rtcWed, 02 Nov 2016 12:23:14 -0500http://ask.sagemath.org/question/35354/Subresultant algorithm taking a lot of time for higher degree univariate polynomials with coefficients from fraction fieldshttp://ask.sagemath.org/question/37672/subresultant-algorithm-taking-a-lot-of-time-for-higher-degree-univariate-polynomials-with-coefficients-from-fraction-fields/I have to compute the gcd of univariate polynomials over the fraction field of $\mathbb{Z}[x,y]$. I wanted to use the subresultant algorithm already implemented for UFDs. I copied the same function to fraction_field.py. The subresultant algorithm calls the psuedo division algorithm which has the following step :
R = d*R - c*B.shift(diffdeg) - this hangs when we consider random polynomials of degree >6 in $Frac(\mathbb{Z}[x,y])[z]$.
(Note: In the current version of sage it uses the regular Euclidean algorithm implemented in rings.py for computing gcd in this case. It is much slower than the subresultant algorithm (hangs for degrees >4) which is why I thought the subresultant algorithm will improve things.)
Sample input:
sage: A.<x,y>=ZZ[]
sage: B= Frac(A)
sage: C.<z> = B[]
sage: p = C.random_element(6)
sage: q = C.random_element(6)
sage: gcd(p,q)
The following function is what I copied into fraction_field.py from unique_factorisation_domain.py.
def _gcd_univariate_polynomial(self, f, g):
if f.degree() < g.degree():
A,B = g, f
else:
A,B = f, g
if B.is_zero():
return A
a = b = self.zero()
for c in A.coefficients():
a = a.gcd(c)
if a.is_one():
break
for c in B.coefficients():
b = b.gcd(c)
if b.is_one():
break
d = a.gcd(b)
#d=1
A = A // a
B = B // b
g = h = 1
delta = A.degree()-B.degree()
_,R = A.pseudo_quo_rem(B)
while R.degree() > 0:
A = B
B = R // (g*h**delta)
g = A.leading_coefficient()
h = h*g**delta // h**delta
delta = A.degree() - B.degree()
_, R = A.pseudo_quo_rem(B)
# print("i am here")
if R.is_zero():
b = self.zero()
for c in B.coefficients():
b = b.gcd(c)
if b.is_one():
break
return d*B // b
return d
This calls the following pseudo quo remainder function in polynomial_element.pyx. It is in this function I was able to see that it hangs at R = d*R - c*B.shift(diffdeg).
def pseudo_quo_rem(self,other):
if other.is_zero():
raise ZeroDivisionError("Pseudo-division by zero is not possible")
# if other is a constant, then R = 0 and Q = self * other^(deg(self))
if other in self.parent().base_ring():
return (self * other**(self.degree()), self._parent.zero())
R = self
B = other
Q = self._parent.zero()
e = self.degree() - other.degree() + 1
d = B.leading_coefficient()
while not R.degree() < B.degree():
c = R.leading_coefficient()
diffdeg = R.degree() - B.degree()
Q = d*Q + self.parent()(c).shift(diffdeg)
R = d*R - c*B.shift(diffdeg)
e -= 1
q = d**e
return (q*Q,q*R)muaTue, 23 May 2017 03:50:37 -0500http://ask.sagemath.org/question/37672/Quadratic optimization subject to boundary constraintshttp://ask.sagemath.org/question/37673/quadratic-optimization-subject-to-boundary-constraints/ Hello, I was wondering if Sagemath can be used to optimize a quadratic function
y = b_0 + b_1*x_1 + b_11*x_1^2 + b_2*x_2 + b_22*x_2^2 + ... + b_k*x_k + b_kk*x_kk^2
subject to boundary constraints
1 <= x_i <= 9, i = 1, ..., k
Thanks,
T.S. Lim
T.S. LimTue, 23 May 2017 04:12:40 -0500http://ask.sagemath.org/question/37673/Why is Sage calling 1 a variable?http://ask.sagemath.org/question/37660/why-is-sage-calling-1-a-variable/Consider
x = var('x')
f = 1/(x-3)
limit(f,x=3,dir='below')
UnboundLocalError: local variable 'l' referenced before assignmentcybervigilanteMon, 22 May 2017 00:24:03 -0500http://ask.sagemath.org/question/37660/elliptic curves plothttp://ask.sagemath.org/question/37668/elliptic-curves-plot/The legend shows the functions twice. I don't like that. How can I change it, that the function is only once showed?
Thank you :)
code:
p=plot(EllipticCurve([0,0,0,3,0]), gridlines='true', color=hue(0.7),xmin=-4, xmax=4, ymin=-3, ymax=3, legend_label='$y^2=x^3+3x$')
p+=plot(EllipticCurve([0,0,0,2,0]), gridlines='true', color='cornflowerblue',xmin=-4, xmax=4, ymin=-3, ymax=3, legend_label='$y^2=x^3+2x$')
p+=plot(EllipticCurve([0,0,0,1,0]), gridlines='true', color='red',xmin=-4, xmax=4, ymin=-3, ymax=3, legend_label='$y^2=x^3+x$')
p+=plot(EllipticCurve([0,0,0,-1,0]), gridlines='true', color='orange',xmin=-4, xmax=4, ymin=-3, ymax=3)
p+=plot(EllipticCurve([0,0,0,-2,0]), gridlines='true', color=hue(0.2),xmin=-4, xmax=4, ymin=-3, ymax=3, legend_label='$y^2=x^3-2x$')
p+=plot(EllipticCurve([0,0,0,-3,0]), gridlines='true', color=hue(0.3),xmin=-4, xmax=4, ymin=-3, ymax=3, legend_label='$y^2=x^3-3x$')
p+=point((-3,0), color='white', legend_label='$y^2=x^3-x$')
p.set_legend_options(shadow=False, loc=2)
show(p)
p.axes_labels(['$x$','$y$'])
p.save('Einleitung2.pdf')test1234Mon, 22 May 2017 16:19:41 -0500http://ask.sagemath.org/question/37668/Using Pydev (eclipse) and Sage?http://ask.sagemath.org/question/8238/using-pydev-eclipse-and-sage/Hi,
I've been googling around to find a way to set up pydev and sage, and
have had nothing but the worst of luck.
sage 4.7 is located in /home/steven/sage-4.7, and I've created a
"sage_python" python interpreter who's location is "/home/steven/sage-4.7/local/bin/python".
I've set the following environment variables:
SAGE_ROOT = /home/steven/sage-4.7
LD_LIBRARY_PATH = $SAGE_ROOT/local/lib
Now, when I run the following script (test.py):
#!/usr/bin/env sage -python
import sys
from sage.all import *
print 2
When I run the script with sage_python as the interpreter I get the
following error:
> Traceback (most recent call last):
> File
> "/home/steven/code/whateva/test.py",
> line 4, in <module>
> from sage.all import *
> File "/home/steven/sage-4.7/local/lib/python2.6/site-packages/sage/
> all.py", line 70, in <module>
> from sage.ext.c_lib import _init_csage, sig_on_count
>
> ImportError: libcsage.so: cannot open
> shared object file: No such file or
> directorydirectory
Can anyone help me out with this?
Thanks,
Steven
p.s. I've noticed [this](http://groups.google.com/group/sage- support/browse_thread/thread/1d33ecb0830a307c) post on the sage support google groups, but even when I open
eclipse via
$ sage -sh
$ eclipse &
I get the same error.StevenPollackWed, 20 Jul 2011 06:15:02 -0500http://ask.sagemath.org/question/8238/cocalc.com replace sagemath.com ?http://ask.sagemath.org/question/37656/cocalccom-replace-sagemathcom/Hi
not a fishing site ?ortolljSun, 21 May 2017 09:48:45 -0500http://ask.sagemath.org/question/37656/little doc to install Sage Math On W10http://ask.sagemath.org/question/37644/little-doc-to-install-sage-math-on-w10/Hi
i did a little doc to help install sage math on Windows 10.
[litle doc to install Sage Math On W10](https://docs.google.com/document/d/1JRCPjeiZvN1KboxuKeGI3_ZBIWtc5PHAfeHj-K92vhg/edit)
tell me if you think to something to improve itortolljSat, 20 May 2017 07:21:24 -0500http://ask.sagemath.org/question/37644/Solving returns xhttp://ask.sagemath.org/question/37640/solving-returns-x/> sage: solve(4.94 * 1.062^x == 15, x)
> [531^x == 750/247*500^x]
There are other questions that appear to have the same problem, but honestly I don't understand the answers, and this is a much simpler equation. Why doesn't Sage solve it? I can do it in Maple and by hand in vanilla Python with the math module.Ross1856Sat, 20 May 2017 02:48:15 -0500http://ask.sagemath.org/question/37640/Can someone help in finding code for solve functionhttp://ask.sagemath.org/question/37639/can-someone-help-in-finding-code-for-solve-function/Can someone help in finding code for solve function, i went through the source code but couldn't find it.SatyaSat, 20 May 2017 02:28:34 -0500http://ask.sagemath.org/question/37639/Scale axis width=1 and height=1http://ask.sagemath.org/question/37631/scale-axis-width1-and-height1/Hello,
I would like to scale the y-axis or the x-axis, so that the grid consists of squares with width=1 and also height=1. Because if i draw elliptic curves, it will deform them.
Thank you very much!
Edit: apparently the code is
p3=plot(EllipticCurve([0,0,0,-3.141592654,1.414213562]), color='black', gridlines='true')
show(p3)
p3.axes_labels(['x','y'])
p3.save('ec1.pdf')test1234Fri, 19 May 2017 08:40:06 -0500http://ask.sagemath.org/question/37631/How can I purge unneeded files after compilation?http://ask.sagemath.org/question/37622/how-can-i-purge-unneeded-files-after-compilation/After compiling sage-7.6 from source, I get a folder of size 8.6 GB. I'd like to keep just the files necessary to run sage, but there is no "make clean". How can I purge unneeded files?
On a related note, the readme.md file contains instructions for sage --bdist, which appears to have been removed for quite some time. Who might I ask to have that text removed? millermjThu, 18 May 2017 19:01:54 -0500http://ask.sagemath.org/question/37622/How to convert worksheet to a pdf file?http://ask.sagemath.org/question/37632/how-to-convert-worksheet-to-a-pdf-file/I need to show others something that I made in sage without SageMath. Who can help me? Thanks in advance!YXDFri, 19 May 2017 09:52:32 -0500http://ask.sagemath.org/question/37632/Iterate over acyclic subdigraphshttp://ask.sagemath.org/question/37611/iterate-over-acyclic-subdigraphs/I have a graph `D`, and would like to iterate over its (maximal) acyclic subdigraphs (not necessarily induced).
My current best bet is to iterate over all permutations of the vertex set of D and, for each one, create an acyclic digraph A by going through each edge of D in turn and adding to A only those edges `ij` where `i` is less than `j` in the current permutation.
But this seems awfully inefficient.
More precisely:
D = DiGraph()
D.add_edges([[0,1],[0,2],[1,2],[1,3],[2,3],[3,4],[4,5],[4,6],[5,6],[5,0],[6,0]])
n = D.num_verts()
for p in Permutations(n):
A = DiGraph()
for e in D.edges():
if p[e[0]] < p[e[1]]:
A.add_edge(p[e[0]] -1,p[e[1]] -1)
# Here A is a maximal acyclic subdigraph of D
do_stuff(A)
Any ideas would be greatly appreciated.tassioWed, 17 May 2017 10:34:11 -0500http://ask.sagemath.org/question/37611/Why is math.exp or math.sin used?http://ask.sagemath.org/question/37624/why-is-mathexp-or-mathsin-used/ I saw a small function that used math.
def f(x,y):
return math.exp(x/5)*math.sin(y)
I removed math. from the terms and it worked just the same. What is the purpose of math. ?cybervigilanteThu, 18 May 2017 23:03:34 -0500http://ask.sagemath.org/question/37624/New to sage, but it seems wrong.http://ask.sagemath.org/question/37614/new-to-sage-but-it-seems-wrong/ I am doing some calculations and I was just check on some simplifications and came across a discrepancy. Logically, this does not make any sense to me, so I must assume this is something weird with sage that I am not aware of. I put the problem in a new worksheet to check that I didn't have some variable assigned to a different value elsewhere by accident.
[I apologize for the code and the formatting to follow, I can't upload an image since I am a new user]
> in: l=arccosh(-8*sqrt(2)*(sqrt(2) - 2)/((2^(3/4)*sqrt(sqrt(2) + 2) + sqrt(2) + 2)^2*(2*sqrt(2)/(2^(3/4)*sqrt(sqrt(2) + 2) + sqrt(2) + 2) - 4/(2^(3/4)*sqrt(sqrt(2) + 2) + sqrt(2) + 2))*(sqrt(2)/(2^(3/4)*sqrt(sqrt(2) + 2) + sqrt(2) + 2) - 2/(2^(3/4)*sqrt(sqrt(2) + 2) + sqrt(2) + 2))) + 1)
>in: l
>___
>out:"arccosh(-4*sqrt(2)*(sqrt(2) - 2)/((2^(3/4)*sqrt(sqrt(2) + 2) + sqrt(2) + 2)^2*(sqrt(2)/(2^(3/4)*sqrt(sqrt(2) + 2) + sqrt(2) + 2) - 2/(2^(3/4)*sqrt(sqrt(2) + 2) + sqrt(2) + 2))^2) + 1)
>___
>in: n=cosh(l)
>in: n
>___
>out:"-4*sqrt(2)*(sqrt(2) - 2)/((2^(3/4)*sqrt(sqrt(2) + 2) + sqrt(2) + 2)^2*(sqrt(2)/(2^(3/4)*sqrt(sqrt(2) + 2) + sqrt(2) + 2) - 2/(2^(3/4)*sqrt(sqrt(2) + 2) + sqrt(2) + 2))^2) + 1
>___
> in: bool(n==5+4*sqrt(2))
>___
> out:"True"
>___
> in: bool(l==arccosh(n))
>___
> out:"True"
>___
> in: bool(l==arccosh(5+4*sqrt(2)))
>___
> out:"False"
So, what this says, I have some number l, which is arccosh of an ugly string, and I name the ugly string n. Turns out n simplifies to 5+4*sqrt(2), which I check in the middle of the code with bool. And sage agrees, and I check that l is still arccosh of n, and sage agrees. BUT, then sage says that l is NOT arccosh of 5+4*sqrt(2), which we see at the end of my code.
I don't understand how this could be giving me seemingly contradictory statements. Any help would be very appreciated.
nowadThu, 18 May 2017 10:20:41 -0500http://ask.sagemath.org/question/37614/