Multi-Platform Graphics Programming with Kivy by Moisés Cywiak & David Cywiak
Author:Moisés Cywiak & David Cywiak
Language: eng
Format: epub
ISBN: 9781484271131
Publisher: Apress
(11.1)
The code in Listing 11-4 splits the symbolic expression into several lines, making the code simpler.def f():
N1=100/(5*x**2+3*x+2);
N2=(75*x**3+2*x**2+3);
N3=(50*x-3)/(12*x+5)
return N1*N2*N3;
Q=f();
Listing 11-4Splitting a Symbolic Expression Into Several Code Lines
If we now use the print (Q) directive, we obtain the following:100*(50*x - 3)*(75*x**3 + 2*x**2 + 3)/((12*x + 5)*(5*x**2 + 3*x + 2))
From this result, we can see that Q symbolically represents our algebraic expression. We can obtain the corresponding numerical formula by using the sp.lambdify( Q) directive . The complete code is shown in Listing 11-5.import sympy as sp
x=sp.symbols("x");
def f():
N1=100/(5*x**2+3*x+2);
N2=(75*x**3+2*x**2+3);
N3=(50*x-3)/(12*x+5)
return N1*N2*N3;
Q=f();
R=sp.lambdify(x,Q);
print( R(-2) ); # Calculate the function at x=-2
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Management Strategies for the Cloud Revolution: How Cloud Computing Is Transforming Business and Why You Can't Afford to Be Left Behind by Charles Babcock(4127)
Ego Is the Enemy by Ryan Holiday(3982)
Offensive Shellcode from Scratch by Rishalin Pillay(3616)
Exploring Deepfakes by Bryan Lyon and Matt Tora(3178)
Robo-Advisor with Python by Aki Ranin(2947)
Learning C# by Developing Games with Unity 2021 by Harrison Ferrone(2839)
Speed Up Your Python with Rust by Maxwell Flitton(2831)
Liar's Poker by Michael Lewis(2805)
Linux Command Line and Shell Scripting Techniques by Vedran Dakic and Jasmin Redzepagic(2783)
Agile Security Operations by Hinne Hettema(2781)
OPNsense Beginner to Professional by Julio Cesar Bueno de Camargo(2779)
Extreme DAX by Michiel Rozema & Henk Vlootman(2777)
Essential Cryptography for JavaScript Developers by Alessandro Segala(2717)
Elevating React Web Development with Gatsby by Samuel Larsen-Disney(2708)
AI-Powered Commerce by Andy Pandharikar & Frederik Bussler(2626)
Python for ArcGIS Pro by Silas Toms Bill Parker(2619)
Cryptography Algorithms by Massimo Bertaccini(2613)
Distributed .NET with Microsoft Orleans by Bhupesh Guptha Muthiyalu Suneel Kumar Kunani(2609)
Incident Response Techniques for Ransomware Attacks by Oleg Skulkin(2608)