C HA PTE R 6

QR Code ISO/IEC18004 Scanner In NoneUsing Barcode Control SDK for Software Control to generate, create, read, scan barcode image in Software applications.

QR Code ISO/IEC18004 Generation In NoneUsing Barcode maker for Software Control to generate, create QR Code JIS X 0510 image in Software applications.

Equations

Read QR In NoneUsing Barcode decoder for Software Control to read, scan read, scan image in Software applications.

Denso QR Bar Code Maker In Visual C#Using Barcode drawer for VS .NET Control to generate, create QR Code image in VS .NET applications.

6.1 Solving Algebraic Equations

Encode QR Code JIS X 0510 In VS .NETUsing Barcode creation for ASP.NET Control to generate, create QR Code image in ASP.NET applications.

Printing QR Code ISO/IEC18004 In .NET FrameworkUsing Barcode generation for Visual Studio .NET Control to generate, create QR Code image in .NET applications.

Solutions of general algebraic equations may be found using the Solve command. The command is easy to use, but one must be careful to use a double equal sign, , between the left- and right-hand sides of the equation. (Recall that the double equal sign is a logical equality: lhs rhs has a value of True if and only if lhs and rhs have the same value, False otherwise.)

QR Code Generator In VB.NETUsing Barcode maker for .NET framework Control to generate, create QR Code ISO/IEC18004 image in VS .NET applications.

Drawing UCC-128 In NoneUsing Barcode generator for Software Control to generate, create UCC-128 image in Software applications.

Solve[equations, variables] attempts to solve equations for variables.

Data Matrix Maker In NoneUsing Barcode generation for Software Control to generate, create Data Matrix image in Software applications.

Painting Bar Code In NoneUsing Barcode creator for Software Control to generate, create bar code image in Software applications.

The roots determined by Solve are expressed as of a list of the form

Drawing Code128 In NoneUsing Barcode printer for Software Control to generate, create ANSI/AIM Code 128 image in Software applications.

Make Barcode In NoneUsing Barcode generator for Software Control to generate, create barcode image in Software applications.

x1},{x x2}, ...}

Leitcode Creator In NoneUsing Barcode generation for Software Control to generate, create Leitcode image in Software applications.

Recognize UPC - 13 In NoneUsing Barcode decoder for Software Control to read, scan read, scan image in Software applications.

The notation x x1 indicates that the solution, x, is x1, but x is not replaced by this value. If the equation has roots of multiplicity m > 1, each is repeated m times. If only one variable is present, variables may be omitted.

Code 128 Code Set B Maker In JavaUsing Barcode maker for Java Control to generate, create Code 128 Code Set C image in Java applications.

ANSI/AIM Code 128 Encoder In NoneUsing Barcode generator for Microsoft Excel Control to generate, create Code128 image in Microsoft Excel applications.

EXAMPLE 1 In this example, there is only one variable so the specification of variables is unnecessary.

Generating Data Matrix 2d Barcode In Objective-CUsing Barcode drawer for iPhone Control to generate, create Data Matrix 2d barcode image in iPhone applications.

European Article Number 13 Generator In NoneUsing Barcode creation for Microsoft Word Control to generate, create EAN / UCC - 13 image in Office Word applications.

Solve[7 x + 3 3 x + 8]

European Article Number 13 Creator In Visual C#.NETUsing Barcode maker for VS .NET Control to generate, create EAN13 image in Visual Studio .NET applications.

ANSI/AIM Code 128 Generator In .NET FrameworkUsing Barcode creation for Reporting Service Control to generate, create USS Code 128 image in Reporting Service applications.

x 5 4

If we solve the equation ax = b for x, Solve tells us that x = b/a. However, if a = b = 0, then every number x is a solution. The command Reduce can be used to describe all possible solutions. Reduce[equations, variables] simplifies equations, attempting to solve for variables. If equations is an identity, Reduce returns the value True. If equations is a contradiction, the value False is returned.

In describing the solutions, Reduce uses the symbols && (logical and) and || (logical or). && takes precedence over ||.

EXAMPLE 2

Solve[a x b, x]

x b a

Reduce[a x b, x] (b 0 & &a 0)|| a 0 & & x b a Reduce[x2 9 (x + 3)(x 3), x] True Reduce[x2 10 (x + 3)(x 3), x] False

Either a = b = 0 or a 0 and x = b/a.

Equations

If we try to solve an equation that contains two or more variables, we must specify which variable we are solving for.

EXAMPLE 3

Note the space between a and y and between c and x. This is important. may be used instead.

Solve[a y + b c x + d]

Solve svars : Equations may not give solutions for all "solve" variables.

d + c x a y }}

We must specify which variable we wish to solve for: Solve[a y + b c x + d, x] x b d +a y c Solve[a y + b c x + d, y]

y b + d + c x a

Solve[a y + b c x + d, b]

d + c x a y}} b c x + a y}}

Solve[a y + b c x + d, d]

For systems of equations, equations is a list of the form {equation1, equation2, . . .} and variables represents either a single variable or a list of several. Alternatively, equations may be represented by the individual equations separated by && (logical and).

EXAMPLE 4 Here is an easy example that shows how to solve a simple system:

2 x + 3 y = 7 3 x + 4 y = 10

Solve[{2 x + 3 y 7, 3 x + 4 y 10}, {x, y}] or Solve[2 x + 3 y 7 && 3 x + 4 y 10, {x, y}]

2, y 1}}

In this example, the specification of {x, y} is not necessary because we do not have more variables than equations. If you have more unknown variables than equations, you must specify which variables you wish to solve for. Otherwise you get Mathematica s default.

EXAMPLE 5

Solve[{x + 2 y + z 5, 2 x + y + 3 z 7}, {y, z}]

y 8 x , z 3( 3+ x) 5 5

Of course, Solve is not limited to solving only linear equations.

EXAMPLE 6

Solve[a x2 + b x + c 0, x] b b2 4ac b + b2 4ac x , x 2a 2a

Observe that Mathematica gives the general solution in terms of arbitrary a, b, and c unless values are assigned to these variables.

Equations

EXAMPLE 7

Solve[x3 + y2 5 && x + y 3]

{{y 2, x 1}, {y 4

5, x 1 + 5 , y 4 + 5, x 1 5

Because Mathematica returns the solutions of equations as a nested list, they cannot be used directly as input to other mathematical structures. However, we can access their values without unnecessary typing or pasting by using /. If we wish to compute the value of an expression using the solutions obtained from Solve, we can use the /. replacement operator and Mathematica will substitute the appropriate values.

x2 + y = 5 EXAMPLE 8 Suppose we wish to solve the equations and compute the values of the expression x 2 + y 2 . x+y =3 We use the Solve command and the object solutions for convenience. solutions = Solve[{x2 + y 5, x + y 3},{x, y}]

1, x 2}, {y 4, x 1}}