Ask Your Question

assadabbasi's profile - activity

2023-11-30 05:18:10 +0200 received badge  Famous Question (source)
2022-04-05 07:37:11 +0200 received badge  Notable Question (source)
2022-04-05 07:37:11 +0200 received badge  Popular Question (source)
2020-02-07 19:05:41 +0200 received badge  Popular Question (source)
2019-10-28 10:50:13 +0200 received badge  Famous Question (source)
2019-10-28 10:50:13 +0200 received badge  Notable Question (source)
2019-04-18 17:29:09 +0200 received badge  Taxonomist
2017-04-15 10:41:57 +0200 received badge  Notable Question (source)
2017-02-11 21:31:40 +0200 received badge  Famous Question (source)
2017-02-11 21:31:40 +0200 received badge  Notable Question (source)
2016-11-30 20:26:22 +0200 received badge  Famous Question (source)
2016-11-30 20:26:22 +0200 received badge  Notable Question (source)
2016-03-04 22:01:05 +0200 received badge  Popular Question (source)
2014-06-29 03:15:33 +0200 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-29 03:15:33 +0200 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-29 03:15:33 +0200 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-29 03:15:17 +0200 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 12:26:55 +0200 received badge  Popular Question (source)
2014-06-08 21:50:28 +0200 received badge  Popular Question (source)
2013-12-12 22:38:28 +0200 received badge  Popular Question (source)
2013-04-30 15:23:09 +0200 received badge  Teacher (source)
2013-04-30 15:23:09 +0200 received badge  Self-Learner (source)
2013-04-29 20:34:28 +0200 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-29 05:40:53 +0200 answered a question A basic question

Thank You @Eviatar Bach

2013-04-29 05:40:19 +0200 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-29 04:17:01 +0200 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 08:43:44 +0200 received badge  Student (source)
2013-04-24 23:35:46 +0200 answered a question TypeError: FIXNUM.

Thanks for your reply. Yes it solved my problem.

2013-04-24 23:35:41 +0200 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 23:31:26 +0200 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-04 00:34:07 +0200 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 18:35:44 +0200 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 18:35:29 +0200 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-27 00:03:37 +0200 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-25 00:20:41 +0200 answered a question Saving data to an array in sage

Thank you very much @calc314