Interactively display algebraic curves with Python and Jupyter

http://qiita.com/hoxo_m/items/5ca984d9dcac16090223 I also tried it with Python and Juyter by referring to this post.

Move the slide bar to plot curves with different parameters. Try installing ipywidgets.

import numpy as np
import pylab as plt 
import matplotlib.cm as cm
%pylab inline
from ipywidgets import  interact


N=5
delta=0.1
xs= np.arange(-N, N, delta)
ys = np.arange(-N, N, delta)
X, Y = np.meshgrid(xs, ys)

def fmesh(f,xs,ys):
    return [[f(x,y)for x in xs] for y in ys]

@interact(a=(-10, 10, 2),index=(1,5,1))
def plot(a,index):
    f=lambda x,y: (y**2-(x + a)*x**2)**index
    plt.figure(figsize=(6,6))
    ticks=range(-5,5)
    plt.xticks(ticks)                                                       
    plt.yticks(ticks) 
    interval = [i/4  for i in range(30)]
    CS=plt.contour(X, Y, fmesh(f,xs,xs),interval)
    plt.clabel(CS, inline=0, fontsize=10)
    plt.contourf(X,Y, fmesh(f,xs,xs))    
    plt.grid()

arith.png

https://gist.github.com/xiangze/558ec538191012462d16b1113cbf803b#file-arithmeticcurveplot-ipynb

reference http://qiita.com/y__sama/items/654ed8ab7464718876f9 http://qiita.com/tanemaki/items/e965cd9c25acbeed860c

Recommended Posts

Interactively display algebraic curves with Python and Jupyter
Linking python and JavaScript with jupyter notebook
Interactively visualize data with TreasureData, Pandas and Jupyter.
Display and shoot webcam video with Python Kivy [GUI]
Programming with Python and Tkinter
Encryption and decryption with Python
Try running Python with Try Jupyter
python with pyenv and venv
Works with Python and R
[Python] Read the csv file and display the figure with matplotlib
Read the VTK file and display the color map with jupyter.
Communicate with FX-5204PS with Python and PyUSB
Shining life with Python and OpenCV
Robot running with Arduino and python
Install Python 2.7.9 and Python 3.4.x with pip.
AM modulation and demodulation with python
[Python] font family and font with matplotlib
Scraping with Python, Selenium and Chromedriver
Scraping with Python and Beautiful Soup
JSON encoding and decoding with python
Hadoop introduction and MapReduce with Python
[GUI with Python] PyQt5-Drag and drop-
Reading and writing NetCDF with Python
I played with PyQt5 and Python3
Reading and writing CSV with Python
Multiple integrals with Python and Sympy
Coexistence of Python2 and 3 with CircleCI (1.0)
Easy modeling with Blender and Python
Sugoroku game and addition game with python
FM modulation and demodulation with Python
Operate Jupyter with REST API to extract and save Python code
Linking Python and Arduino to display IME On / Off with LED
Try to display google map and geospatial information authority map with python
How to build Python and Jupyter execution environment with VS Code
Communicate between Elixir and Python with gRPC
Data pipeline construction with Python and Luigi
Monitor Mojo outages with Python and Skype
Build Jupyter Lab (Python) environment with Docker
FM modulation and demodulation with Python Part 3
[Automation] Manipulate mouse and keyboard with Python
Passwordless authentication with RDS and IAM (Python)
Python installation and package management with pip
Immediate display, forced display, flash of print output result with python (mainly jupyter)
Using Python and MeCab with Azure Databricks
Use Jupyter Lab and Jupyter Notebook with EC2
POST variously with Python and receive with Flask
Jupyter with PYNQ and high-level synthesis with Polyphony
Display Python 3 in the browser with MAMP
Capturing images with Pupil, python and OpenCV
Fractal to make and play with Python
A memo with Python2.7 and Python3 on CentOS
Use PIL and Pillow with Cygwin Python
[Python] Display list elements with variadic arguments
Create and decrypt Caesar cipher with python
CentOS 6.4 with Python 2.7.3 with Apache with mod_wsgi and Django
Reading and writing JSON files with Python
How to display python Japanese with lolipop
Dealing with "years and months" in Python
I installed and used Numba with Python3.5
Tweet analysis with Python, Mecab and CaboCha
Traffic monitoring with Kibana, ElasticSearch and Python