sportsgasra.blogg.se

What is the symbolic math toolbox
What is the symbolic math toolbox









First, to define a symbolic expression, you should create symbolic variables and then proceed to build an expression as you would mathematically. 16.2 Calculus The function diff computes the symbolic derivative of a function defined by a symbolic expression. This example declares f(x) as some unknown function of x : syms x f = sym('f(x)') The syms command and sym function have many more options. sym(log(2)) sym('log(2)') log(sym(2)) You can create a symbolic abstract function. The second and third avoid numeric computation completely. The first is only accurate to MATLAB’s double-precision numeric computation (about 16 digits). Try: z = 1/10 a = sym(z) 93 y = rand(1) b = sym(y, 'd') although better ways to create a include: a = sym('1/10') a = 1 / sym(10) If you want to ensure a precise symbolic expression, you must avoid numeric computations. Symbolic variables can be constructed from existing numeric variables using the sym function. You can also assert to Maple that x is always positive, with syms x positive. The clear all statement clears all variables in both MATLAB and Maple, and thus also resets the real or unreal status of x. Use syms x unreal, which declares to Maple that x may now have a nonzero imaginary part. The statements clear or clear x do not undo this declaration, because it clears MATLAB’s variable x but not Maple’s variable s. The statement: syms x real declares to Maple that x is a symbolic variable with no imaginary part. For example, syms x creates a symbolic variable x. 16.1 Symbolic variables You can declare a variable as symbolic with the syms statement. Typing doc eig and doc symbolic/eig displays the help for the numeric eigenvalue function and its symbolic counterpart, respectively. MATLAB selects the correct one depending on the type of inputs to the function. 92 Many of the functions in the Symbolic Math Toolbox have the same names as their numeric counterparts.

#WHAT IS THE SYMBOLIC MATH TOOLBOX PROFESSIONAL#

Since the Symbolic Math Toolbox is not part of the Professional Version of MATLAB (by default), it may not be installed on your system, in which case this chapter will not apply. Key features of the Symbolic Math Toolbox are included in the Student Version of MATLAB. The toolbox M-files that access these symbolic capabilities have names and syntax that will be natural for the MATLAB user. Under this configuration, MATLAB’s numeric and graphic environment is merged with Maple’s symbolic computation capabilities. The Symbolic Math Toolbox The Symbolic Math Toolbox, which utilizes the Maple kernel as its computer algebra engine, lets you perform symbolic computation from within MATLAB. Try this example (see Chapter 7 for the ddom function): A = C = ddom(A) figure(2) spy(A ~= C) spy(A > 2) What you see is a picture of where A and C differ, and another picture of which entries of A are greater than 2. It is useful for matrix expressions coming from relational operators. 91 15.5 Visualizing matrices The spy function introduced in the last section plots the nonzero pattern of a sparse matrix.









What is the symbolic math toolbox