Solving Equations Symbolically And Using LaTeX In Python!

  Рет қаралды 68,954

Andrew Dotson

Andrew Dotson

6 жыл бұрын

There are some nice ways to pretty up your codes in python. I use Jupyter Notebook along with libraries like sympy to output equations from my codes in LaTeX format. Keeping things in variable form in addition to passing numerical values to functions is a nice way to keep tabs on what your code is doing.

Пікірлер: 57
@bernsbuenaobra473
@bernsbuenaobra473 5 жыл бұрын
Finally real how to's LaTeX into Anaconda nice to use in explaining algorithms in line and then implementing them in Phyton. Thank you very much Andrew Dotson
@jbl4174
@jbl4174 6 жыл бұрын
shift+enter to run cells
@davidsweeney111
@davidsweeney111 6 жыл бұрын
This is what we want! Big thumbs up! Great stuff Andy!
@drover7476
@drover7476 3 жыл бұрын
You Andrew, are a top shagger. My physics grades this year thank you in advance
@thomasblackwell9507
@thomasblackwell9507 3 жыл бұрын
Great video! Very useful! Please continue with this line of videos!
@danielsears1522
@danielsears1522 5 жыл бұрын
Good video, but you don't need to "declare" your function with "func = sp.Function('func')". "func = sp.sin(x)" is sufficient. For example, import sympy as sp x = sp.symbols('x', real=True) func = sp.Function('func') print(type(func)) func = sp.sin(x) print(type(func)) func = "stuff" print(type(func)) sin "func = sp.Function('func')" creates a variable called func referring to an object of type UndefinedFunction. "func = sp.sin(x)" overwrites this variable reference and creates an object of type "sin". Finally, func = "stuff" overwrites this reference again and creates a string.
@DrIlyas-sq7pz
@DrIlyas-sq7pz 4 жыл бұрын
Thank you sir. We use markdown to write an equation by latex mode. But is there some way to do other mathematical stuff in python like evaluation etc using latex mode ? I faced a big problem writing subscripts when there are many, even with split_super_sub module. This problem can be circumvented by using latex kind of command.
@sciencestararvinsinghk
@sciencestararvinsinghk 6 жыл бұрын
If you're doing physics, try to the vector module in dumpy. Also mpmath is good for changing how precise your values are
@paranoidcomet
@paranoidcomet 3 жыл бұрын
Thanks! This really helped a lot. The output kinda looks weird in Spyder but it's still comprehensible.
@tehyonglip9203
@tehyonglip9203 3 жыл бұрын
if you're using np.power(a,b) just replace it to sp.Pow(a,b). Unfortunately, sp.power(a,b) will not work, the function is slightly different.
@abdelhamidalbaid5276
@abdelhamidalbaid5276 Жыл бұрын
Thank you for the Vedio. I was wondering if we can solve an equation written in Latex code without going back to python code. For example is it possible for python in Jupyter notebook to identify x^2 same as x**2
@mther123
@mther123 5 жыл бұрын
you are great
@sayanjitb
@sayanjitb 3 жыл бұрын
Can please someone say what is the RawNBconvert option there in jupyter notebook?
@virtualpeyman
@virtualpeyman 4 жыл бұрын
Can you also solve DAE systems with SymPy?
@KillGui007
@KillGui007 6 жыл бұрын
Will simpy not lower your computation speed? I would expect this to be the case but have not used it enough to be sure
@navjotsingh2251
@navjotsingh2251 4 жыл бұрын
I’ve not noticed any slower speed impacts whilst using it.
@indescribablecardinal6571
@indescribablecardinal6571 4 ай бұрын
Just import the necessary objects, in that case
@mennowitteveen3313
@mennowitteveen3313 4 жыл бұрын
Could you upload the notebook perhaps?
@_Nibi
@_Nibi 6 жыл бұрын
I used to do sympy, and I don't see the need to define a function f(x). I used to do it in spyder, and I would just define my symbols, then say f = some equation, then do sp.integrate(f, ('variable I'm integrating', 'lower bound', 'upper bound').eval()
@_Nibi
@_Nibi 6 жыл бұрын
As you can see in your code, you defined it but didn’t even use it?
@alaasleem2149
@alaasleem2149 3 жыл бұрын
Please i want to help with single degree linear eq how to solve(solce(eq, x) ) it with sympy.. I tried but it takes laege time
@wesleyblack8302
@wesleyblack8302 2 жыл бұрын
Can you use python to display the latex format on Android I know I've seen apps like Wolfram alpha and symbolab and have a way to display it on apps
@shivajishinde1496
@shivajishinde1496 5 жыл бұрын
This is an excellent job!! I tried applying $$ z=\dfrac{2x}{3y} $$ but it did not work and giving error "invalid syntax". Can you please help me in this?
@trewq398
@trewq398 5 жыл бұрын
i have the same problem with spyder. Now i have to find out how to do it there....
@GLPentAxel
@GLPentAxel 6 жыл бұрын
Have you done any Matlab?
@djmonky4994
@djmonky4994 6 жыл бұрын
Why's this man so perfect
@umaoio312
@umaoio312 6 жыл бұрын
Perfection is unrealistic But he's nice
@sddbakirova1838
@sddbakirova1838 5 жыл бұрын
do you know, guys, how to display equations with latex on tkinter??? HELLLP!!
@edwinarleyhenaovergara6009
@edwinarleyhenaovergara6009 4 жыл бұрын
i am looking for the same thing;do you know something about this now?
@hugosanchezchinesta9989
@hugosanchezchinesta9989 4 жыл бұрын
Same! Did yoy guys find a solution or something??
@adamfattal468
@adamfattal468 3 жыл бұрын
It’s been a year since you asked this question so you’re probably a tkinter master now. I have a project I’m working on and could use a tkinter expert. If you’re interested, you can shoot me an email at programmer3.7@outlook.com
@duvanm2483
@duvanm2483 5 жыл бұрын
How do you install Latex in python?
@michelleliew7341
@michelleliew7341 4 жыл бұрын
You may install Pylatex for creating.tex file.
@kisho2679
@kisho2679 6 ай бұрын
would be helpful if jupyter notebook could live render LaTex so that you instantaneously could see what you are typing (and not wait to finish the markdown scripting before seeing the mathematical expression)
@SurajBorate-bx6hv
@SurajBorate-bx6hv 2 жыл бұрын
Cool but how to do the other way around long latex equations to python code
@kisho2679
@kisho2679 6 ай бұрын
what are Anaconda alternatives?
@umaoio312
@umaoio312 6 жыл бұрын
I started understanding a little about how python coding works but you lost me when you started talking in LaTeX xD I'll have to take computer science and learn to code at some point, just a matter of time now Maybe I can add this to my list of summer things 👍🏾
@umaoio312
@umaoio312 5 жыл бұрын
I finally started learning to code in python: 7 months later 👍🏾
@dylutante
@dylutante 5 жыл бұрын
@@umaoio312 You might like to take a look at scipy lectures, here: www.scipy-lectures.org/ . Those helped me a lot. Section for bare-bones beginners isn't much, but the overview of numpy, scipy and plotting modules helped me so much it's not even funny.
@fizixx
@fizixx 4 жыл бұрын
In order for me to get this to work (to the point up to 3:45) I needed to include: "from IPython.core.display import display"
@crosisbh1451
@crosisbh1451 6 жыл бұрын
could you try some vpython?
@faleru
@faleru Жыл бұрын
How is print used like a statement instead as a function? Is this Python2?
@StarbaseX-co4mv
@StarbaseX-co4mv 2 жыл бұрын
Why don’t you try VSCode. It has built in support for Jupyter, can debug step in/over, show variables etc
@gabrielavendano4821
@gabrielavendano4821 6 жыл бұрын
Did you learn to code in uni or did you know how to before?
@AndrewDotsonvideos
@AndrewDotsonvideos 6 жыл бұрын
I learned during my first internship.
@KillGui007
@KillGui007 6 жыл бұрын
If you kill the kernel you will not have this problem with integration to k...
@magnesiumdrip
@magnesiumdrip 6 жыл бұрын
can you do a video on resumes?
@umaoio312
@umaoio312 6 жыл бұрын
There are actually a lot of videos you can watch for resume help, (quite a few that I've seen recently myself) but if it's really specific to a certain field, especially if that field is physics or math, I think asking Andrew is your best bet
@David-bo7zj
@David-bo7zj 3 жыл бұрын
esc + m + m to make a markdown cell
@siddhantpathak3162
@siddhantpathak3162 3 жыл бұрын
or just press '1' :)
@basalduat
@basalduat 5 жыл бұрын
Andrew, you are doing a very good job here. HOWEVER! Your "talking head" is TOO BIG. Reduce it or get rid of it. Your "talking head" is distracting. Also your text is TOO small. Make the text as large as possible. Most of us have poor eyesight and view your good work on cheap laptops. Good luck to you. Please keep sharing your excellent skills with Jupyter.
@AndrewDotsonvideos
@AndrewDotsonvideos 5 жыл бұрын
Timothy Basaldua I appreciate the feedback!
@sciencestararvinsinghk
@sciencestararvinsinghk 6 жыл бұрын
So you took my advice and used sympy
@brianholloway7468
@brianholloway7468 3 жыл бұрын
Thank you. I really enjoy your videos, however every time I see Python I say to myself "wow Matlab is really awesome!". It seems more intuitive. pi is just pi, no shorthand abbreviations needed. exponents ^ look like normal exponents vs **. I know Python is free, I just can't bring myself to get thru the py veil.
@AbarajithanGnaneswaran
@AbarajithanGnaneswaran 3 жыл бұрын
For me, python is a lot more intuitive than Matlab. If u hate the abbreviations like np, sp and want it matlab style, u can simply say "from numpy import * ". Then u can directly say pi, exp, sin...etc. But those abbreviations are a feature, not a bug. They are namespaces used to seperate different packages used for different purposes. It's super weird to have everything in one namespace, like matlab (or from numpy import *) Matlab, i need to keep the docs open and read them for 15 mins before applying some new function. There's zero consistency. No objects, everything in same namespace, stateful programs, god I hate it... I think it was built in a time where no other way was there to do it. And scientific people hated learning programming properly. So, matlab just gave them a bunch of functions they can use. Say they made a function for a 2d vector. Now they want the same thing for a 3d vector. So they slapped *3d behind the functions name and created a new function. Doing the same with numpy is a bliss. You guess like "this might work" and type a new syntax (like a[a[...,5]>5] ) and it works. It's so intuitive. Numpy extends python's design philosophy. I'm in love with that API. We were given an assignment on signal estimation, not that hard. A transmitter sends some signals (a bit vector) to the receiver. That gets corrupted by gaussian noise. We need to create a bunch of estimators and guess what was sent. It's all on matlab. Need to repeat the experiment changing vector size (N), signal vocabulary....etc. like 4,5 parameters. Friends ended up doing it with a nested for loop 5 steps deep in matlab. For every parameter, for every other parameter. Because matlab natively supports only 2d arrays. And most functions work only on 2d arrays. I decided to do this in numpy. In numpy, i created a 6 dimensional tensor (6d array), with each parameter on each dimension. I added noise and stuff to different dimensions using broadcasting, crunched certain dimensions and like 20 lines later i have a 2D array that I can plot using matplotlib to get the performance of estimator changing with vector size and all. It was a breeze. And it's fast even when u increase repetitions of experiment to a million or something. The whole thing is readable as well... It's elegant.
Solving Systems Of Equations Using Sympy And Numpy (Python)
15:23
Andrew Dotson
Рет қаралды 77 М.
Monte Carlo Integration In Python For Noobs
15:32
Andrew Dotson
Рет қаралды 150 М.
Sigma Kid Hair #funny #sigma #comedy
00:33
CRAZY GREAPA
Рет қаралды 37 МЛН
Получилось у Миланы?😂
00:13
ХАБИБ
Рет қаралды 4,2 МЛН
Mom's Unique Approach to Teaching Kids Hygiene #shorts
00:16
Fabiosa Stories
Рет қаралды 34 МЛН
لقد سرقت حلوى القطن بشكل خفي لأصنع مصاصة🤫😎
00:33
Cool Tool SHORTS Arabic
Рет қаралды 13 МЛН
Python Hash Sets Explained & Demonstrated - Computerphile
18:39
Computerphile
Рет қаралды 113 М.
SymPy is REVOLUTIONARY For Mathematical Tasks
25:15
NeuralNine
Рет қаралды 68 М.
Lessons Learned During My PhD So Far
13:05
Andrew Dotson
Рет қаралды 151 М.
How I use Python in Structural Engineering
17:27
Connor Ferster
Рет қаралды 45 М.
Solving Projectile Motion Problems with Python and SYMPY
20:43
Dot Physics
Рет қаралды 1,8 М.
5 Useful F-String Tricks In Python
10:02
Indently
Рет қаралды 286 М.
SymPy (Symbolic Expressions on Python) in one video | Python # 5
46:38
How to Solve Differential Equations in PYTHON
23:37
Mr. P Solver
Рет қаралды 99 М.
LaTeX for Students - A Simple Quickstart Guide
13:51
Jake B
Рет қаралды 116 М.
Sigma Kid Hair #funny #sigma #comedy
00:33
CRAZY GREAPA
Рет қаралды 37 МЛН