Skip to Content
Applied Numerical Methods Using MATLAB, 2nd Edition
book

Applied Numerical Methods Using MATLAB, 2nd Edition

by Won Y. Yang, Wenwu Cao, Jaekwon Kim, Kyung W. Park, Ho-Hyun Park, Jingon Joung, Jong-Suk Ro, Han L. Lee, Cheol-Ho Hong, Taeho Im
May 2020
Intermediate to advanced
656 pages
16h 6m
English
Wiley
Content preview from Applied Numerical Methods Using MATLAB, 2nd Edition

Appendix GSymbolic Computation

Chapter Outline

G.1 How to Declare Symbolic Variables and Handle Symbolic Expressions

To declare any variable(s) as a symbolic variable, you should use the command ‘ sym’ or ‘ syms’ as follows:

  
 >a=sym('a'); t=sym('t'); x=sym('x');  
 >syms a x y t % or, equivalently and more efficiently 

Once the variables have been declared as symbolic, they can be used in expressions and as arguments to many functions without being evaluated as numeric:

 >f=x^2/(1+tan(x)^2); 
 >ezplot(f,[-pi pi]) 
 >simplify(cos(x)^2+sin(x)^2) % simplify an expression 
 ans = 1 
 >simplify(cos(x)^2-sin(x)^2) % simplify an expression 
 ans = cos(2*x) 
 >simplify(2*sin(x)*cos(x)) % simple expression 
 ans = sin(2*x) 
 >simplify(sin(x)*cos(y)+cos(x)*sin(y)) % simple expression 
 ans = sin(x+y) 
 >eq1=expand((x+y)^3-(x+y)^2) % expand 
 eq1 = x^3 + 3*x^2*y - x^2 + 3*x*y^2 - 2*x*y + y^3 - y^2 
 >collect(eq1,y) % collect similar terms in descending order w.r.t. y  
 ans = y^3 + (3*x-1)*y^2 + (3*x^2-2*x)*y + x^3 - x^2 
 >factor(eq1) % factorize 
 ans = [ x + y - 1, x + y, x + y] 
 >horner(eq1) % nested multiplication form 
 ans = x*(x*(x + 3*y - 1) - 2*y + 3*y^2) - y^2 + y^3 
 >pretty(ans) % pretty form 
 2 2 3 
 x (x (x ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Numerical Methods using MATLAB

Numerical Methods using MATLAB

Abhishek K Gupta
MATLAB Numerical Calculations

MATLAB Numerical Calculations

César Pérez López

Publisher Resources

ISBN: 9781119626800Purchase book