No video

Symbolic Manipulation in Python

  Рет қаралды 63,429

APMonitor.com

APMonitor.com

Күн бұрын

The SymPy package computes symbolic solutions to simplify, expand, factor, differentiate, integrate, and solve equations. These problems cover a range of SymPy functions.

Пікірлер: 68
@thevgancheetah
@thevgancheetah 3 жыл бұрын
This video is the most helpful video ever when it comes to symbolic manipulation using Python!! Thank you so much!!!
@yem.t.3930
@yem.t.3930 3 жыл бұрын
Perfect, comprehensive, very informative and concise, Thank you v. much sir!!!
@adaml929
@adaml929 4 жыл бұрын
Thank you so much for this! quarantine classes expected me to already to know how to do this when I have used python in only one previous class. This helped SO much.
@apm
@apm 4 жыл бұрын
Glad it helped! It can be hard to remember your introductory class, especially if you don't use Python on a regular basis.
@rohitsrao
@rohitsrao 5 жыл бұрын
Thanks for the video. Clear concise explanation and covered major basic functionality!
@CrypticBTR
@CrypticBTR 5 жыл бұрын
fantastic tutorial. Good work!
@aqueeqazam
@aqueeqazam 2 жыл бұрын
Highly informative.
@muntoonxt
@muntoonxt 5 жыл бұрын
If you use sp.display (instead of sp.pprint), it will print out a LaTeX formatted version.
@apm
@apm 5 жыл бұрын
Thanks for the tip!
@junyang1710
@junyang1710 4 жыл бұрын
module 'sympy' has no attribute 'display'
@falolayusuf9684
@falolayusuf9684 5 жыл бұрын
Thanks so much for this video. It really helped for my coursework.
@bharatarse1503
@bharatarse1503 3 жыл бұрын
Amazing thanks for sharing..
@soumakbhattacharjee3866
@soumakbhattacharjee3866 2 жыл бұрын
This is very useful. Thank you very much. Is this notebook available online and open access?
@apm
@apm 2 жыл бұрын
Yes, the notebooks are available here: github.com/APMonitor/learn_python
@giannismaris13
@giannismaris13 3 жыл бұрын
what an amazing work.
@dhimanbhowmick9558
@dhimanbhowmick9558 3 жыл бұрын
Great tutorial, thanks, it is very helpful.
@invittimarcelo
@invittimarcelo 5 жыл бұрын
Amazing tutorial. Thank you and congratulations!
@apm
@apm 5 жыл бұрын
Thanks, Marcelo!
@abdulrahimshihabuddin1119
@abdulrahimshihabuddin1119 2 жыл бұрын
Is there any way to equate symbolic derivatives to zero and solve it ? Say for example, I have dy/dx=0 and dy/dx would be in terms of x . Is it possible to obtain solutions of x from this equation
@apm
@apm 2 жыл бұрын
Yes, you can use the evalf() method in an fsolve function call.
@vitorfranca80
@vitorfranca80 4 жыл бұрын
Fantastic! Tks for this tutorial
@2fbDJLL
@2fbDJLL 5 жыл бұрын
Could you please share the HW document for practice in your video description? Thanks
@apm
@apm 5 жыл бұрын
Sure, it is HW17 here: github.com/APMonitor/learn_python
@gt9538
@gt9538 6 жыл бұрын
fair play man. well presented.
@pedroalexanderhernandezriv9912
@pedroalexanderhernandezriv9912 3 жыл бұрын
gracias profe por tu tiempo
@apm
@apm 3 жыл бұрын
de nada
@mahathik8592
@mahathik8592 4 жыл бұрын
how to find unknown value x by making determinant equal to zero in last example ?
@apm
@apm 4 жыл бұрын
You could use the Sympy determinant function for a matrix such as M.det(). You could then solve for when the determinant is equal to zero with the solve function as shown here: github.com/APMonitor/data_science/blob/master/10.%20Solve_Equations.ipynb
@kqnrqdtqqtttel1778
@kqnrqdtqqtttel1778 4 жыл бұрын
27:17 is not invertible because the determinate = 0, so that will result in a 1/0 in the formula
@apm
@apm 4 жыл бұрын
You are correct. The answer from Sympy is correct for my incorrect matrix. When I fixed my matrix, I received the solution that I expected.
@JulioBarrancoGalaviz
@JulioBarrancoGalaviz 4 жыл бұрын
Great tutorial!
@adekunleajibode214
@adekunleajibode214 3 жыл бұрын
This is a good tutorial. But please if I have two long mathematical formulas and wish to turn them to only one, is it possible with sympy? I mean to shuffle the formulas and construct new formula from the combination?
@apm
@apm 3 жыл бұрын
Yes, that is possible. If you have one function named x and another named y then you can define a new function such as z = x+y or z=x*y. You can then simplify with z.simplify()
@adekunleajibode214
@adekunleajibode214 3 жыл бұрын
@@apm Thanks so much boss. I actually combined like five formulas, the Simplified output is damn too long. Meanwhile, is there any machine learning technique that can achieve better performance than this? Though, the expression of A+B is shorter than A*B
@apm
@apm 3 жыл бұрын
@@adekunleajibode214 I'm not aware of a machine learning method that will combine equations. However, you can use machine learning to create a new regression model from data sampled from your correlations. More information on machine learning is available from the short course: apmonitor.github.io/data_science
@Bbdu75yg
@Bbdu75yg 3 жыл бұрын
Nice!
@maranac10
@maranac10 4 жыл бұрын
Great work.
@miguelramirez187
@miguelramirez187 4 жыл бұрын
Thank you so much
@rvilleg95
@rvilleg95 8 жыл бұрын
How would it be if I wanted to iterate or solve an integral to a certaing value? example, I want to know the upper limit of (some random x) function until the area of the curve is 25 (for example)
@apm
@apm 8 жыл бұрын
Here is some example code: import sympy as sp from scipy.optimize import fsolve sp.init_printing() x = sp.Symbol('x') f = sp.integrate(x**2,x) sp.pprint(f) def myIntegral(y): g = f.subs(x,y).evalf() return g def myResidual(y): # put your objective here (what you want the integral to equal) diff = 25.0 - myIntegral(y) return diff guess = 1 z = fsolve(myResidual,guess) print('Integral at ' + str(z[0]) + ' is ' + str(myIntegral(z)))
@rvilleg95
@rvilleg95 8 жыл бұрын
man yo should write a book or something. This was a project of mine the last semester and the code, even if it was short, wasnt THAT short haha. Thanks. Really enjoy your videos
@Irina-fc3pb
@Irina-fc3pb 4 жыл бұрын
amazing,thank you
@Nogh_art
@Nogh_art 4 жыл бұрын
Hi ! thank you for this video ! Very very helpful ! But I have one little question. When using sp.simplify (), (visual studio) it dosen't print the code. And simplify is in violet just like sp. Is it normal ? Maybe someone had the same problem ?
@apm
@apm 4 жыл бұрын
You may need to run sp.init_printing() or else use sp.pprint() to print the expression. Let me know if this helps. I haven't used it in visual studio before so your insights will be valuable.
@Nogh_art
@Nogh_art 4 жыл бұрын
@@apm Hi ^^, thank you for answering so quickly ! I do run the sp.init_printing () If I can contact you in private I could send you a screenshot ? If I use only the sp.pprint () it dosen't expand or simplify the result ^^'
@apm
@apm 4 жыл бұрын
@@Nogh_art unfortunately, I can't help with specific / private requests for support but you may be able to get it from StackOverflow. Also, try including the simplify inside the pprint such as: sym.pprint(f.simplify())
@Nogh_art
@Nogh_art 4 жыл бұрын
@@apm Hi ^^ ! first of all, that last line worked ! I wasn't thinking about a private request, I though that I might not be the only one having this problem ^^' Thank you so much for your help !
@apm
@apm 4 жыл бұрын
@@Nogh_art No problem - I just get so many requests from individuals who want help with their specific problem. If I can reply on a public forum then at least it is there for others as well. I think your comment will help others too!
@josephbargo5024
@josephbargo5024 4 жыл бұрын
@22.15 This is fixed now btw
@hmblackfox1860
@hmblackfox1860 6 жыл бұрын
thank you so much
@amirhosseinhamedanizad1153
@amirhosseinhamedanizad1153 6 жыл бұрын
TypeError: 'module' object is not callable ????
@apm
@apm 6 жыл бұрын
You need to run this in a Jupyter notebook. There are example notebook files at apmonitor.com/che263
@ef7496
@ef7496 6 жыл бұрын
how I can get the homework problem plz ???
@apm
@apm 6 жыл бұрын
All of the homework problems and solutions are posted to apmonitor.com/che263/index.php/Main/CourseHomework
@ef7496
@ef7496 6 жыл бұрын
Thank you so much sir
@jstello
@jstello 5 жыл бұрын
wonderful stuff!! can you please explain how you got TeX font into Markdown? Thank you!
@apm
@apm 5 жыл бұрын
Markdown supports TeX. You just need to use $ $ if it is inline. Here are a few examples: jupyter-notebook.readthedocs.io/en/stable/examples/Notebook/Typesetting%20Equations.html
@abdallahjafaradi9463
@abdallahjafaradi9463 6 жыл бұрын
Can you please tell me how can I install Sympy into python?
@apm
@apm 6 жыл бұрын
You can install it with "pip install sympy". It is also included in the Anaconda distribution. Here is a tutorial: kzbin.info/www/bejne/mIm6nayFgr6jiKc
@abdallahjafaradi9463
@abdallahjafaradi9463 6 жыл бұрын
Thank you very much. I used pip method and it worked. I have another question, is it possible to use sympy inside PyQt ?
@SpaceGhostNick
@SpaceGhostNick 6 жыл бұрын
cant we just do this by hand with a ti-89?
@apm
@apm 6 жыл бұрын
Yes, a lot of the functionality with SymPy is also available on a TI-89 calculator or similar graphing calculator. The advantage of Python is that it can run on a PC versus limited to a stand-alone calculator. SymPy is one of many packages in a feature rich programming language that can do much more than symbolic math. Sometimes the symbolic math part is only a small part of the overall larger calculation or data manipulation that would be impossible with a graphing calculator.
@theultimatereductionist7592
@theultimatereductionist7592 6 жыл бұрын
I'll take Sympy seriously when it can manipulate (take determinants, inverses) of matrices whose entries are indeterminate variables (i.e. NOT numbers), and (super-grand challenge) take the matrix size, N, as a variable itself. i.e. construct/fill a matrix of size, N, whose value I can specify at run time, with letters a(i,j) i, j = 1 through N
@selrahcnamtrah
@selrahcnamtrah 6 жыл бұрын
27:50
@MarkMcDaniel
@MarkMcDaniel 4 жыл бұрын
Dude, you need to get a better microphone. Lots of static noise coming through.
@apm
@apm 4 жыл бұрын
Yup, I got a new microphone. Check out my later videos.
@afifakhanak
@afifakhanak 4 жыл бұрын
How can we use symbolic manipulator for cryogenic liquid in a cylindrical tank equation solution? Can u help!
@apm
@apm 4 жыл бұрын
Here is more information on symbolic solutions in Python: github.com/APMonitor/data_science/blob/master/10.%20Solve_Equations.ipynb
Install Python Modules
23:59
APMonitor.com
Рет қаралды 405 М.
Python Symbolic and Numeric Solutions
16:15
APMonitor.com
Рет қаралды 16 М.
Violet Beauregarde Doll🫐
00:58
PIRANKA
Рет қаралды 25 МЛН
拉了好大一坨#斗罗大陆#唐三小舞#小丑
00:11
超凡蜘蛛
Рет қаралды 13 МЛН
Derivatives In PYTHON (Symbolic AND Numeric)
17:37
Mr. P Solver
Рет қаралды 48 М.
Chemical Reaction Differential Equations in Python
20:34
APMonitor.com
Рет қаралды 52 М.
If __name__ == "__main__" for Python Developers
8:47
Python Simplified
Рет қаралды 398 М.
Modern Python logging
21:32
mCoding
Рет қаралды 179 М.
SymPy is REVOLUTIONARY For Mathematical Tasks
25:15
NeuralNine
Рет қаралды 68 М.
Solving Equations Symbolically And Using LaTeX In Python!
9:49
Andrew Dotson
Рет қаралды 69 М.
Simulate Coupled Differential Equations in Python
28:23
APMonitor.com
Рет қаралды 51 М.
I run untested, viewer-submitted code on my 500-LED christmas tree.
45:17
Fast Inverse Square Root - A Quake III Algorithm
20:08
Nemean
Рет қаралды 5 МЛН
Violet Beauregarde Doll🫐
00:58
PIRANKA
Рет қаралды 25 МЛН