Wednesday, July 3, 2024
HomeLanguagesPythonSymPy | Polyhedron.vertices() in Python

SymPy | Polyhedron.vertices() in Python

Polyhedron.vertices() : vertices() is a sympy Python library function that returns the vertices of the polyhedra.

Syntax : sympy.combinatorics.Polyhedrons.Polyhedron.vertices()

Return : vertices of the Polyhedron.

Code #1 : vertices() Example – tetrahedron




# Python code explaining
# SymPy.Polyhedron.vertices()
  
# importing SymPy libraries
from sympy.combinatorics import Permutation, Cycle
from sympy.combinatorics.polyhedron import tetrahedron, octahedron
  
# Using from 
# sympy.combinatorics.polyhedron.Polyhedron.vertices()
  
# Creating Polyhedron
a = tetrahedron.copy()
  
print ("Polyhedron - vertices form : ", a.vertices)
  
a.rotate(0)
print ("\nPolyhedron - vertices form : ", a.vertices)


Output :

Polyhedron – vertices form : (0, 1, 2, 3)

Polyhedron – vertices form : (0, 2, 3, 1)

Code #2 : vertices() Example – octahedron




# Python code explaining
# SymPy.Polyhedron.vertices()
  
# importing SymPy libraries
from sympy.combinatorics import Permutation, Cycle
from sympy.combinatorics.polyhedron import tetrahedron, octahedron
  
# Using from 
# sympy.combinatorics.polyhedron.Polyhedron.vertices()
  
# Creating Polyhedron
a = octahedron.copy()
  
print ("Polyhedron - vertices form : ", a.vertices)
  
a.rotate(0)
print ("\nPolyhedron - vertices form : ", a.vertices)


Output :

Polyhedron – vertices form : (0, 1, 2, 3, 4, 5)

Polyhedron – vertices form : (0, 2, 3, 4, 1, 5)

Ted Musemwa
As a software developer I’m interested in the intersection of computational thinking and design thinking when solving human problems. As a professional I am guided by the principles of experiential learning; experience, reflect, conceptualise and experiment.
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments