Giter VIP home page Giter VIP logo

tangentart's Introduction

TangentArt

A simple Python program which creates artistic pictures. It is originally inspired by this Tweet.

Requirements

Tested on Python 3.9.7 (previous versions should work as fine).
Additional libraries needed: numpy, matplotlib.

How to use

Run the .py script using a terminal by specifying the following parameters: the desired boundaries of the independent variable; the desired function to plot using the notation accepted by the numpy library; the number of points where the function and the tangents are evaluated.
Each parameter must be enclosed by quotation marks. As an example, to represent a sine and its tangents in the interval from -20 and +20 using 500 points, one must run:
python3 tangentart.py '-20' '20' 'np.sin(x)' '500'.
A figure will pop-up showing the generated picture. The chosen function is represented as a red soline line, whereas the tangents are shown as thin black lines.
Note that: 1) the independent variable is always called x; 2) the function is defined using the rules set by the numpy library.

Output examples

A few examples are embedded in the following.

Example 1: python3 tangentart.py '-20' '20' 'np.sin(x)' '500'
Picture of a sine plotted in the interval -20 < x < +20 and evaluated in 500 points. Screenshot_20220314_202826

Example 2: python3 tangentart.py '-20' '20' 'x*np.sin(x)' '500'
Picture of the function x*sin(x) plotted in the interval -20 < x < +20 and evaluated in 500 points. Screenshot_20220314_203129

Example 3: python3 tangentart.py '-20' '20' 'x*np.tan(x)' '500'
Picture of tan(x) plotted in the interval -20 < x < +20 and evaluated in 500 points. Screenshot_20220314_203314

tangentart's People

Contributors

alfiovinci avatar

Watchers

 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.