# Algebraic Equations/Symbolic Tools in Visual Studio .NET Drawing QR Code in Visual Studio .NET Algebraic Equations/Symbolic Tools

CHAPTER 5 Algebraic Equations/Symbolic Tools
Make QR Code JIS X 0510 In VS .NET
Using Barcode creator for .NET Control to generate, create QR Code image in Visual Studio .NET applications.
Read QR Code In .NET Framework
We can enter the system as a set of character strings:
Draw Bar Code In Visual Studio .NET
Using Barcode creator for .NET Control to generate, create barcode image in .NET applications.
Scanning Bar Code In .NET Framework
Using Barcode decoder for VS .NET Control to read, scan read, scan image in .NET framework applications.
>> >> >> >> eq1 eq2 eq3 eq4 = = = = 'w + '2*w 'w + 'w x + 4*y + 3*z = 5'; +3*x+y 2*z = 1'; 2*x 5*y+4*z = 3'; 3*z = 9';
Encode Denso QR Bar Code In Visual C#.NET
Using Barcode generator for Visual Studio .NET Control to generate, create QR Code image in .NET framework applications.
Paint QR In .NET Framework
Using Barcode printer for ASP.NET Control to generate, create QR image in ASP.NET applications.
Now we call solve, passing the equations as a comma-delimited list:
Painting Quick Response Code In VB.NET
Using Barcode printer for .NET Control to generate, create QR image in .NET framework applications.
Linear Creation In Visual Studio .NET
Using Barcode generation for .NET framework Control to generate, create Linear image in .NET applications.
>> s = solve(eq1,eq2,eq3,eq4);
Generate Matrix 2D Barcode In .NET
Using Barcode creation for .NET framework Control to generate, create Matrix Barcode image in .NET framework applications.
Barcode Drawer In .NET
Using Barcode printer for .NET framework Control to generate, create bar code image in VS .NET applications.
We can then extract the value of each variable which solves the system of equations:
Encode Barcode In .NET
Using Barcode encoder for .NET Control to generate, create bar code image in Visual Studio .NET applications.
Create International Standard Serial Number In .NET Framework
Using Barcode printer for .NET Control to generate, create ISSN image in Visual Studio .NET applications.
>> w = sw w = 1404/127 >> x = sx x = 818/127 >> y = sy y = 53/127 >> z = sz z = 87/127
Create DataMatrix In Visual Studio .NET
Using Barcode printer for Reporting Service Control to generate, create Data Matrix ECC200 image in Reporting Service applications.
Paint Code 128 Code Set A In Objective-C
Using Barcode maker for iPhone Control to generate, create Code 128 image in iPhone applications.
Expanding and Collecting Equations
Recognize Code 39 Extended In Visual C#
Using Barcode decoder for .NET framework Control to read, scan read, scan image in .NET applications.
Generating Bar Code In None
Using Barcode printer for Font Control to generate, create bar code image in Font applications.
In elementary school we learned how to expand equations For instance: (x + 2) (x 3) = x2 x 6
EAN 128 Generator In Visual C#
Using Barcode drawer for .NET Control to generate, create EAN 128 image in Visual Studio .NET applications.
Barcode Scanner In Java
Using Barcode Control SDK for Java Control to generate, create, read, scan barcode image in Java applications.
MATLAB Demysti ed
EAN13 Printer In None
Using Barcode encoder for Microsoft Excel Control to generate, create GS1 - 13 image in Office Excel applications.
GS1 - 13 Encoder In None
Using Barcode maker for Font Control to generate, create EAN / UCC - 13 image in Font applications.
We can use MATLAB to accomplish this sort of task by calling the expand command Using expand is relatively easy For example:
>> expand((x 1)*(x+4))
When this command is executed, we get:
ans = x^2 +3*x 4
The expand function can be applied in other ways For example, we can apply it to trig functions, generating some famous trig identities:
>> expand(cos(x+y))
This gives us:
ans = cos(x)*cos(y) sin(x)*sin(y)
>> expand(sin(x y)) ans = sin(x)*cos(y) cos(x)*sin(y)
To work with many symbolic functions, you must tell MATLAB that your variable is symbolic For example, if we type:
>> expand((y 2)*(y+8))
MATLAB returns:
Unde ned function or variable 'y
To get around this, rst enter:
>> syms y
Then we get:
>> expand((y 2)*(y+8)) ans = y^2+6*y 16
CHAPTER 5 Algebraic Equations/Symbolic Tools
MATLAB also lets us go the other way, collecting and simplifying equations First let s see how to use the collect command One way you can use it is for distribution of multiplication Consider: x(x2 2) = x3 2x To do this in MATLAB, we just write:
>> collect(x*(x^2 2)) ans = x^3 2*x
Another example (with a new symbolic variable t):
>> syms t >> collect((t+3)*sin(t)) ans = sin(t)*t+3*sin(t)
Another algebraic task we can do symbolically is factoring To show that: x2 y2 = (x + y)(x y) Using MATLAB, we type:
>> factor(x^2 y^2) ans = (x y)*(x+y)
We can factor multiple equations with a single command:
>> factor([x^2 y^2, x^3+y^3])
Finally, we can use the simplify command This command can be used to divide polynomials For instance, we can show that (x2 + 9)(x2 9) = x4 81 by writing:
>> simplify((x^4 81)/(x^2 9)) ans = x^2+9
Here is another example Consider that: e2log3x = elog9x = 9x2
MATLAB Demysti ed
We could have found this out with the MATLAB command:
>> simplify(exp(2*log(3*x))) ans = 9*x^2
The simplify command is useful for obtaining trig identities Examples:
>> simplify(cos(x)^2 sin(x)^2) ans = 2*cos(x)^2 1 >> simplify(cos(x)^2+sin(x)^2) ans = 1
Solving with Exponential and Log Functions
So far for the most part we have only looked at polynomials The symbolic solver can also be used with exponential and logarithmic functions First let s consider and equation with logarithms EXAMPLE 5-4 Find a value of x that satis es: log10 (x) log10 (x 3) = 1 SOLUTION 5-4 Base ten logarithms can be calculated by or represented by the log10 function in MATLAB So we can enter the equation thus:
>> eq = 'log10(x) log10(x 3) = 1';
CHAPTER 5 Algebraic Equations/Symbolic Tools
Then we call solve:
>> s = solve(eq);
In this case, MATLAB only returns one solution:
>> s(1) ans = 10/3
Now let s consider some equations involving variables as exponents Suppose we are asked to solve the system: y=3 x y=5 +1 We can call solve to nd the solution:
>> s = solve('y = 3^2*x','y = 5^x+1')
MATLAB returns:
s = x: [2x1 sym] y: [2x1 sym]
So it appears there are two values of each variable that solve the equation We can get the values of x out by typing:
>> sx(1) ans = 1/9*exp( lambertw( 1/9*log(5)*5^(1/9))+1/9*log(5))+1/9 >> sx(2) ans = 1/9*exp( lambertw( 1, 1/9*log(5)*5^(1/9))+1/9*log(5))+1/9
MATLAB Demysti ed
These might not be too useful to the average man or woman So let s convert them to numerical values:
>> a = double(sx(1)) a = 02876 >> b = double(sx(2)) b = 16214
We can also extract the y values:
>> c = double(sy(1)) c = 25887 >> d = double(sy(2)) d = 145924
Do the results make sense We check The idea is to see if sx(1) satis es the rst equation giving sy(1) and ditto for the second array elements We nd: