Code Monkey home page Code Monkey logo

epai_session10's Introduction

Sequence Types

1. Created a Polygon Class in polygon module:

- where initializer takes in:
        - number of edges/vertices
        - circumradius

  - that can provide these properties:

        - edges
        - vertices
        - interior angle
        - edge length
        - apothem
        - area
        - perimeter

  - that has these functionalities:

        - a proper __repr__ function

        - implements equality (==) based on # vertices and circumradius (__eq__)

        - implements > based on number of vertices only (__gt__)

2. Implemented a Custom Polygon sequence type in polygon_sequence module:

- where initializer takes in:

    - number of vertices for largest polygon in the sequence
    - common circumradius for all polygons

- that can provide these properties:

    - max efficiency polygon: returns the Polygon with the highest area: perimeter ratio

- that has these functionalities:

    - functions as a sequence type (__getitem__)
    - supports the len() function (__len__)
    - has a proper representation (__repr__)

The classes are called and tested in the notebook uploaded.

Strictly convex polygon

A regular strictly convex polygon is a polygon that has the following characteristics:

  • all interior angles are less than 180
  • all sides have equal length

For a regular strictly convex polygon with:

  • n edges (=n vertices) and
  • R circumradius

  • interiorAngle

    • = (n−2)⋅180/n
  • edgeLength,s

    • =2⋅R⋅sin(π/n)
  • apothem,a

    • =R⋅cos(π/n)
  • area

    • =12⋅n⋅s⋅a
  • perimeter

    • =n⋅s

epai_session10's People

Contributors

hemanthreddy-k avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.