How to: Plot a Function in Python

preview_player
Показать описание
Learn how to define a function and plot it in Python.

Here we are using "Spyder" IDE with the numpy and matplotlib libraries

Useful resources:

Script:

import numpy as np

def f(x,a,b,c):
return a*x**2+b*x+c

a=5
b=1
c=4
ylist = f(xlist,a,b,c)

Рекомендации по теме
Комментарии
Автор

You could be a YouTube hit if you had more material like this. It can be around the similar topics. I enjoined watchin many of your videos even if its close to the same topic. You are great teacher. I have watched many Python youtubers and you one of the best. Pls consider starting making consistent videos weekly so the YouTube algorithm will pick you up

maramarsu
Автор

YOU so much =D
I've been looking for such a straight and simple tutorial for so long!

simone
Автор

Hey, thanks a lot for showing this, very clear and easy to follow. Liked

tarehjernetarehjerne
Автор

Excellent content. Subscribed. Commenting for the algorithms.

iriisnes
Автор

Awesome! Thanks for the clear guide of how to use this matplotlib tool!

zjason
Автор

Thank you so much!! Needed to do something similar for an assignment, this really helped!!

k-xxy
Автор

Please include in your title "Spyder". It will help in the search! :)

mashedpotato
Автор

I am using VSCODE as my IDE. I could not get the plot window to show up, unless I added plt.show() to thee end of your code. I enjoyed your video, but I wanted to know more about which function outputs the graph, and whether or not this issue is IDE specific (spyder vs vscode)

elmo
Автор

awesome. straight, easy, clear -> perfect!

shinyshadow
Автор

Having programmed in Python for some time, I found the video confusing because python does not normally perform math operations on an entire list of floats which is what is done in function f here. And, this program would not work if you manually defined xlist with something like xlist = [-10.0, -9.9, ...., 9.9, 10.0]. However, using numpy to create the list does not create a list of floats but instead a class 'numpy.ndarray' object. Python then understands math operations like xlist **2.

limboski
Автор

these math ones are important... algorithms, plotting, more, please...

coryreedrobbins
Автор

how about if dont know about values of a, b, c and need input ourself, then how to plot the graph

chewchengkai
Автор

You should zoom in the coding part..cant see properly,

shibushil
Автор

Great video. But i have a question, when i run my script i can see the plot bit when i save it as an image, there is just white in that image, any idea why??

oumaimajanouj
Автор

I’m a new student and need help to do this project:
I have a port scanner script it works properly, it works in Pycharm using python3.9.
I have to make a file and I did make call (Example.txt)
On this file, I have to do this:
3. If the Ports is open, it should create a file and add an entry for port number
4. In case of any exception for instance “host is not available”, “host name could not be resolved” or
due to any other error, you need to write that exception into the same file.
I’m not asking for you to do the project for me, I'm only asking ware I need to work or used in my script to accomplish this because it is my first time doing this and working with python too, and I have been struggling with this part one very bad. I can even send you the code, so you can look and only tell me what I’m doing bad, is not working.

rafy-ivanmorales
Автор

Thanks for the video. But it's too small.

spass
Автор

you show how to plot a particular function, but i want to plot any function, how i solve that?
for example: '2*x**2 + x'

flexer
Автор

I know you have good content. But you must know that your video is unwatchable in a Cellphone.
Which cut a great deal of watchers that get this on the fly. :-(

robertocaesar
Автор

how can I plot this one: [X^(2) - (Y+ (X - Y^(2/3))^(2))=0] ? Because I can not seperate here X and Y values.

sayanjitb
Автор

Thank you so You saved me!!!❤ subscribed 🥹

andreaprado