Download as pdf or txt
Download as pdf or txt
You are on page 1of 53

MATLAB R2020a Symbolic Math

Toolbox User s Guide Mathworks


Visit to download the full and correct content document:
https://textbookfull.com/product/matlab-r2020a-symbolic-math-toolbox-user-s-guide-m
athworks/
More products digital (pdf, epub, mobi) instant
download maybe you interests ...

MATLAB Econometrics Toolbox User s Guide The Mathworks

https://textbookfull.com/product/matlab-econometrics-toolbox-
user-s-guide-the-mathworks/

MATLAB Bioinformatics Toolbox User s Guide The


Mathworks

https://textbookfull.com/product/matlab-bioinformatics-toolbox-
user-s-guide-the-mathworks/

MATLAB Mapping Toolbox User s Guide The Mathworks

https://textbookfull.com/product/matlab-mapping-toolbox-user-s-
guide-the-mathworks/

MATLAB Optimization Toolbox User s Guide The Mathworks

https://textbookfull.com/product/matlab-optimization-toolbox-
user-s-guide-the-mathworks/
MATLAB Trading Toolbox User s Guide The Mathworks

https://textbookfull.com/product/matlab-trading-toolbox-user-s-
guide-the-mathworks/

MATLAB Computer Vision Toolbox User s Guide The


Mathworks

https://textbookfull.com/product/matlab-computer-vision-toolbox-
user-s-guide-the-mathworks/

MATLAB Curve Fitting Toolbox User s Guide The Mathworks

https://textbookfull.com/product/matlab-curve-fitting-toolbox-
user-s-guide-the-mathworks/

MATLAB Fuzzy Logic Toolbox User s Guide The Mathworks

https://textbookfull.com/product/matlab-fuzzy-logic-toolbox-user-
s-guide-the-mathworks/

MATLAB Global Optimization Toolbox User s Guide The


Mathworks

https://textbookfull.com/product/matlab-global-optimization-
toolbox-user-s-guide-the-mathworks/
Symbolic Math Toolbox™
User's Guide

R2020a
How to Contact MathWorks

Latest news: www.mathworks.com

Sales and services: www.mathworks.com/sales_and_services

User community: www.mathworks.com/matlabcentral

Technical support: www.mathworks.com/support/contact_us

Phone: 508-647-7000

The MathWorks, Inc.


1 Apple Hill Drive
Natick, MA 01760-2098
Symbolic Math Toolbox™ User's Guide
© COPYRIGHT 1993–2020 by The MathWorks, Inc.
The software described in this document is furnished under a license agreement. The software may be used or copied
only under the terms of the license agreement. No part of this manual may be photocopied or reproduced in any form
without prior written consent from The MathWorks, Inc.
FEDERAL ACQUISITION: This provision applies to all acquisitions of the Program and Documentation by, for, or through
the federal government of the United States. By accepting delivery of the Program or Documentation, the government
hereby agrees that this software or documentation qualifies as commercial computer software or commercial computer
software documentation as such terms are used or defined in FAR 12.212, DFARS Part 227.72, and DFARS 252.227-7014.
Accordingly, the terms and conditions of this Agreement and only those rights specified in this Agreement, shall pertain
to and govern the use, modification, reproduction, release, performance, display, and disclosure of the Program and
Documentation by the federal government (or other entity acquiring for or through the federal government) and shall
supersede any conflicting contractual terms or conditions. If this License fails to meet the government's needs or is
inconsistent in any respect with federal procurement law, the government agrees to return the Program and
Documentation, unused, to The MathWorks, Inc.
Trademarks
MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See
www.mathworks.com/trademarks for a list of additional trademarks. Other product or brand names may be
trademarks or registered trademarks of their respective holders.
Patents
MathWorks products are protected by one or more U.S. patents. Please see www.mathworks.com/patents for
more information.
Revision History
August 1993 First printing
October 1994 Second printing
May 1997 Third printing Revised for Version 2
May 2000 Fourth printing Minor changes
June 2001 Fifth printing Minor changes
July 2002 Online only Revised for Version 2.1.3 (Release 13)
October 2002 Online only Revised for Version 3.0.1
December 2002 Sixth printing
June 2004 Seventh printing Revised for Version 3.1 (Release 14)
October 2004 Online only Revised for Version 3.1.1 (Release 14SP1)
March 2005 Online only Revised for Version 3.1.2 (Release 14SP2)
September 2005 Online only Revised for Version 3.1.3 (Release 14SP3)
March 2006 Online only Revised for Version 3.1.4 (Release 2006a)
September 2006 Online only Revised for Version 3.1.5 (Release 2006b)
March 2007 Online only Revised for Version 3.2 (Release 2007a)
September 2007 Online only Revised for Version 3.2.2 (Release 2007b)
March 2008 Online only Revised for Version 3.2.3 (Release 2008a)
October 2008 Online only Revised for Version 5.0 (Release 2008a+)
October 2008 Online only Revised for Version 5.1 (Release 2008b)
November 2008 Online only Revised for Version 4.9 (Release 2007b+)
March 2009 Online only Revised for Version 5.2 (Release 2009a)
September 2009 Online only Revised for Version 5.3 (Release 2009b)
March 2010 Online only Revised for Version 5.4 (Release 2010a)
September 2010 Online only Revised for Version 5.5 (Release 2010b)
April 2011 Online only Revised for Version 5.6 (Release 2011a)
September 2011 Online only Revised for Version 5.7 (Release 2011b)
March 2012 Online only Revised for Version 5.8 (Release 2012a)
September 2012 Online only Revised for Version 5.9 (Release 2012b)
March 2013 Online only Revised for Version 5.10 (Release 2013a)
September 2013 Online only Revised for Version 5.11 (Release 2013b)
March 2014 Online only Revised for Version 6.0 (Release 2014a)
October 2014 Online only Revised for Version 6.1 (Release 2014b)
March 2015 Online only Revised for Version 6.2 (Release 2015a)
September 2015 Online only Revised for Version 6.3 (Release 2015b)
March 2016 Online only Revised for Version 7.0 (Release 2016a)
September 2016 Online only Revised for Version 7.1 (Release 2016b)
March 2017 Online only Revised for Version 7.2 (Release 2017a)
September 2017 Online only Revised for Version 8.0 (Release 2017b)
March 2018 Online only Revised for Version 8.1 (Release 2018a)
September 2018 Online only Revised for Version 8.2 (Release 2018b)
March 2019 Online only Revised for Version 8.3 (Release 2019a)
September 2019 Online only Revised for Version 8.4 (Release 2019b)
March 2020 Online only Revised for Version 8.5 (Release 2020a)
Contents

Getting Started
1
Symbolic Math Toolbox Product Description . . . . . . . . . . . . . . . . . . . . . . . 1-2
Key Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2

Create Symbolic Numbers, Variables, and Expressions . . . . . . . . . . . . . . . 1-3


Create Symbolic Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3
Create Symbolic Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3
Create Symbolic Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5
Reuse Names of Symbolic Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5

Create Symbolic Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-7

Create Symbolic Matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-9


Use Existing Symbolic Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-9
Generate Elements While Creating a Matrix . . . . . . . . . . . . . . . . . . . . . . . 1-9
Create Matrix of Symbolic Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-10

Perform Symbolic Computations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-11


Differentiate Symbolic Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-11
Integrate Symbolic Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-12
Solve Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-13
Simplify Symbolic Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-15
Substitutions in Symbolic Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . 1-16
Plot Symbolic Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-18

Use Assumptions on Symbolic Variables . . . . . . . . . . . . . . . . . . . . . . . . . . 1-24


Default Assumption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-24
Set Assumptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-24
Check Existing Assumptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-25
Delete Symbolic Objects and Their Assumptions . . . . . . . . . . . . . . . . . . . 1-25

Using Symbolic Math Toolbox Software


2
Find Symbolic Variables in Expressions, Functions, Matrices . . . . . . . . . . 2-3
Find a Default Symbolic Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-3

Choose syms or sym Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-5

Add Subscripts, Superscripts, and Accents to Symbolic Variables . . . . . . 2-8

Change Output Display Format of Symbolic Results . . . . . . . . . . . . . . . . 2-12

v
Copy and Paste Symbolic Output in Live Editor . . . . . . . . . . . . . . . . . . . . 2-15

Units of Measurement Tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-19


Define and Convert Units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-19
Use Temperature Units in Absolute or Difference Forms . . . . . . . . . . . . . 2-20
Verify Dimensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-20
Use Units in Differential Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-22

Units and Unit Systems List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-25


Units List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-25
SI Unit Prefixes List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-35
Unit Systems List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-36
Defining Constants of SI Units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-37

Unit Conversions and Unit Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-39


Convert Units . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-39
Temperature Unit Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-40
Convert to SI, CGS, or US Unit Systems . . . . . . . . . . . . . . . . . . . . . . . . . 2-40
Define Custom Unit System from Existing System . . . . . . . . . . . . . . . . . . 2-42
Define Custom Unit System Directly . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-43
Unit System Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-44

Differentiation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-46
Derivatives of Expressions with Several Variables . . . . . . . . . . . . . . . . . . 2-47
More Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-48

Functional Derivatives Tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-51

Limits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-56
One-Sided Limits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-56

Integration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-59
Integration with Real Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-61
Integration with Complex Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-62
High-Precision Numerical Integration Using Variable-Precision Arithmetic
..................................................... 2-63

Symbolic Summation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-65


Comparing symsum and sum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-65
Computational Speed of symsum versus sum . . . . . . . . . . . . . . . . . . . . . 2-65
Output Format Differences Between symsum and sum . . . . . . . . . . . . . . 2-66

Taylor Series . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-67

Padé Approximant . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-69

Find Asymptotes, Critical, and Inflection Points . . . . . . . . . . . . . . . . . . . 2-76

Simplify Symbolic Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-81


Simplify Using Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-82
Simplify Using Assumptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-84
Simplify Fractions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-84

Solve Algebraic Equation Using Live Editor Task . . . . . . . . . . . . . . . . . . . 2-86

vi Contents
Simplify Symbolic Expressions Using Live Editor Task . . . . . . . . . . . . . . 2-94

Abbreviate Common Terms in Long Expressions . . . . . . . . . . . . . . . . . . 2-101

Choose Function to Rearrange Expression . . . . . . . . . . . . . . . . . . . . . . . 2-104


Combine Terms of Same Algebraic Structures . . . . . . . . . . . . . . . . . . . 2-104
Expand Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-105
Factor Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-106
Extract Subexpressions from Expression . . . . . . . . . . . . . . . . . . . . . . . 2-108
Collect Terms with Same Powers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-108
Rewrite Expressions in Terms of Other Functions . . . . . . . . . . . . . . . . . 2-109
Compute Partial Fraction Decompositions of Expressions . . . . . . . . . . . 2-110
Compute Normal Forms of Rational Expressions . . . . . . . . . . . . . . . . . . 2-110
Represent Polynomials Using Horner Nested Forms . . . . . . . . . . . . . . . 2-111

Clear Assumptions and Reset the Symbolic Engine . . . . . . . . . . . . . . . . 2-112


Check Assumptions Set on Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-113
Effects of Assumptions on Computations . . . . . . . . . . . . . . . . . . . . . . . . 2-114

Extract Numerators and Denominators of Rational Expressions . . . . . 2-115

Substitute Variables in Symbolic Expressions . . . . . . . . . . . . . . . . . . . . 2-117

Substitute Elements in Symbolic Matrices . . . . . . . . . . . . . . . . . . . . . . . 2-119

Substitute Scalars with Matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-121

Evaluate Symbolic Expressions Using subs . . . . . . . . . . . . . . . . . . . . . . . 2-123

Choose Numeric or Symbolic Arithmetic . . . . . . . . . . . . . . . . . . . . . . . . 2-124


Double-Precision Arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-124
Variable-Precision Arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-124
Symbolic Arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-125
Comparisons of Numeric and Symbolic Arithmetic . . . . . . . . . . . . . . . . 2-126

Increase Precision of Numeric Calculations . . . . . . . . . . . . . . . . . . . . . . 2-128

Recognize and Avoid Round-Off Errors . . . . . . . . . . . . . . . . . . . . . . . . . . 2-130


Use Symbolic Computations When Possible . . . . . . . . . . . . . . . . . . . . . 2-130
Perform Calculations with Increased Precision . . . . . . . . . . . . . . . . . . . 2-130
Compare Symbolic and Numeric Results . . . . . . . . . . . . . . . . . . . . . . . . 2-132
Plot the Function or Expression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-132

Increase Speed by Reducing Precision . . . . . . . . . . . . . . . . . . . . . . . . . . 2-134

Numeric to Symbolic Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-136


Conversion to Rational Symbolic Form . . . . . . . . . . . . . . . . . . . . . . . . . 2-137
Conversion by Using Floating-Point Expansion . . . . . . . . . . . . . . . . . . . 2-137
Conversion to Rational Symbolic Form with Error Term . . . . . . . . . . . . 2-137
Conversion to Decimal Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-138

Basic Algebraic Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-139

Linear Algebraic Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-141


Symbolic Hilbert Matrix . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-141

vii
Symbolic Linear Algebra Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-141
Variable-Precision Arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-142
Symbolic Investigation of Singular Value . . . . . . . . . . . . . . . . . . . . . . . 2-143

Eigenvalues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-145

Jordan Canonical Form . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-149

Singular Value Decomposition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-151

Solve Algebraic Equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-153


Solve an Equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-153
Return the Full Solution to an Equation . . . . . . . . . . . . . . . . . . . . . . . . 2-153
Work with the Full Solution, Parameters, and Conditions Returned by solve
.................................................... 2-154
Visualize and Plot Solutions Returned by solve . . . . . . . . . . . . . . . . . . . 2-155
Simplify Complicated Results and Improve Performance . . . . . . . . . . . . 2-156

Solve a Second-Order Differential Equation Numerically . . . . . . . . . . . 2-157

Select Numeric or Symbolic Solver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-159

Solve System of Algebraic Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-160


Handle the Output of solve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-160
Solve a Linear System of Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-162
Return the Full Solution of a System of Equations . . . . . . . . . . . . . . . . . 2-162
Solve a System of Equations Under Conditions . . . . . . . . . . . . . . . . . . . 2-164
Work with Solutions, Parameters, and Conditions Returned by solve . . . 2-165
Convert Symbolic Results to Numeric Values . . . . . . . . . . . . . . . . . . . . 2-167
Simplify Complicated Results and Improve Performance . . . . . . . . . . . . 2-168

Troubleshoot Equation Solutions from solve Function . . . . . . . . . . . . . 2-169


Return Only Real Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-169
Apply Simplification Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-169
Use Assumptions to Narrow Results . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-170
Simplify Solutions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-171
Tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-171

Solve System of Linear Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-173


Solve System of Linear Equations Using linsolve . . . . . . . . . . . . . . . . . . 2-173
Solve System of Linear Equations Using solve . . . . . . . . . . . . . . . . . . . 2-174

Solve Equations Numerically . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-176

Solve Differential Equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-185


First-Order Linear ODE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-185
Solve Differential Equation with Condition . . . . . . . . . . . . . . . . . . . . . . 2-185
Nonlinear Differential Equation with Initial Condition . . . . . . . . . . . . . . 2-186
Second-Order ODE with Initial Conditions . . . . . . . . . . . . . . . . . . . . . . 2-186
Third-Order ODE with Initial Conditions . . . . . . . . . . . . . . . . . . . . . . . . 2-186
More ODE Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-187

Solve a System of Differential Equations . . . . . . . . . . . . . . . . . . . . . . . . 2-189


Solve System of Differential Equations . . . . . . . . . . . . . . . . . . . . . . . . . 2-189
Solve Differential Equations in Matrix Form . . . . . . . . . . . . . . . . . . . . . 2-191

viii Contents
Solve Differential Algebraic Equations (DAEs) . . . . . . . . . . . . . . . . . . . . 2-194

Solve Semilinear DAE System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-203


Step 1. Reduce Differential Index with reduceDAEToODE . . . . . . . . . . . 2-203
Step 2. ODEs to Function Handles for ode15s and ode23t . . . . . . . . . . . 2-203
Step 3. Initial Conditions for ode15s and ode23t . . . . . . . . . . . . . . . . . . 2-204
Step 4. Solve an ODE System with ode15s or ode23t . . . . . . . . . . . . . . 2-206

Solve DAEs Using Mass Matrix Solvers . . . . . . . . . . . . . . . . . . . . . . . . . . 2-209


Step 1. Convert DAEs to Function Handles . . . . . . . . . . . . . . . . . . . . . . 2-209
Step 2. Find Initial Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-210
Step 3. Solve DAE System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-211

Fourier and Inverse Fourier Transforms . . . . . . . . . . . . . . . . . . . . . . . . . 2-214


Fourier Transform Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-214
Concept: Using Symbolic Workflows . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-214
Calculate Beam Deflection Using Fourier Transform . . . . . . . . . . . . . . . 2-214

Solve Differential Equations Using Laplace Transform . . . . . . . . . . . . . 2-218


Definition: Laplace Transform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-218
Concept: Using Symbolic Workflows . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-218
Workflow: Solve RLC Circuit Using Laplace Transform . . . . . . . . . . . . . 2-218

Solve Difference Equations Using Z-Transform . . . . . . . . . . . . . . . . . . . . 2-224


Definition: Z-transform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-224
Concept: Using Symbolic Workflows . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-224
Workflow: Solve "Rabbit Growth" Problem Using Z-Transform . . . . . . . 2-224
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-228

Create Plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-229


Plot with Symbolic Plotting Functions . . . . . . . . . . . . . . . . . . . . . . . . . . 2-229
Plot Functions Numerically . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-231
Plot Multiple Symbolic Functions in One Graph . . . . . . . . . . . . . . . . . . 2-232
Plot Multiple Symbolic Functions in One Figure . . . . . . . . . . . . . . . . . . 2-233
Combine Symbolic Function Plots and Numeric Data Plots . . . . . . . . . . 2-234
Combine Numeric and Symbolic Plots in 3-D . . . . . . . . . . . . . . . . . . . . 2-236

Plotting in Spherical Coordinate System . . . . . . . . . . . . . . . . . . . . . . . . 2-239

Analytical Solutions of the Inverse Kinematics of a Humanoid Robot 2-241

Analytical Model of Cantilever Truss Structure for Simscape . . . . . . . . 2-252

Estimate Model Parameters of a Symbolically Derived Plant Model in


Simulink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-260

Generate C or Fortran Code from Symbolic Expressions . . . . . . . . . . . . 2-266

Generate MATLAB Functions from Symbolic Expressions . . . . . . . . . . . 2-267


Generating a Function Handle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-267
Control the Order of Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-267
Generate a File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-268
Name Output Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-269

ix
Generate MATLAB Function Blocks from Symbolic Expressions . . . . . 2-270
Generate and Edit a Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-270
Control the Order of Input Ports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-270
Name the Output Ports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-270

Generate Simscape Equations from Symbolic Expressions . . . . . . . . . . 2-272


Convert Algebraic and Differential Equations . . . . . . . . . . . . . . . . . . . . 2-272
Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-273

MuPAD to MATLAB Migration


3
MuPAD Engines and MATLAB Workspace . . . . . . . . . . . . . . . . . . . . . . . . . . 3-2

Convert MuPAD Notebooks to MATLAB Live Scripts . . . . . . . . . . . . . . . . . 3-3


Convert a MuPAD Notebook .mn to a MATLAB Live Script .mlx . . . . . . . . . 3-3
Convert MuPAD Graphics to MATLAB Graphics . . . . . . . . . . . . . . . . . . . . 3-3
Known Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4

Troubleshoot MuPAD to MATLAB Translation Errors . . . . . . . . . . . . . . . . . 3-8

Troubleshoot MuPAD to MATLAB Translation Warnings . . . . . . . . . . . . . 3-15

Differences Between MATLAB and MuPAD Syntax . . . . . . . . . . . . . . . . . . 3-20

Call Built-In MuPAD Functions from MATLAB . . . . . . . . . . . . . . . . . . . . . 3-22


evalin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-22
feval . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-22
evalin vs. feval . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-23
Floating-Point Arguments of evalin and feval . . . . . . . . . . . . . . . . . . . . . 3-23

Functions
4

x Contents
1

Getting Started

• “Symbolic Math Toolbox Product Description” on page 1-2


• “Create Symbolic Numbers, Variables, and Expressions” on page 1-3
• “Create Symbolic Functions” on page 1-7
• “Create Symbolic Matrices” on page 1-9
• “Perform Symbolic Computations” on page 1-11
• “Use Assumptions on Symbolic Variables” on page 1-24
1 Getting Started

Symbolic Math Toolbox Product Description


Perform symbolic math computations

Symbolic Math Toolbox provides functions for solving, plotting, and manipulating symbolic math
equations. You can create, run, and share symbolic math code using the MATLAB Live Editor. The
toolbox provides functions in common mathematical areas such as calculus, linear algebra, algebraic
and ordinary differential equations, equation simplification, and equation manipulation.

Symbolic Math Toolbox lets you analytically perform differentiation, integration, simplification,
transforms, and equation solving. You can perform dimensional computations and conversions using
SI and US unit systems. Your computations can be performed either analytically or using variable-
precision arithmetic, with the results displayed in mathematical typeset.

You can share your symbolic work with other MATLAB users as live scripts or convert them to HTML
or PDF for publication. You can generate MATLAB functions, Simulink® function blocks, and
Simscape™ equations directly from symbolic expressions.

Key Features
• Symbolic integration, differentiation, transforms, and linear algebra
• Algebraic and ordinary differential equation (ODE) solvers
• Simplification and manipulation of symbolic expressions
• Unit systems for specifying, converting, and computing using SI, US, and custom unit systems
• Plotting of analytical functions in 2D and 3D
• Symbolic expression conversion to MATLAB, Simulink, Simscape, C, Fortran, and LaTeX code
• Variable-precision arithmetic

1-2
Create Symbolic Numbers, Variables, and Expressions

Create Symbolic Numbers, Variables, and Expressions


This page shows how to create symbolic numbers, variables, and expressions. To learn how to work
with symbolic math, see “Perform Symbolic Computations” on page 1-11.

Create Symbolic Numbers


You can create symbolic numbers by using sym. Symbolic numbers are exact representations, unlike
floating-point numbers.

Create a symbolic number by using sym and compare it to the same floating-point number.
sym(1/3)
1/3

ans =
1/3
ans =
0.3333

The symbolic number is represented in exact rational form, while the floating-point number is a
decimal approximation. The symbolic result is not indented, while the standard MATLAB result is
indented.

Calculations on symbolic numbers are exact. Demonstrate this exactness by finding sin(pi)
symbolically and numerically. The symbolic result is exact, while the numeric result is an
approximation.
sin(sym(pi))
sin(pi)

ans =
0
ans =
1.2246e-16

To learn more about symbolic representation of numbers, see “Numeric to Symbolic Conversion” on
page 2-136.

Create Symbolic Variables


You can create symbolic variables using either syms or sym. Typical uses of these functions include:

• sym – Create numbered symbolic variables or create symbolic variables in MATLAB functions.
• syms – Create fresh symbolic variables for interactive symbolic workflows, that is, for symbolic
variable creation at the MATLAB command line or in MATLAB live scripts. A fresh symbolic
variable does not have any assumptions.

The syms command is shorthand for the sym syntax, but the two functions handle assumptions
differently. For more details, see “Reuse Names of Symbolic Objects” on page 1-5.

Create the symbolic variables x and y using syms and sym, respectively.
syms x
y = sym('y')

1-3
1 Getting Started

The first command creates a symbolic variable x in the MATLAB workspace with the value x assigned
to the variable x. The second command creates a symbolic variable y with the value y.

With syms, you can create multiple variables in one command. Create the variables a, b, and c.

syms a b c

If you want to create a MATLAB array of numbered symbolic variables, the syms syntax is
inconvenient. Therefore, use sym instead to create an array of many numbered symbolic variables.

Clear the workspace. Create a row vector containing the symbolic variables a1, ..., a20 and
assign it to the MATLAB variable A. Display the variable in the MATLAB workspace.

clear all
A = sym('a', [1 20])
whos

A =
[ a1, a2, a3, a4, a5, a6, a7, a8, a9, a10,...
a11, a12, a13, a14, a15, a16, a17, a18, a19, a20]

Name Size Bytes Class Attributes

A 1x20 8 sym

A is a 1-by-20 array of 20 symbolic variables.

By combining sym and syms, you can create many fresh symbolic variables with corresponding
variables name in the MATLAB workspace.

Clear the workspace. Create the fresh symbolic variables a1, ..., a10 and assign them the
MATLAB variable names a1, ..., a10, respectively. Display the variables in the MATLAB
workspace.

clear all
syms(sym('a', [1 10]))
whos

Name Size Bytes Class Attributes

a1 1x1 8 sym
a10 1x1 8 sym
a2 1x1 8 sym
a3 1x1 8 sym
a4 1x1 8 sym
a5 1x1 8 sym
a6 1x1 8 sym
a7 1x1 8 sym
a8 1x1 8 sym
a9 1x1 8 sym

The MATLAB workspace contains 10 MATLAB variables that are symbolic variables.

The syms command is a convenient shorthand for the sym syntax, and its typical use is to create fresh
symbolic variables for interactive symbolic workflows. Use the sym syntax to create the following:

• Symbolic variables in MATLAB functions

1-4
Create Symbolic Numbers, Variables, and Expressions

• Many numbered symbolic variables


• Symbolic variable whose value differs from its name in the MATLAB workspace
• Symbolic number, such as sym(5)
• Symbolic variable that inherits the assumptions from a previously used symbolic variable having
the same name

Create Symbolic Expressions


Suppose you want to use a symbolic variable to represent the golden ratio

1+ 5
φ=
2

The command
phi = (1 + sqrt(sym(5)))/2;

achieves this goal. Now you can perform various mathematical operations on phi. For example,
f = phi^2 - phi - 1

returns
f =
(5^(1/2)/2 + 1/2)^2 - 5^(1/2)/2 - 3/2

Now suppose you want to study the quadratic function f = ax2 + bx + c. First, create the symbolic
variables a, b, c, and x:
syms a b c x

Then, assign the expression to f:


f = a*x^2 + b*x + c;

Tip To create a symbolic number, use the sym command. Do not use the syms function to create a
symbolic expression that is a constant. For example, to create the expression whose value is 5, enter
f = sym(5). The command f = 5 does not define f as a symbolic expression.

Reuse Names of Symbolic Objects


If you set a variable equal to a symbolic expression, and then apply the syms command to the
variable, MATLAB software removes the previously defined expression from the variable. For
example,
syms a b
f = a + b

returns
f =
a + b

If later you enter

1-5
1 Getting Started

syms f
f

then MATLAB removes the value a + b from the expression f:

f =
f

You can use the syms command to clear variables of definitions that you previously assigned to them
in your MATLAB session. syms clears the assumptions of the variables: complex, real, integer, and
positive. These assumptions are stored separately from the symbolic object. However, recreating a
variable using sym does not clear its assumptions. For more information, see “Delete Symbolic
Objects and Their Assumptions” on page 1-25.

See Also

More About
• “Create Symbolic Functions” on page 1-7
• “Create Symbolic Matrices” on page 1-9
• “Choose syms or sym Function” on page 2-5
• “Perform Symbolic Computations” on page 1-11
• “Use Assumptions on Symbolic Variables” on page 1-24

1-6
Create Symbolic Functions

Create Symbolic Functions


Symbolic functions represent math functions. Use symbolic functions for differentiation, integration,
solving ODEs, and other math operations. Create symbolic functions by using syms.

Create a symbolic function f with variables x and y by using syms. Creating f automatically creates
x and y.

syms f(x,y)

Assign a mathematical expression to f.

f(x,y) = x^2*y

f(x, y) =
x^2*y

Find the value of f at (3,2).

f(3,2)

ans =
18

Symbolic functions accept array inputs. Calculate f for multiple values of x and y.

xVal = 1:5;
yVal = 3:7;
f(xVal,yVal)

ans =
[ 3, 16, 45, 96, 175]

You can differentiate symbolic functions, integrate or simplify them, substitute their arguments with
values, and perform other mathematical operations. For example, find the derivative of f(x,y) with
respect to x. The result dfx is also a symbolic function.

dfx = diff(f,x)

dfx(x,y) =
2*x*y

Calculate df(x,y) at x = y + 1.

dfx(y+1,y)

ans =
2*y*(y + 1)

If you are creating a constant function, such as f(x,y) = 1, you must first create f(x,y). If you do
not create f(x,y), then the assignment f(x,y) = 1 throws an error.

1-7
1 Getting Started

See Also

More About
• “Create Symbolic Numbers, Variables, and Expressions” on page 1-3
• “Create Symbolic Matrices” on page 1-9
• “Perform Symbolic Computations” on page 1-11
• “Use Assumptions on Symbolic Variables” on page 1-24

1-8
Create Symbolic Matrices

Create Symbolic Matrices


In this section...
“Use Existing Symbolic Variables” on page 1-9
“Generate Elements While Creating a Matrix” on page 1-9
“Create Matrix of Symbolic Numbers” on page 1-10

Use Existing Symbolic Variables


A circulant matrix has the property that each row is obtained from the previous one by cyclically
permuting the entries one step forward. For example, create the symbolic circulant matrix whose
elements are a, b, and c, using the commands:

syms a b c
A = [a b c; c a b; b c a]

A =
[ a, b, c]
[ c, a, b]
[ b, c, a]

Since matrix A is circulant, the sum of elements over each row and each column is the same. Find the
sum of all the elements of the first row:

sum(A(1,:))

ans =
a + b + c

To check if the sum of the elements of the first row equals the sum of the elements of the second
column, use the isAlways function:

isAlways(sum(A(1,:)) == sum(A(:,2)))

The sums are equal:

ans =
logical
1

From this example, you can see that using symbolic objects is very similar to using regular MATLAB
numeric objects.

Generate Elements While Creating a Matrix


The sym function also lets you define a symbolic matrix or vector without having to define its
elements in advance. In this case, the sym function generates the elements of a symbolic matrix at
the same time that it creates a matrix. The function presents all generated elements using the same
form: the base (which must be a valid variable name), a row index, and a column index. Use the first
argument of sym to specify the base for the names of generated elements. You can use any valid
variable name as a base. To check whether the name is a valid variable name, use the isvarname
function. By default, sym separates a row index and a column index by underscore. For example,
create the 2-by-4 matrix A with the elements A1_1, ..., A2_4:

1-9
1 Getting Started

A = sym('A', [2 4])

A =
[ A1_1, A1_2, A1_3, A1_4]
[ A2_1, A2_2, A2_3, A2_4]

To control the format of the generated names of matrix elements, use %d in the first argument:

A = sym('A%d%d', [2 4])

A =
[ A11, A12, A13, A14]
[ A21, A22, A23, A24]

Create Matrix of Symbolic Numbers


A particularly effective use of sym is to convert a matrix from numeric to symbolic form. The
command

A = hilb(3)

generates the 3-by-3 Hilbert matrix:

A =
1.0000 0.5000 0.3333
0.5000 0.3333 0.2500
0.3333 0.2500 0.2000

By applying sym to A

A = sym(A)

you can obtain the precise symbolic form of the 3-by-3 Hilbert matrix:

A =
[ 1, 1/2, 1/3]
[ 1/2, 1/3, 1/4]
[ 1/3, 1/4, 1/5]

For more information on numeric to symbolic conversions, see “Numeric to Symbolic Conversion” on
page 2-136.

See Also

More About
• “Create Symbolic Numbers, Variables, and Expressions” on page 1-3
• “Create Symbolic Functions” on page 1-7
• “Perform Symbolic Computations” on page 1-11
• “Use Assumptions on Symbolic Variables” on page 1-24

1-10
Perform Symbolic Computations

Perform Symbolic Computations

In this section...
“Differentiate Symbolic Expressions” on page 1-11
“Integrate Symbolic Expressions” on page 1-12
“Solve Equations” on page 1-13
“Simplify Symbolic Expressions” on page 1-15
“Substitutions in Symbolic Expressions” on page 1-16
“Plot Symbolic Functions” on page 1-18

Differentiate Symbolic Expressions


With the Symbolic Math Toolbox software, you can find

• Derivatives of single-variable expressions


• Partial derivatives
• Second and higher order derivatives
• Mixed derivatives

For in-depth information on taking symbolic derivatives see “Differentiation” on page 2-46.

Expressions with One Variable

To differentiate a symbolic expression, use the diff command. The following example illustrates how
to take a first derivative of a symbolic expression:

syms x
f = sin(x)^2;
diff(f)

ans =
2*cos(x)*sin(x)

Partial Derivatives

For multivariable expressions, you can specify the differentiation variable. If you do not specify any
variable, MATLAB chooses a default variable by its proximity to the letter x:

syms x y
f = sin(x)^2 + cos(y)^2;
diff(f)

ans =
2*cos(x)*sin(x)

For the complete set of rules MATLAB applies for choosing a default variable, see “Find a Default
Symbolic Variable” on page 2-3.

To differentiate the symbolic expression f with respect to a variable y, enter:

1-11
1 Getting Started

syms x y
f = sin(x)^2 + cos(y)^2;
diff(f, y)

ans =
-2*cos(y)*sin(y)

Second Partial and Mixed Derivatives

To take a second derivative of the symbolic expression f with respect to a variable y, enter:

syms x y
f = sin(x)^2 + cos(y)^2;
diff(f, y, 2)

ans =
2*sin(y)^2 - 2*cos(y)^2

You get the same result by taking derivative twice: diff(diff(f, y)). To take mixed derivatives,
use two differentiation commands. For example:

syms x y
f = sin(x)^2 + cos(y)^2;
diff(diff(f, y), x)

ans =
0

Integrate Symbolic Expressions


You can perform symbolic integration including:

• Indefinite and definite integration


• Integration of multivariable expressions

For in-depth information on the int command including integration with real and complex
parameters, see “Integration” on page 2-59.

Indefinite Integrals of One-Variable Expressions

Suppose you want to integrate a symbolic expression. The first step is to create the symbolic
expression:

syms x
f = sin(x)^2;

To find the indefinite integral, enter

int(f)

ans =
x/2 - sin(2*x)/4

Indefinite Integrals of Multivariable Expressions

If the expression depends on multiple symbolic variables, you can designate a variable of integration.
If you do not specify any variable, MATLAB chooses a default variable by the proximity to the letter x:

1-12
Perform Symbolic Computations

syms x y n
f = x^n + y^n;
int(f)

ans =
x*y^n + (x*x^n)/(n + 1)

For the complete set of rules MATLAB applies for choosing a default variable, see “Find a Default
Symbolic Variable” on page 2-3.

You also can integrate the expression f = x^n + y^n with respect to y

syms x y n
f = x^n + y^n;
int(f, y)

ans =
x^n*y + (y*y^n)/(n + 1)

If the integration variable is n, enter

syms x y n
f = x^n + y^n;
int(f, n)

ans =
x^n/log(x) + y^n/log(y)

Definite Integrals

To find a definite integral, pass the limits of integration as the final two arguments of the int
function:

syms x y n
f = x^n + y^n;
int(f, 1, 10)

ans =
piecewise(n == -1, log(10) + 9/y, n ~= -1,...
(10*10^n - 1)/(n + 1) + 9*y^n)

If MATLAB Cannot Find a Closed Form of an Integral

If the int function cannot compute an integral, it returns an unresolved integral:

syms x
int(sin(sinh(x)))

ans =
int(sin(sinh(x)), x)

Solve Equations
You can solve different types of symbolic equations including:

• Algebraic equations with one symbolic variable


• Algebraic equations with several symbolic variables

1-13
1 Getting Started

• Systems of algebraic equations

For in-depth information on solving symbolic equations including differential equations, see “Equation
Solving”.

Solve Algebraic Equations with One Symbolic Variable

Use the double equal sign (==) to define an equation. Then you can solve the equation by calling
the solve function. For example, solve this equation:

syms x
solve(x^3 - 6*x^2 == 6 - 11*x)

ans =
1
2
3

If you do not specify the right side of the equation, solve assumes that it is zero:

syms x
solve(x^3 - 6*x^2 + 11*x - 6)

ans =
1
2
3

Solve Algebraic Equations with Several Symbolic Variables

If an equation contains several symbolic variables, you can specify a variable for which this equation
should be solved. For example, solve this multivariable equation with respect to y:

syms x y
solve(6*x^2 - 6*x^2*y + x*y^2 - x*y + y^3 - y^2 == 0, y)

ans =
1
2*x
-3*x

If you do not specify any variable, you get the solution of an equation for the alphabetically closest to
x variable. For the complete set of rules MATLAB applies for choosing a default variable see “Find a
Default Symbolic Variable” on page 2-3.

Solve Systems of Algebraic Equations

You also can solve systems of equations. For example:

syms x y z
[x, y, z] = solve(z == 4*x, x == y, z == x^2 + y^2)

x =
0
2

y =
0

1-14
Perform Symbolic Computations

z =
0
8

Simplify Symbolic Expressions


Symbolic Math Toolbox provides a set of simplification functions allowing you to manipulate the
output of a symbolic expression. For example, the following polynomial of the golden ratio phi

phi = (1 + sqrt(sym(5)))/2;
f = phi^2 - phi - 1

returns

f =
(5^(1/2)/2 + 1/2)^2 - 5^(1/2)/2 - 3/2

You can simplify this answer by entering

simplify(f)

and get a very short answer:

ans =
0

Symbolic simplification is not always so straightforward. There is no universal simplification function,


because the meaning of a simplest representation of a symbolic expression cannot be defined clearly.
Different problems require different forms of the same mathematical expression. Knowing what form
is more effective for solving your particular problem, you can choose the appropriate simplification
function.

For example, to show the order of a polynomial or symbolically differentiate or integrate a


polynomial, use the standard polynomial form with all the parentheses multiplied out and all the
similar terms summed up. To rewrite a polynomial in the standard form, use the expand function:

syms x
f = (x ^2- 1)*(x^4 + x^3 + x^2 + x + 1)*(x^4 - x^3 + x^2 - x + 1);
expand(f)

ans =
x^10 - 1

The factor simplification function shows the polynomial roots. If a polynomial cannot be factored
over the rational numbers, the output of the factor function is the standard polynomial form. For
example, to factor the third-order polynomial, enter:

syms x
g = x^3 + 6*x^2 + 11*x + 6;
factor(g)

ans =
[ x + 3, x + 2, x + 1]

The nested (Horner) representation of a polynomial is the most efficient for numerical evaluations:

1-15
1 Getting Started

syms x
h = x^5 + x^4 + x^3 + x^2 + x;
horner(h)

ans =
x*(x*(x*(x*(x + 1) + 1) + 1) + 1)

For a list of Symbolic Math Toolbox simplification functions, see “Choose Function to Rearrange
Expression” on page 2-104.

Substitutions in Symbolic Expressions


Substitute Symbolic Variables with Numbers

You can substitute a symbolic variable with a numeric value by using the subs function. For example,
evaluate the symbolic expression f at the point x = 1/3:

syms x
f = 2*x^2 - 3*x + 1;
subs(f, 1/3)

ans =
2/9

The subs function does not change the original expression f:

f =
2*x^2 - 3*x + 1

Substitute in Multivariate Expressions

When your expression contains more than one variable, you can specify the variable for which you
want to make the substitution. For example, to substitute the value x = 3 in the symbolic expression

syms x y
f = x^2*y + 5*x*sqrt(y);

enter the command

subs(f, x, 3)

ans =
9*y + 15*y^(1/2)

Substitute One Symbolic Variable for Another

You also can substitute one symbolic variable for another symbolic variable. For example to replace
the variable y with the variable x, enter

subs(f, y, x)

ans =
x^3 + 5*x^(3/2)

1-16
Perform Symbolic Computations

Substitute a Matrix into a Polynomial

You can also substitute a matrix into a symbolic polynomial with numeric coefficients. There are two
ways to substitute a matrix into a polynomial: element by element and according to matrix
multiplication rules.
Element-by-Element Substitution

To substitute a matrix at each element, use the subs command:

syms x
f = x^3 - 15*x^2 - 24*x + 350;
A = [1 2 3; 4 5 6];
subs(f,A)

ans =
[ 312, 250, 170]
[ 78, -20, -118]

You can do element-by-element substitution for rectangular or square matrices.


Substitution in a Matrix Sense

If you want to substitute a matrix into a polynomial using standard matrix multiplication rules, a
matrix must be square. For example, you can substitute the magic square A into a polynomial f:

1 Create the polynomial:

syms x
f = x^3 - 15*x^2 - 24*x + 350;
2 Create the magic square matrix:

A = magic(3)

A =
8 1 6
3 5 7
4 9 2
3 Get a row vector containing the numeric coefficients of the polynomial f:

b = sym2poly(f)

b =
1 -15 -24 350
4 Substitute the magic square matrix A into the polynomial f. Matrix A replaces all occurrences of
x in the polynomial. The constant times the identity matrix eye(3) replaces the constant term of
f:

A^3 - 15*A^2 - 24*A + 350*eye(3)

ans =
-10 0 0
0 -10 0
0 0 -10

The polyvalm command provides an easy way to obtain the same result:

polyvalm(b,A)

1-17
1 Getting Started

ans =
-10 0 0
0 -10 0
0 0 -10

Substitute the Elements of a Symbolic Matrix

To substitute a set of elements in a symbolic matrix, also use the subs command. Suppose you want
to replace some of the elements of a symbolic circulant matrix A

syms a b c
A = [a b c; c a b; b c a]

A =
[ a, b, c]
[ c, a, b]
[ b, c, a]

To replace the (2, 1) element of A with beta and the variable b throughout the matrix with variable
alpha, enter

alpha = sym('alpha');
beta = sym('beta');
A(2,1) = beta;
A = subs(A,b,alpha)

The result is the matrix:

A =
[ a, alpha, c]
[ beta, a, alpha]
[ alpha, c, a]

For more information, see “Substitute Elements in Symbolic Matrices” on page 2-119.

Plot Symbolic Functions


Symbolic Math Toolbox provides the plotting functions:

• fplot to create 2-D plots of symbolic expressions, equations, or functions in Cartesian


coordinates.
• fplot3 to create 3-D parametric plots.
• ezpolar to create plots in polar coordinates.
• fsurf to create surface plots.
• fcontour to create contour plots.
• fmesh to create mesh plots.

Explicit Function Plot

Create a 2-D line plot by using fplot. Plot the expression x3 − 6x2 + 11x − 6.

syms x
f = x^3 - 6*x^2 + 11*x - 6;
fplot(f)

1-18
Perform Symbolic Computations

Add labels for the x- and y-axes. Generate the title by using texlabel(f). Show the grid by using
grid on. For details, see “Add Title and Axis Labels to Chart” (MATLAB).

xlabel('x')
ylabel('y')
title(texlabel(f))
grid on

1-19
Another random document with
no related content on Scribd:
sang. Pour quelles raisons accepterait-on plusieurs maîtres ? Caillou
se refuse à ce servage. Voilà pourquoi, cédant aussi à ses instincts
de gourmandise et de rapine, il dévore chaque jour, dans leur plus
verte jeunesse, les pommes et les poires de l’oncle, espoir d’une
récolte future. Comme il en jette dédaigneusement les débris à
travers les allées, il n’est pas difficile de constater le crime :
— Ne mens pas, Caillou ! Tu montes sur les arbres et tu cueilles
les fruits ?
— Oui, dit Caillou. Tout en haut des arbres, je monte !
Il avoue fièrement, considérant que c’est là un exploit digne de sa
propre estime et d’une inscription dans les ouvrages dont il se repaît.
On le gronde, on le punit, on lui fait jurer :
— Tu ne cueilleras plus de pommes, Caillou ? Promets !
— Je n’en cueillerai plus, dit Caillou, maussade.
— Ni de poires, ni de pêches ?
Caillou promet encore, et il a gardé ça de son ancienne
honnêteté : il sait tenir parole. Seulement, le lendemain, pêchers,
poiriers, pommiers présentent un spectacle hideux et sans
précédent dans l’histoire des désastres de l’arboriculture. Caillou n’a
plus « cueilli », cela ne fait aucun doute. Mais on ne lui avait pas
défendu de grimper aux arbres. Il a donc grimpé, comme d’habitude,
et mangé le plus de fruits qu’il a pu, en laissant les trognons
attachés à leur tige. Les arbres sont déshonorés, et Caillou
s’applaudit d’avoir à la fois respecté sa parole et acquis la certitude
qu’on parlera de lui à travers les siècles : car il est maintenant avide
de gloire, même de la plus détestable.
A l’aube suivante, l’oncle part pour la chasse. Il aime cette
distraction, il éprouve aussi le besoin de s’éloigner le plus souvent
possible de cette maison qui est sienne, devenue pleine d’une
agitation choquante et de drames intimes. Il siffle son chien, et
Caillou demande d’un air innocent :
— Tu t’en vas, mon oncle ?
Mais le chien, dès qu’il a vu Caillou, fait un bond d’épouvante, et
s’enfuit, s’enfuit à l’autre bout du pays, pour échapper à son
persécuteur. Car Caillou est son bourreau ; Caillou, pour satisfaire
ses instincts de primitif, développés par ses lectures, en a fait parfois
un lion, parfois un ours, parfois un loup. Il l’a pris au piège, il l’a tué
dans des combats tumultueux, il l’a ramené dans son antre de
Robinson victorieux, lié aux quatre pattes, il l’a traîné sur le gravier
rude comme un cadavre pantelant ; et le bon chien s’est changé en
une pauvre bête apeurée qui n’a plus confiance dans la bonté des
hommes, qui sait qu’ils peuvent faire du mal quand on ne leur fait
rien. Caillou ne traiterait pas de la même façon Jupiter, le chat, parce
que Jupiter a des griffes. Mais il l’utilise cependant à sa manière, il le
transforme en un tigre redoutable en l’élevant trente fois par jour à la
hauteur de la cage du serin. Et le serin, le cœur battant, les plumes
ébouriffées à la vue de l’ennemi héréditaire, se jette contre les
barreaux de la cage, s’y brise le bec, s’y écorche les pattes, en perd
le boire et le manger.
C’est ainsi que Caillou fait « des expériences » et désorganise
l’intérieur pacifique, ordonné, solennel, de l’oncle Jules. Et plus il est
admonesté, morigéné, châtié, plus il se considère comme une
victime des puissances, plus il se pénètre de l’idée, puisée dans une
littérature qui l’abuse, qu’il n’est pas comme les autres, qu’il a le droit
de se venger, qu’il ne se venge pas assez, et que ses malheurs sont
dignes d’une éternelle mémoire. Il est devenu un romantique, et
comme tous les romantiques, on ne peut même plus le prendre par
les sentiments : les duretés qu’il subit légitiment à ses yeux tous les
actes de révolte.
— Songe à la passion de Jésus-Christ ! lui dit un jour
imprudemment sa mère.
— Ça n’a duré que trois jours, répond Caillou. Et moi, voilà trois
ans qu’on m’embête !
Voilà trois ans qu’il est le plus heureux petit garçon du monde,
mais il se croirait déshonoré de l’admettre. Il n’y a plus qu’à
l’emmener, le maître de la maison n’en peut plus. Enfin voilà ses
hôtes partis, l’oncle respire. Mais la précieuse cuisinière vient lui
rendre son tablier.
— Je ne veux plus rester dans cette maison, dit-elle, on n’y a pas
d’égards pour moi : monsieur Caillou, avant de partir, a fourré des
colimaçons plein mon lit !
Et elle ajoute :
— Je dois dire aussi à monsieur que son serin est mort.
— Mort ! fait l’oncle. Et de quoi ?
— Je n’en sais rien. De peur peut-être !
C’est ainsi que le pauvre oncle reste seul dans sa maison
dévastée, sans cuisinière, sans chien, sans canari. La jeunesse a
passé là comme une passion ; elle n’a rien laissé derrière elle que
des ruines. Et l’oncle se sent décidément très vieux, très fini, tout à
fait incapable de s’accoutumer à ceux qui n’ont pas son âge ; il
songe amèrement qu’il ne pardonnera jamais à Caillou. Il est bien
vieux en effet, puisqu’il a oublié ce que c’est que l’âge ingrat des
petits garçons : celui auquel ils commencent à s’opposer, par la
révolte, et pour prendre conscience de leur personnalité, à un
monde dont ils se font une idée aussi intolérable qu’elle est fausse.

La mère de Caillou est désespérée. Malgré toute la sagesse et


toute l’expérience qu’elles ont pu acquérir, toutes les mères
nourrissent la même illusion : elles se figurent que leurs petits
resteront toujours petits. Et Caillou maintenant lui apparaît comme
une espèce de monstre ! Elle envisage toutes sortes de projets,
même celui de le mettre au collège, pour qu’il y apprenne la
discipline, le respect, et qu’il parvienne à se persuader qu’il faut
« faire comme tout le monde ». Car enfin, il faut que Caillou
commence « son éducation ». J’assiste à ses angoisses, mais je ne
puis les partager. Caillou traverse une crise, mais je sais bien qu’au
fond il est toujours le même Caillou. Et je ne voudrais point qu’on me
le changeât, sous prétexte de le corriger.
— Croyez bien, lui dis-je, que je ne nourris nulle haine contre les
maîtres de mon enfance. Je sais toutefois que je suis sorti de leurs
mains façonné de si étrange manière que j’ai mis des années avant
de me retrouver moi-même : et ce furent des années perdues. Il y
avait un jeune canard, une fois…
— C’est un apologue.
— Peut-être. Mais je vous assure qu’il s’agit d’un canard
véritable, auquel il arriva malheur pendant la grande inondation.
» D’abord ce canard ne fut qu’un œuf, ce qui n’a rien que de très
naturel. Monsieur Giscard, tonnelier rue des Ursins, derrière Notre-
Dame, l’avait choisi un jour dans une terrine, à la campagne, chez
un de ses amis, nourrisseur.
» — Qu’est-ce que c’est donc que celui-là ? avait-il demandé.
» Et en effet, il était plus gros que les autres, un peu plus long, et
quand on le mettait entre son œil et la lumière, il prenait une teinte
vert pâle, tandis que les autres paraissaient roses.
» — Celui-là ? répondit le nourrisseur : c’est un œuf de cane.
» Alors monsieur Giscard avait demandé la permission de
l’emporter, disant que puisqu’il avait des poules, il pourrait le faire
couver.
» Voilà par quelles suites de circonstances ce canard naquit rue
des Ursins. Sa coquille crevée, il fut d’abord une masse oblongue,
qui sous les ailes d’une vieille poule se dorlotait dans du poil jaune,
précurseur des plumes. Il était en somme assez semblable aux
petits poulets, ses frères de hasard, sauf pour les pattes et le bec,
qu’il avait plus larges ; et son corps avait encore la forme de l’œuf
dont il était sorti. Puis son pennage poussa, il grandit et devint un
canard véritable, fort heureux de sa condition et de ses entours.
» Car la nourriture s’offrait devant lui, savoureuse, abondante et
variée. C’était du pain en miettes, des écuellées de rogatons gras,
aussi les entrailles d’autres oiseaux, telles que madame Giscard les
jetait sur le sol ; et le canard, dans son ignorance ingénue, les
dévorait. Au delà de la cour qui servait d’atelier, une fois passée la
vieille porte cochère garnie d’énormes clous à têtes de diamant,
s’étendait une région très vaste, qui fournissait encore des choses
bonnes à manger. C’était la vue des Ursins même, irrégulière,
tortueuse, resserrée à l’un des bouts, semblable en vérité à un
boyau, avec une vieille chapelle toute ruineuse dont les pierres
disjointes offraient en été aux appétits des vers, des mouches, des
insectes vivants. A l’une de ses extrémités s’ouvrait la rue de la
Colombe, qui mène à un édifice énorme, très haut sur le ciel, avec
deux tours et un clocher riche en corneilles ; à l’autre, c’était un
espace plat et large, bordé par un mur de pierre. Les hommes
appellent l’édifice « Notre-Dame », et l’espace plat, fermé d’une
muraille, ils le nomment « le quai ». A certaines heures, ces rues
sont presque vides ; on peut s’y aventurer, on y trouve des oranges
mâchées, des rognures de viande, mille débris d’un goût délicieux.
Mais la petite troupe des poulets et du canard n’allait jamais vers le
quai.
» — Qu’est-ce qu’il y a, de ce côté ? demanda un jour le canard,
pour s’instruire.
» — L’eau ! répondit la vieille poule,
» Sa voix était si pénétrée d’horreur que le canard n’insista pas. Il
connut donc que l’eau, c’était le mal. Cependant il eut la curiosité de
savoir ce que faisaient les ouvriers de monsieur Giscard. Tout le jour
leurs marteaux de bois dur et leurs doloires luisantes retentissaient
et grinçaient sur les muids, les bordelaises, les feuillettes. Le canard
apprit que ces vaisseaux ronds et creux devaient plus tard recevoir
des liquides ; il les considéra donc comme des remparts destinés à
contenir une matière analogue à l’eau, perfide et dangereuse. Il
buvait pourtant au ruisseau de la rue. Mais, imitant ses compagnons,
il évitait de se mouiller les pattes.
» Un jour, les hommes dirent entre eux : « Elle monte ! » Le
canard n’entendit pas leurs paroles, mais il remarqua leur agitation.
Ils aveuglèrent les soupiraux avec du ciment et construisirent un mur
devant la porte. Le canard crut d’abord que c’était pour l’empêcher
de sortir, car les animaux, comme les humains, penchent
communément à croire que les choses qu’on fait, on les fait pour
eux, ou contre eux. Et le canard s’égaya de cette sottise. Il n’avait
jamais volé. Il ne savait même pas que ses ailes, perpétuellement
rognées, pouvaient servir à voler, mais il se sentait sûr de franchir,
quand il le voudrait, cette ridicule barrière.
» Il y avait dans la cour une vieille mangeoire destinée à des
chevaux depuis longtemps disparus. C’était là que perchaient les
jeunes poules, tandis que celles qui couvaient demeuraient
d’habitude, la nuit comme le jour, dans une cuve pleine de paille ; et
c’est à celles-là que se joignait le canard, qui n’aimait pas à grimper.
Vers le milieu de la nuit, il entendit des bruits singuliers. On criait,
plus loin que la maison, dans la rue :
» — L’eau monte, elle monte toujours ! Déménagez, vous ne
pouvez rester ici !
» Le canard ne savait pas que ces cris venaient de barques
montées par des soldats. Ce qui le surprit davantage, c’est que la
cuve dans laquelle il sommeillait semblait se mouvoir assez
doucement, au lieu de demeurer à sa place ordinaire ; et à la lueur
du croissant de la lune, il s’aperçut que la mangeoire, sur laquelle
étaient perchées les jeunes poules, paraissait maintenant moins
élevée au-dessus de sa tête. Les animaux ont des rêves aussi bien
que les hommes : cela sans doute était un rêve ! Cependant la vieille
Houdan qui l’avait couvé, au moment où la cuve se rapprocha de la
mangeoire, battit désespérément de ses pauvres ailes, et sauta. Le
canard fit comme elle, par esprit d’imitation. Puis il se rendormit
tranquillement, car les oiseaux, dès que le soleil est couché, ne
peuvent tenir leurs yeux ouverts.
» Mais ils s’éveillèrent dès l’aube, et le jour naissant lui montra un
spectacle étrange. A la place du sol qu’il avait piétiné la veille, plat et
très dur, d’une belle couleur grise, et fertile en nourriture, il n’y avait
plus sous ses pieds qu’une étendue jaunâtre d’un élément inconnu.
Au premier abord on eût pensé que c’était solide, mais vers les coins
et les parois de la cour, ça se gonflait, ça clapotait ; c’était sournois,
inquiétant, insidieux. La vieille poule dit, avec un frisson d’effroi :
» — C’est l’eau !
» Et le canard éprouva un sentiment d’angoisse bien plus
déchirant que celui qui pénétrait ses voisins parce que c’était une loi
inculquée dès son enfance, et non pas son instinct, qui le retenait à
sa place. L’eau lui faisait envie, il la désirait d’une manière à la fois
vague et puissante ; pourtant elle lui faisait peur par principe. Il
demanda timidement :
» — Est-ce que c’est vrai, absolument vrai, qu’on ne peut pas
descendre là-dessus et se tenir debout, tout en vie ?
» Il était naturel qu’il posât la question sous cette forme puisqu’il
ne savait pas qu’il y a un acte qui s’appelle nager. Mais on ne lui
répondit que par un regard atroce. Non, ça ne se pouvait pas !
Quelques poules essayèrent, prenant leur élan, de sauter par-
dessus la clôture de la cour. L’une d’elles y réussit, mais on l’entendit
retomber, de l’autre côté, dans l’élément mortel qui remplissait la
rue. Les autres se noyèrent dans la cour même, après s’être brisé le
bec contre les pierres qu’elles avaient tenté de franchir.
» — Qu’est-ce qu’il faut faire ? interrogea le canard.
» — Attendre, répondit la vieille poule.
» Ayant toujours vécu parmi les hommes, elle ne connaissait rien
que ce qui venait d’eux ; le salut ou la mort : ils dispensaient tout.
Mais les hommes ne vinrent pas. Les oiseaux, qui digèrent très vite,
souffrent et meurent très rapidement de la faim. Le canard et la
poule, trop faibles pour rester perchés, se blottirent au fond de la
mangeoire.
…» Après l’inondation, monsieur Giscard revint.
» — Les poules ont dû mourir, dit-il, mais c’est le canard qui doit
s’en donner !
» Mais le canard avait subi le sort des camarades. Couché près
de la poule, sur le dos, avec cette taie sur les yeux ouverts qu’ont les
oiseaux morts, il dressait vers le ciel ses pattes palmées faites pour
ramer l’eau.
» Monsieur Giscard fut si émerveillé par ce spectacle qu’il oublia
de regretter la perte.
» — Tout de même, dit-il, tout de même… celui-là, il avait de
l’éducation ! »

La maman de Caillou se mit à rire.


— Vous croyez que je plaisante, lui dis-je, mais c’est une histoire
qui est arrivée, et je plains beaucoup ce canard : si vous voulez bien
y réfléchir une petite minute, il fut assassiné par persuasion.
Toutefois vous pouvez aussi accepter ce récit comme une fable, et
supposer que ce canard, c’est vous, moi, ou notre voisin et Caillou
lui-même, si on lui donne trop tôt, et comme on la donne, hélas, ce
qu’on est convenu d’appeler « de l’éducation ». Car ça consiste
généralement, chez nous, à faire perdre aux petits Français leur
personnalité et leurs instincts. Je vous engage à vous méfier :
Caillou n’y gagnerait absolument rien.

Juillet 1909 — Février 1911.

FIN
TABLE

PREMIÈRE RENCONTRE 1
CAILLOU ET LES FEMMES 19
LES CHIENS ET LA GLOIRE 51
A LA CAMPAGNE 63
SA PUDEUR 81
LES AMIS DE CAILLOU 95
LE CIRQUE 133
LA GOURMANDISE 143
L’ŒUF DE CHEVAL 153
CAILLOU ET SON PÈRE 165
DU SENTIMENT DE LA PROPRIÉTÉ 175
LE MYSTÈRE 187
L’OPÉRATION 217
L’AUBE DE L’AGE INGRAT 229

E. GREVIN — IMPRIMERIE DE LAGNY — 4830-7-14.


*** END OF THE PROJECT GUTENBERG EBOOK CAILLOU ET
TILI ***

Updated editions will replace the previous one—the old editions will
be renamed.

Creating the works from print editions not protected by U.S.


copyright law means that no one owns a United States copyright in
these works, so the Foundation (and you!) can copy and distribute it
in the United States without permission and without paying copyright
royalties. Special rules, set forth in the General Terms of Use part of
this license, apply to copying and distributing Project Gutenberg™
electronic works to protect the PROJECT GUTENBERG™ concept
and trademark. Project Gutenberg is a registered trademark, and
may not be used if you charge for an eBook, except by following the
terms of the trademark license, including paying royalties for use of
the Project Gutenberg trademark. If you do not charge anything for
copies of this eBook, complying with the trademark license is very
easy. You may use this eBook for nearly any purpose such as
creation of derivative works, reports, performances and research.
Project Gutenberg eBooks may be modified and printed and given
away—you may do practically ANYTHING in the United States with
eBooks not protected by U.S. copyright law. Redistribution is subject
to the trademark license, especially commercial redistribution.

START: FULL LICENSE


THE FULL PROJECT GUTENBERG LICENSE
PLEASE READ THIS BEFORE YOU DISTRIBUTE OR USE THIS WORK

To protect the Project Gutenberg™ mission of promoting the free


distribution of electronic works, by using or distributing this work (or
any other work associated in any way with the phrase “Project
Gutenberg”), you agree to comply with all the terms of the Full
Project Gutenberg™ License available with this file or online at
www.gutenberg.org/license.

Section 1. General Terms of Use and


Redistributing Project Gutenberg™
electronic works
1.A. By reading or using any part of this Project Gutenberg™
electronic work, you indicate that you have read, understand, agree
to and accept all the terms of this license and intellectual property
(trademark/copyright) agreement. If you do not agree to abide by all
the terms of this agreement, you must cease using and return or
destroy all copies of Project Gutenberg™ electronic works in your
possession. If you paid a fee for obtaining a copy of or access to a
Project Gutenberg™ electronic work and you do not agree to be
bound by the terms of this agreement, you may obtain a refund from
the person or entity to whom you paid the fee as set forth in
paragraph 1.E.8.

1.B. “Project Gutenberg” is a registered trademark. It may only be


used on or associated in any way with an electronic work by people
who agree to be bound by the terms of this agreement. There are a
few things that you can do with most Project Gutenberg™ electronic
works even without complying with the full terms of this agreement.
See paragraph 1.C below. There are a lot of things you can do with
Project Gutenberg™ electronic works if you follow the terms of this
agreement and help preserve free future access to Project
Gutenberg™ electronic works. See paragraph 1.E below.
1.C. The Project Gutenberg Literary Archive Foundation (“the
Foundation” or PGLAF), owns a compilation copyright in the
collection of Project Gutenberg™ electronic works. Nearly all the
individual works in the collection are in the public domain in the
United States. If an individual work is unprotected by copyright law in
the United States and you are located in the United States, we do
not claim a right to prevent you from copying, distributing,
performing, displaying or creating derivative works based on the
work as long as all references to Project Gutenberg are removed. Of
course, we hope that you will support the Project Gutenberg™
mission of promoting free access to electronic works by freely
sharing Project Gutenberg™ works in compliance with the terms of
this agreement for keeping the Project Gutenberg™ name
associated with the work. You can easily comply with the terms of
this agreement by keeping this work in the same format with its
attached full Project Gutenberg™ License when you share it without
charge with others.

1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside the
United States, check the laws of your country in addition to the terms
of this agreement before downloading, copying, displaying,
performing, distributing or creating derivative works based on this
work or any other Project Gutenberg™ work. The Foundation makes
no representations concerning the copyright status of any work in
any country other than the United States.

1.E. Unless you have removed all references to Project Gutenberg:

1.E.1. The following sentence, with active links to, or other


immediate access to, the full Project Gutenberg™ License must
appear prominently whenever any copy of a Project Gutenberg™
work (any work on which the phrase “Project Gutenberg” appears, or
with which the phrase “Project Gutenberg” is associated) is
accessed, displayed, performed, viewed, copied or distributed:
This eBook is for the use of anyone anywhere in the United
States and most other parts of the world at no cost and with
almost no restrictions whatsoever. You may copy it, give it away
or re-use it under the terms of the Project Gutenberg License
included with this eBook or online at www.gutenberg.org. If you
are not located in the United States, you will have to check the
laws of the country where you are located before using this
eBook.

1.E.2. If an individual Project Gutenberg™ electronic work is derived


from texts not protected by U.S. copyright law (does not contain a
notice indicating that it is posted with permission of the copyright
holder), the work can be copied and distributed to anyone in the
United States without paying any fees or charges. If you are
redistributing or providing access to a work with the phrase “Project
Gutenberg” associated with or appearing on the work, you must
comply either with the requirements of paragraphs 1.E.1 through
1.E.7 or obtain permission for the use of the work and the Project
Gutenberg™ trademark as set forth in paragraphs 1.E.8 or 1.E.9.

1.E.3. If an individual Project Gutenberg™ electronic work is posted


with the permission of the copyright holder, your use and distribution
must comply with both paragraphs 1.E.1 through 1.E.7 and any
additional terms imposed by the copyright holder. Additional terms
will be linked to the Project Gutenberg™ License for all works posted
with the permission of the copyright holder found at the beginning of
this work.

1.E.4. Do not unlink or detach or remove the full Project


Gutenberg™ License terms from this work, or any files containing a
part of this work or any other work associated with Project
Gutenberg™.

1.E.5. Do not copy, display, perform, distribute or redistribute this


electronic work, or any part of this electronic work, without
prominently displaying the sentence set forth in paragraph 1.E.1 with
active links or immediate access to the full terms of the Project
Gutenberg™ License.
1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if you
provide access to or distribute copies of a Project Gutenberg™ work
in a format other than “Plain Vanilla ASCII” or other format used in
the official version posted on the official Project Gutenberg™ website
(www.gutenberg.org), you must, at no additional cost, fee or expense
to the user, provide a copy, a means of exporting a copy, or a means
of obtaining a copy upon request, of the work in its original “Plain
Vanilla ASCII” or other form. Any alternate format must include the
full Project Gutenberg™ License as specified in paragraph 1.E.1.

1.E.7. Do not charge a fee for access to, viewing, displaying,


performing, copying or distributing any Project Gutenberg™ works
unless you comply with paragraph 1.E.8 or 1.E.9.

1.E.8. You may charge a reasonable fee for copies of or providing


access to or distributing Project Gutenberg™ electronic works
provided that:

• You pay a royalty fee of 20% of the gross profits you derive from
the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”

• You provide a full refund of any money paid by a user who


notifies you in writing (or by e-mail) within 30 days of receipt that
s/he does not agree to the terms of the full Project Gutenberg™
License. You must require such a user to return or destroy all
copies of the works possessed in a physical medium and
discontinue all use of and all access to other copies of Project
Gutenberg™ works.

• You provide, in accordance with paragraph 1.F.3, a full refund of


any money paid for a work or a replacement copy, if a defect in
the electronic work is discovered and reported to you within 90
days of receipt of the work.

• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.

1.E.9. If you wish to charge a fee or distribute a Project Gutenberg™


electronic work or group of works on different terms than are set
forth in this agreement, you must obtain permission in writing from
the Project Gutenberg Literary Archive Foundation, the manager of
the Project Gutenberg™ trademark. Contact the Foundation as set
forth in Section 3 below.

1.F.

1.F.1. Project Gutenberg volunteers and employees expend


considerable effort to identify, do copyright research on, transcribe
and proofread works not protected by U.S. copyright law in creating
the Project Gutenberg™ collection. Despite these efforts, Project
Gutenberg™ electronic works, and the medium on which they may
be stored, may contain “Defects,” such as, but not limited to,
incomplete, inaccurate or corrupt data, transcription errors, a
copyright or other intellectual property infringement, a defective or
damaged disk or other medium, a computer virus, or computer
codes that damage or cannot be read by your equipment.

1.F.2. LIMITED WARRANTY, DISCLAIMER OF DAMAGES - Except


for the “Right of Replacement or Refund” described in paragraph
1.F.3, the Project Gutenberg Literary Archive Foundation, the owner
of the Project Gutenberg™ trademark, and any other party
distributing a Project Gutenberg™ electronic work under this
agreement, disclaim all liability to you for damages, costs and
expenses, including legal fees. YOU AGREE THAT YOU HAVE NO
REMEDIES FOR NEGLIGENCE, STRICT LIABILITY, BREACH OF
WARRANTY OR BREACH OF CONTRACT EXCEPT THOSE
PROVIDED IN PARAGRAPH 1.F.3. YOU AGREE THAT THE
FOUNDATION, THE TRADEMARK OWNER, AND ANY
DISTRIBUTOR UNDER THIS AGREEMENT WILL NOT BE LIABLE
TO YOU FOR ACTUAL, DIRECT, INDIRECT, CONSEQUENTIAL,
PUNITIVE OR INCIDENTAL DAMAGES EVEN IF YOU GIVE
NOTICE OF THE POSSIBILITY OF SUCH DAMAGE.

1.F.3. LIMITED RIGHT OF REPLACEMENT OR REFUND - If you


discover a defect in this electronic work within 90 days of receiving it,
you can receive a refund of the money (if any) you paid for it by
sending a written explanation to the person you received the work
from. If you received the work on a physical medium, you must
return the medium with your written explanation. The person or entity
that provided you with the defective work may elect to provide a
replacement copy in lieu of a refund. If you received the work
electronically, the person or entity providing it to you may choose to
give you a second opportunity to receive the work electronically in
lieu of a refund. If the second copy is also defective, you may
demand a refund in writing without further opportunities to fix the
problem.

1.F.4. Except for the limited right of replacement or refund set forth in
paragraph 1.F.3, this work is provided to you ‘AS-IS’, WITH NO
OTHER WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.

1.F.5. Some states do not allow disclaimers of certain implied


warranties or the exclusion or limitation of certain types of damages.
If any disclaimer or limitation set forth in this agreement violates the
law of the state applicable to this agreement, the agreement shall be
interpreted to make the maximum disclaimer or limitation permitted
by the applicable state law. The invalidity or unenforceability of any
provision of this agreement shall not void the remaining provisions.
1.F.6. INDEMNITY - You agree to indemnify and hold the
Foundation, the trademark owner, any agent or employee of the
Foundation, anyone providing copies of Project Gutenberg™
electronic works in accordance with this agreement, and any
volunteers associated with the production, promotion and distribution
of Project Gutenberg™ electronic works, harmless from all liability,
costs and expenses, including legal fees, that arise directly or
indirectly from any of the following which you do or cause to occur:
(a) distribution of this or any Project Gutenberg™ work, (b)
alteration, modification, or additions or deletions to any Project
Gutenberg™ work, and (c) any Defect you cause.

Section 2. Information about the Mission of


Project Gutenberg™
Project Gutenberg™ is synonymous with the free distribution of
electronic works in formats readable by the widest variety of
computers including obsolete, old, middle-aged and new computers.
It exists because of the efforts of hundreds of volunteers and
donations from people in all walks of life.

Volunteers and financial support to provide volunteers with the


assistance they need are critical to reaching Project Gutenberg™’s
goals and ensuring that the Project Gutenberg™ collection will
remain freely available for generations to come. In 2001, the Project
Gutenberg Literary Archive Foundation was created to provide a
secure and permanent future for Project Gutenberg™ and future
generations. To learn more about the Project Gutenberg Literary
Archive Foundation and how your efforts and donations can help,
see Sections 3 and 4 and the Foundation information page at
www.gutenberg.org.

Section 3. Information about the Project


Gutenberg Literary Archive Foundation
The Project Gutenberg Literary Archive Foundation is a non-profit
501(c)(3) educational corporation organized under the laws of the
state of Mississippi and granted tax exempt status by the Internal
Revenue Service. The Foundation’s EIN or federal tax identification
number is 64-6221541. Contributions to the Project Gutenberg
Literary Archive Foundation are tax deductible to the full extent
permitted by U.S. federal laws and your state’s laws.

The Foundation’s business office is located at 809 North 1500 West,


Salt Lake City, UT 84116, (801) 596-1887. Email contact links and up
to date contact information can be found at the Foundation’s website
and official page at www.gutenberg.org/contact

Section 4. Information about Donations to


the Project Gutenberg Literary Archive
Foundation
Project Gutenberg™ depends upon and cannot survive without
widespread public support and donations to carry out its mission of
increasing the number of public domain and licensed works that can
be freely distributed in machine-readable form accessible by the
widest array of equipment including outdated equipment. Many small
donations ($1 to $5,000) are particularly important to maintaining tax
exempt status with the IRS.

The Foundation is committed to complying with the laws regulating


charities and charitable donations in all 50 states of the United
States. Compliance requirements are not uniform and it takes a
considerable effort, much paperwork and many fees to meet and
keep up with these requirements. We do not solicit donations in
locations where we have not received written confirmation of
compliance. To SEND DONATIONS or determine the status of
compliance for any particular state visit www.gutenberg.org/donate.

While we cannot and do not solicit contributions from states where


we have not met the solicitation requirements, we know of no
prohibition against accepting unsolicited donations from donors in
such states who approach us with offers to donate.

International donations are gratefully accepted, but we cannot make


any statements concerning tax treatment of donations received from
outside the United States. U.S. laws alone swamp our small staff.

Please check the Project Gutenberg web pages for current donation
methods and addresses. Donations are accepted in a number of
other ways including checks, online payments and credit card
donations. To donate, please visit: www.gutenberg.org/donate.

Section 5. General Information About Project


Gutenberg™ electronic works
Professor Michael S. Hart was the originator of the Project
Gutenberg™ concept of a library of electronic works that could be
freely shared with anyone. For forty years, he produced and
distributed Project Gutenberg™ eBooks with only a loose network of
volunteer support.

Project Gutenberg™ eBooks are often created from several printed


editions, all of which are confirmed as not protected by copyright in
the U.S. unless a copyright notice is included. Thus, we do not
necessarily keep eBooks in compliance with any particular paper
edition.

Most people start at our website which has the main PG search
facility: www.gutenberg.org.

This website includes information about Project Gutenberg™,


including how to make donations to the Project Gutenberg Literary
Archive Foundation, how to help produce our new eBooks, and how
to subscribe to our email newsletter to hear about new eBooks.

You might also like