2020-02-07 12:05:41 -0500 received badge ● Popular Question (source) 2019-10-28 04:50:13 -0500 received badge ● Famous Question (source) 2019-10-28 04:50:13 -0500 received badge ● Notable Question (source) 2019-04-18 10:29:09 -0500 received badge ● Taxonomist 2017-04-15 03:41:57 -0500 received badge ● Notable Question (source) 2017-02-11 14:31:40 -0500 received badge ● Famous Question (source) 2017-02-11 14:31:40 -0500 received badge ● Notable Question (source) 2016-11-30 13:26:22 -0500 received badge ● Famous Question (source) 2016-11-30 13:26:22 -0500 received badge ● Notable Question (source) 2016-03-04 15:01:05 -0500 received badge ● Popular Question (source) 2014-06-28 20:15:33 -0500 marked best answer Intersection of a Cube with two planes and resulting polyhedron Hi, I am new to sage and trying to solve a problem where I have two planes cutting a cube. How can I find the resulting polytope/polyhedron as a result of this cut. cube = polytopes.n_cube(3) cube.Hrepresentation() plane1 = Polyhedron(eqns=[(0,1,0,0)]) plane2 = Polyhedron(eqns=[(1,0,0,-1)])  Please also tell me that what is meant by eqns=[(0,1,0,0)] in sage? what equality it represent? similarly eqns=[(1,0,0,-1)] ? Thanks 2014-06-28 20:15:33 -0500 marked best answer Equalities/Inequalities in Polyhedron() Hi, Anyone can please tell me that what equalities/inequalities in polyhedron(eqns = [()]) represent. e.g. for the following expression P = Polyhedron(eqns=[(0,0,1,0)]) plane2.Hrepresentation() The result is (An equation (0, 1, 0) x + 0 == 0,). Does it mean x2 = 0 plane in 3D? Similarly for plane3 = Polyhedron(eqns=[(1,0,0,-1)]) plane3.Hrepresentation() the result is (An equation (0, 0, 1) x - 1 == 0,). Does it mean x3 = 1 in 3D. If not so, how do we interpret it? Thanks 2014-06-28 20:15:33 -0500 marked best answer Saving data to an array in sage Hi, How can I save data to an array in sage. For example in MATLAB we car make an array of data like this a =0; for i=1:10 a = a + 1; b(i,:) = a end Similarlay how can I save data in 2D array. Thanks 2014-06-28 20:15:17 -0500 marked best answer Extracting numerical value from a symbolic expression Hi, First of sorry for the title as I am not sure what should be the title of this question. I used solve() command to solve a system of equations and got a result like this. [[x1 == (4/3), x2 == (-1/6), x3 == (-1/6)]] We can say that it is some vertex and I want to have a result as (4/3, -1/6, -1/6) or [4/3, -1/6, -1/6]. At the moment I am doing it manually. Is there any sage command that can automatically extract (4/3, -1/6, -1/6) from the solution [[x1 == (4/3), x2 == (-1/6), x3 == (-1/6)]]. Thanks in advance! 2014-06-23 05:26:55 -0500 received badge ● Popular Question (source) 2014-06-08 14:50:28 -0500 received badge ● Popular Question (source) 2013-12-12 15:38:28 -0500 received badge ● Popular Question (source) 2013-04-30 08:23:09 -0500 received badge ● Self-Learner (source) 2013-04-30 08:23:09 -0500 received badge ● Teacher (source) 2013-04-29 13:34:28 -0500 asked a question Integration in Sage Hi, I am working on a problem in Lattice theory where I have to integrate polynomials with thousands of terms. And the integration is in 8 dimensions (means its not a single integral but 8 integrals). I am using integral() in sage to integrate the polynomials. It takes too much time to integrate the polynomials. Is there any way to speed up this integration in sage? 2013-04-28 22:40:53 -0500 answered a question A basic question Thank You @Eviatar Bach 2013-04-28 22:40:19 -0500 marked best answer A basic question It doesn't seem like that number is rational, so you cannot get an exact answer. However, you can get a rational that approximates it to some degree of error. sage: RR(d).nearby_rational(max_error=1e-25) 37/4994305074310  2013-04-28 21:17:01 -0500 asked a question A basic question Hi, I have a basic question. I don't know how to get the desired result. I am solving following problem. var('x1','x2') f1 = exp((2*x1+1))^2/997383793764 f2 = exp((2*x2+2)^2/8726621367521) f = f1*f2 d = f.substitute(x1=0,x2=0)  I get an answer in the form d = e^(89324832445632473/89327467832433434646786) How can I convert my answer (e^(89324832445632473/89327467832433434646786)) to a rational number (P/Q) that don't involve any 'e'? 2013-04-25 01:43:44 -0500 received badge ● Student (source) 2013-04-24 16:35:46 -0500 answered a question TypeError: FIXNUM. Thanks for your reply. Yes it solved my problem. 2013-04-24 16:35:41 -0500 marked best answer TypeError: FIXNUM. The following works for me: var('a') fx = exp(-a*x) taylor(fx,x,1,2).subs(a=-(1/632936348449528153937412733512609636))  2013-04-23 16:31:26 -0500 asked a question TypeError: FIXNUM. Hi everyone, I am using function taylor() in sage to find the Taylor series of a function as follows: var ('x') fx = e^(-(1/632936348449528153)*(x)) taylor(fx,x,1,2)  it gives me the correct answer. But when the the denominator in the exponent (i.e. the denominator of 1/632936348449528153) is increased further by one digit (say 9) I receive the following error message TypeError: ECL says: 6329363484495281539 is not of type FIXNUM. My actual function is like a=e^(-(1/632936348449528153937412733512609636)*(x1))  But when I use the above function again in taylor(), I get the error as shown below. TypeError: ECL says: 632936348449528153937412733512609636 is not of type FIXNUM. Is there any solution to overcome this error???? Note: I am using sage in the Sage Notebook online in a browser. 2013-03-03 17:34:07 -0500 asked a question Connection among the vertices on a plane or hyperplane Hi, I am solving a problem where I want know that whether certain vertices on a hyperplane are connected to each other or not. Say in a 2D plane, if I have 3 or more vertices (points), how can I decide that if all these vertices are connected to each other? Similar is the problem for a hyperplane. Do we have any function/class is sage that can do it? I heard about convex hull algorithms but I don't know how to apply them to this problem. OR can we use graphs to solve this problem? Any help/hint in this regard will be highly appreciated. Thanks 2013-02-27 11:35:44 -0500 marked best answer Intersection of a line and a plane The Problem is that the way you define your line above, you only get the line segment between the two indicated points. The intersection points lies however on the line outside of this segment. So try this instead to see the difference: P = Polyhedron(eqns=[(-6,1,1,1)]) L1 = Polyhedron([[1, 0, 1], [4, -2, 2]]) L2 = Polyhedron(vertices=[[1,0,1]], rays=[[3,-2,1],[-3,2,-1]]) print L1.intersection(P) print L2.intersection(P).vertices()  By the way: Is there an easier way of defining a complete line as a Polyhedron? 2013-02-27 11:35:29 -0500 answered a question Intersection of a line and a plane Thanks for the explanation but how do we get rays=[[3,-2,1],[-3,2,-1]] ??? 2013-02-26 17:03:37 -0500 asked a question Intersection of a line and a plane Hi, I have a line described by points (1, 0, 1), (4, -2, 2) and a plane x + y + z = 6. If solve by hand I get the point of intersection as (7, -4, 3). But in sage, I don't find any intersection point. My code in sage is as follows: P = Polyhedron(eqns=[(-6,1,1,1)]) L = [[1, 0, 1], [4, -2, 2]] L1 = Polyhedron(L) intersect = L1.intersection(P)  Output is "The empty polyhedron in QQ^3". Whats wrong here? my calculation by hand or my code? 2013-02-24 17:20:41 -0500 answered a question Saving data to an array in sage Thank you very much @calc314 2013-02-24 11:14:03 -0500 marked best answer Saving data to an array in sage I don't know here whether you would prefer a list or a matrix or an array as your final data type. But, here is one solution that first builds a list, in case you'd rather have a list. I'm sure there are many other more efficient solutions depending on what you want in the larger picture of what you are doing. a=0 b=[] for i in [1..10]: a+=1 b.append(a) matrix(b)  2013-02-24 11:13:50 -0500 marked best answer Saving data to an array in sage Here are two approaches. Building each row as a list... b=0 c=[] for i in [1..10]: tmp=[] for j in [1..10]: b+=1 tmp.append(b) c.append(tmp) d=matrix(c) print d d[0,1]  Using nested list comprehensions... c=[[10*j+i for i in [1..10]] for j in [0..9]] d=matrix(c) d