The SymPy package computes symbolic solutions to simplify, expand, factor, differentiate, integrate, and solve equations. These problems cover a range of SymPy functions.
Пікірлер: 68
@thevgancheetah3 жыл бұрын
This video is the most helpful video ever when it comes to symbolic manipulation using Python!! Thank you so much!!!
@yem.t.39303 жыл бұрын
Perfect, comprehensive, very informative and concise, Thank you v. much sir!!!
@adaml9294 жыл бұрын
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.
@apm4 жыл бұрын
Glad it helped! It can be hard to remember your introductory class, especially if you don't use Python on a regular basis.
@rohitsrao5 жыл бұрын
Thanks for the video. Clear concise explanation and covered major basic functionality!
@CrypticBTR5 жыл бұрын
fantastic tutorial. Good work!
@aqueeqazam2 жыл бұрын
Highly informative.
@muntoonxt5 жыл бұрын
If you use sp.display (instead of sp.pprint), it will print out a LaTeX formatted version.
@apm5 жыл бұрын
Thanks for the tip!
@junyang17104 жыл бұрын
module 'sympy' has no attribute 'display'
@falolayusuf96845 жыл бұрын
Thanks so much for this video. It really helped for my coursework.
@bharatarse15033 жыл бұрын
Amazing thanks for sharing..
@soumakbhattacharjee38662 жыл бұрын
This is very useful. Thank you very much. Is this notebook available online and open access?
@apm2 жыл бұрын
Yes, the notebooks are available here: github.com/APMonitor/learn_python
@giannismaris133 жыл бұрын
what an amazing work.
@dhimanbhowmick95583 жыл бұрын
Great tutorial, thanks, it is very helpful.
@invittimarcelo5 жыл бұрын
Amazing tutorial. Thank you and congratulations!
@apm5 жыл бұрын
Thanks, Marcelo!
@abdulrahimshihabuddin11192 жыл бұрын
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
@apm2 жыл бұрын
Yes, you can use the evalf() method in an fsolve function call.
@vitorfranca804 жыл бұрын
Fantastic! Tks for this tutorial
@2fbDJLL5 жыл бұрын
Could you please share the HW document for practice in your video description? Thanks
@apm5 жыл бұрын
Sure, it is HW17 here: github.com/APMonitor/learn_python
@gt95386 жыл бұрын
fair play man. well presented.
@pedroalexanderhernandezriv99123 жыл бұрын
gracias profe por tu tiempo
@apm3 жыл бұрын
de nada
@mahathik85924 жыл бұрын
how to find unknown value x by making determinant equal to zero in last example ?
@apm4 жыл бұрын
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
@kqnrqdtqqtttel17784 жыл бұрын
27:17 is not invertible because the determinate = 0, so that will result in a 1/0 in the formula
@apm4 жыл бұрын
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.
@JulioBarrancoGalaviz4 жыл бұрын
Great tutorial!
@adekunleajibode2143 жыл бұрын
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?
@apm3 жыл бұрын
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()
@adekunleajibode2143 жыл бұрын
@@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
@apm3 жыл бұрын
@@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
@Bbdu75yg3 жыл бұрын
Nice!
@maranac104 жыл бұрын
Great work.
@miguelramirez1874 жыл бұрын
Thank you so much
@rvilleg958 жыл бұрын
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)
@apm8 жыл бұрын
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)))
@rvilleg958 жыл бұрын
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-fc3pb4 жыл бұрын
amazing,thank you
@Nogh_art4 жыл бұрын
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 ?
@apm4 жыл бұрын
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_art4 жыл бұрын
@@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 ^^'
@apm4 жыл бұрын
@@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_art4 жыл бұрын
@@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 !
@apm4 жыл бұрын
@@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!
@josephbargo50244 жыл бұрын
@22.15 This is fixed now btw
@hmblackfox18606 жыл бұрын
thank you so much
@amirhosseinhamedanizad11536 жыл бұрын
TypeError: 'module' object is not callable ????
@apm6 жыл бұрын
You need to run this in a Jupyter notebook. There are example notebook files at apmonitor.com/che263
@ef74966 жыл бұрын
how I can get the homework problem plz ???
@apm6 жыл бұрын
All of the homework problems and solutions are posted to apmonitor.com/che263/index.php/Main/CourseHomework
@ef74966 жыл бұрын
Thank you so much sir
@jstello5 жыл бұрын
wonderful stuff!! can you please explain how you got TeX font into Markdown? Thank you!
@apm5 жыл бұрын
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
@abdallahjafaradi94636 жыл бұрын
Can you please tell me how can I install Sympy into python?
@apm6 жыл бұрын
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
@abdallahjafaradi94636 жыл бұрын
Thank you very much. I used pip method and it worked. I have another question, is it possible to use sympy inside PyQt ?
@SpaceGhostNick6 жыл бұрын
cant we just do this by hand with a ti-89?
@apm6 жыл бұрын
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.
@theultimatereductionist75926 жыл бұрын
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
@selrahcnamtrah6 жыл бұрын
27:50
@MarkMcDaniel4 жыл бұрын
Dude, you need to get a better microphone. Lots of static noise coming through.
@apm4 жыл бұрын
Yup, I got a new microphone. Check out my later videos.
@afifakhanak4 жыл бұрын
How can we use symbolic manipulator for cryogenic liquid in a cylindrical tank equation solution? Can u help!
@apm4 жыл бұрын
Here is more information on symbolic solutions in Python: github.com/APMonitor/data_science/blob/master/10.%20Solve_Equations.ipynb