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.Mon, 08 May 2023 19:03:33 +0200How to get the final table of Simplex Methodhttps://ask.sagemath.org/question/68264/how-to-get-the-final-table-of-simplex-method/ How can I get the table for the simplex method?jbgMon, 08 May 2023 19:03:33 +0200https://ask.sagemath.org/question/68264/turn the simplex type into symbol typehttps://ask.sagemath.org/question/66072/turn-the-simplex-type-into-symbol-type/ I have a list of elements of type simplex. I need them as symbols. I wrote the following:
import sympy as sym
S = SimplicialComplex([[0,1], [1,2], [0,2]])
Chain = S._n_cells_sorted(1)
print(type(Chain[0]))
Chain2 = []
for i in Chain:
Chain2.append(str(i))
print(Chain2[0], type(Chain2[0]))
Chain3 = [sym.symbols(v) for v in Chain2]
print(Chain3[0],type(Chain3[0]))
The program prints:
(0, 1) <class 'sage.topology.simplicial_complex.Simplex'>
(0, 1) <class 'str'>
((0, 1)) <class 'tuple'>
I want to turn the type elements of the initial list `Chain` into symbols but this program turns them into tuples.
I would appreciate any help!InezWed, 25 Jan 2023 00:02:46 +0100https://ask.sagemath.org/question/66072/Can sage draw simplicial complexes?https://ask.sagemath.org/question/55814/can-sage-draw-simplicial-complexes/ I understand it's asking a lot to draw complexes in dimensions $>3$, but for (fairly simple) 2 dimensional complexes, it seems reasonable that some plotting algorithm should exist. Even looking at, say, `simplicial_complexes.Torus()`, it doesn't seem like there's a plot or show method. The docs<sup>1</sup> don't seem to have any information either.
Since the things I'm trying to draw are fairly simple, I would be wiling to plot the $1$-skeleton (which sage can do) and then fill in the $2$-cells myself, but I'm not even sure how to go about doing that. Obviously if there is a pre-existing method or library for this, that would be the best possible solution.
Thanks in advance!
<sup>1</sup>: I don't have the karma to post links, but I'm referencing
doc.sagemath.org/html/en/reference/homology/sage/homology/simplicial_complex.htmldispoMon, 22 Feb 2021 23:20:51 +0100https://ask.sagemath.org/question/55814/Creating a table from a matrix and two vectorshttps://ask.sagemath.org/question/52855/creating-a-table-from-a-matrix-and-two-vectors/Suppose I have the following matrix (8x4) matrix
$\begin{bmatrix}
1 & 2 & 3 & 4 & 1 & 0 & 0 & 20 \\\\
1 & 4 & 5 & 4 & 0 & 1 & 0 & 10 \\\\
2 & 2 & 3 & 4 & 1 & 0 & 1 & 30 \\\\
1 & -1 & 2 & -1 & 0 & 0 & 0 & 0
\end{bmatrix}$
I want to create a table in adding the following vector **above**
$
\begin{bmatrix}
&x_1 & x_2 & x_3 & x_4 & \epsilon_1 & \epsilon_2 & \epsilon_3 & b
\end{bmatrix}
$
which will be invariant
and the following column vector on its **right**
$
\begin{bmatrix}
\epsilon_1 \\\\ \epsilon_2 \\\\ \epsilon_3 \\\\ b
\end{bmatrix}
$
Two answers to my previous question
"[Concatenation of symbolic vectors](https://ask.sagemath.org/question/52838)"
help me construct the line vector which is a concatenation of two vectors.
But I cannot use the answer in the `table()` mechanism
simply because it doesn't work as expected that is
table(name_of_the_matrix, header_row=name_of_the_line_vector)
Is there a way to obtain what I expect? I observed that `html.table()` doesn't work.CyrilleTue, 04 Aug 2020 12:56:59 +0200https://ask.sagemath.org/question/52855/why I get huge number in H-representation in sage?https://ask.sagemath.org/question/43613/why-i-get-huge-number-in-h-representation-in-sage/ I have a set of vertices and I want to find a H-representation of them. I used sage to do that but I got weird number in the inequalities!
here is my code:
vert2 = [[1,2,3,4,2,3,6,0,0,7,6,8,0,1,2,3,4,5,6,7,4,3,2,3,4,1,0,3,0,1],[1,1,2,3,4,2,3,6,0,0,7,6,8,0,1,2,3,4,5,6,7,4,3,2,3,4,1,0,3,0],[0,1,1,2,3,4,2,3,6,0,0,7,6,8,0,1,2,3,4,5,6,7,4,3,2,3,4,1,0,3],[3,0,1,1,2,3,4,2,3,6,0,0,7,6,8,0,1,2,3,4,5,6,7,4,3,2,3,4,1,0],[0,3,0,1,1,2,3,4,2,3,6,0,0,7,6,8,0,1,2,3,4,5,6,7,4,3,2,3,4,1],[1,0,3,0,1,1,2,3,4,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0,7,6,8,0,1,2,3,4,5,6,7,4,3,2,3,4,1,0,3,0,1,1,2,3,4,2,3,6,0],[0,0,7,6,8,0,1,2,3,4,5,6,7,4,3,2,3,4,1,0,3,0,1,1,2,3,4,2,3,6],
[6,0,0,7,6,8,0,1,2,3,4,5,6,7,4,3,2,3,4,1,0,3,0,1,1,2,3,4,2,3],[3,6,0,0,7,6,8,0,1,2,3,4,5,6,7,4,3,2,3,4,1,0,3,0,1,1,2,3,4,2],
[2,3,6,0,0,7,6,8,0,1,2,3,4,5,6,7,4,3,2,3,4,1,0,3,0,1,1,2,3,4],[4,2,3,6,0,0,7,6,8,0,1,2,3,4,5,6,7,4,3,2,3,4,1,0,3,0,1,1,2,3],
[3,4,2,3,6,0,0,7,6,8,0,1,2,3,4,5,6,7,4,3,2,3,4,1,0,3,0,1,1,2],[2,3,4,2,3,6,0,0,7,6,8,0,1,2,3,4,5,6,7,4,3,2,3,4,1,0,3,0,1,1]]
p2=Polyhedron(vertices = vert2)
p2
p2.Hrepresentation()
And here is the part of my answer:
A 29-dimensional polyhedron in ZZ^30 defined as the convex hull of 30 vertices
(An equation (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) x - 91 == 0, An inequality (0, -6643755617445331037202609358, -1115451987061522518725310169, -4620824246361587837443723580, -3077838211630051976366550554, -2958690652672660811230373721, -974408181934402275593859480, -3250586099217454711737435326, -1999390120369594790625124513, -1415422103472822894852139772, -2534807215524130595973233650, -2780858391260346768723034201, -4072521014492760746645432088, -1331138469264064061646992630, -4722885096499104848736533209, -3180475210961898948969228316, -3851685143879995858104878858, -3228011163515660410829231425, -3072642994521821646580427696, -1374868705058151838371429430, -4889037447034222629220355689, -2510460065219895800789661380, -2297947035840486945050864530, -3657717103544642567050992273, -3458628241192993528820697768, -295584745844116667823309878, -3868958368255490017832885737, -6000440427999093271578675404, 853080186343081392188416198, -2835167870342318913892483281) x + 260907258623794816872847788563 >= 0, An inequality (0, -3688248056685400306080899479, -853080186343081392188416198, -7496835803788412429391025556, -1968532173404603910913726367, -5473904432704669229632139778, -3930918397973133368554966752, -3811770839015742203418789919, -1827488368277483667782275678, -4103666285560536103925851524, -2852470306712676182813540711, -2268502289815904287040555970, -3387887401867211988161649848, -3633938577603428160911450399, -4925601200835842138833848286, -2184218655607145453835408828, -5575965282842186240924949407, -4033555397304980341157644514, -4704765330223077250293295056, -4081091349858741803017647623, -3925723180864903038768843894, -2227948891401233230559845628, -5742117633377304021408771887, -3363540251562977192978077578, -3151027222183568337239280728, -4510797289887723959239408471, -4311708427536074921009113966, -1148664932187198060011726076, -4722038554598571410021301935, -6853520614342174663767091602) x + 338537555581015223561993662581 >= 0, naghmeh_msFri, 07 Sep 2018 17:55:00 +0200https://ask.sagemath.org/question/43613/Linear programming with algebraic numbershttps://ask.sagemath.org/question/10357/linear-programming-with-algebraic-numbers/Is it possible to use one of the built in routines for linear programming with algebraic numbers, instead of floating point numbers.
I have to solve a problem on algebraic operators exactly, not numerically.Klaus ScheicherWed, 17 Jul 2013 04:24:26 +0200https://ask.sagemath.org/question/10357/How does one provide initial step size for fmin in scipy?https://ask.sagemath.org/question/8006/how-does-one-provide-initial-step-size-for-fmin-in-scipy/I am trying to minimize a funtion f(x,y) over a domain that is considerably large for x than y. Also the domain of y is much less than one. I want to minimize the function using simplex algorithm provided in scipy - fmin. The same algorithm in gsl has a option of providing inital step size. However, I don't see that option in scipy. Is there a way to provide a initial step-size, or any other python implementation of function minimization that just requires the function not its derivatives in which I can provide the initial step size?
ShashankThu, 17 Mar 2011 17:36:34 +0100https://ask.sagemath.org/question/8006/