The Fnd Functon The functon Fnd returns a soluton to a system of equatons gven by a solve block. You can use Fnd to solve a lnear system, as wth lsolve, or to solve nonlnear systems. The example below solves a system n the unknowns and β: : 0 β : 0 These are ntal guess values for and β. The algorthm for Fnd starts at these values and moves toward a soluton. Fnd(, β) + sn( β) 1.5 + β 3 0.637 2.363 Fnd(, β) gves a soluton to the system. 0.637 β 2.363 Note: The entres of the soluton vector correspond to the varables n the same order that the varables appear after Fnd. In the prevous example, Fnd(β, ) returns the entres of the soluton vector n reverse order.
To check a soluton returned by Fnd, assgn the results to varables. : 0 β : 0 + sn( β) 1.5 + β 3 β : Fnd( β, ) You can use the same names for the results as for the unknown varables. Evaluate the left hand sdes of the system + sn( β) 1.5 + β 3 to confrm that the soluton s correct. Multple Solutons Look at the system x : 1 y : 1 2x 2 + 3y 2 59 4y x + 8 Fnd( x, y) 4 3
The frst equaton represents an ellpse, whle the second represents a straght lne. These are plotted below, along wth the soluton pont. 5 5 0 5 5 2 x² + 3 y² 59 4 y x + 8 Solve block soluton (4,3)
As the graph shows, the soluton corresponds to the pont n the frst quadrant where the curve and the lne ntersect. However, there s another soluton to the system, correspondng to the pont of ntersecton n the second quadrant. How can you get Fnd to return ths second soluton? One way s by changng the guess values. Keep n mnd that the result returned by the functon Fnd (as well as the functons Mnerr, Mnmze, and Maxmze) s drectly related to the guess values for the unknown varables, and at most one soluton s returned for a gven set of guess values. So changng the guess values mght lead to a dfferent soluton.. Lookng at the graph above, you can see that the second soluton les n the second quadrant. So t seems reasonable to try guess values correspondng to a pont - the guess pont - that also les n the second quadrant. Try the guess pont (-3, 3). x : 3 y : 3 2x 2 + 3y 2 59 4y x + 8 Fnd( x, y) 5.371 0.657 Ths tme Fnd returns the second soluton. Usually, f you choose a guess pont close to a soluton, Fnd returns that soluton. However, as wth the root functon, Fnd does not always return the soluton that s closest to the gven guess pont.
You can see the relatonshp between guess ponts and ther correspondng solutons graphcally by defnng a functon that takes a guess pont to the resultng soluton. 2x 2 + 3y 2 59 4y x + 8 Pt( x, y) : Fnd( x, y) For any guess pont (x, y), the functon Pt(x,y) returns one of the two solutons. For example: Pt( 3, 3) 5.371 0.657 Now, see what happens when you apply the Pt functon to 25 guess ponts, equally spaced on a crcle of radus 4 wth center at the orgn. Draw a lne from each guess pont to the soluton produced by the Pt functon for that guess. The resultng plot s qute nterestng. R : 4 N : 25 : 0.. N 1 X 0, Y 0, : R cos sn 2 π N 2 π N X 1, Y 1, : ( ) Pt X 0,, Y 0,
5 5 0 5 5 2 x² + 3 y² 59 4 y x + 8 Solve block soluton (4, 3) Solve block soluton (-5.371, 0.657) Crcle of guess values Guess > soluton lnk Notce that most guess ponts n the rght half-plane (x > 0) lead to the soluton (4,3). However, some ponts n the rght half-plane lead to the soluton (-3.71, 0.657). Try changng R to 6 n the example above to see what happens when the guess ponts le on a crcle of radus 6. Note that the method for Fnd n ths solve block has been set to Levenberg-Marquardt, a very stable routne that s tolerant of poor guesses. You can choose a dfferent method by rght-clckng the Fnd functon, selectng Nonlnear from the drop-down menu, and selectng one of the choces. Dfferent methods can lead to dfferent solutons even wth the same guess pont.
Guess Pont x : 1.236 y : 3.804 Soluton Usng Levenberg-Marquardt Method 2x 2 + 3y 2 59 4y x + 8 Fnd( x, y) 5.371 0.657
Soluton Usng Conjugate Gradent Method 2x 2 + 3y 2 59 4y x + 8 Fnd( x, y) 4 3 What these examples show s that choosng guess values s actually a guessng game. A pcture can help you dentfy the guess ponts that return the solutons you are lookng for. Errors and Problems wth No Solutons Sometmes there mght be no soluton, or Mathcad mght not fnd a soluton. In ether case, Fnd dsplays the error message "No soluton was found." Here's an example of a problem wth no soluton u : 1 v : 1 u u + v 2 + v 3 Fnd ( u, v ) The problem asks for numbers u and v that add to both 2 and 3, whch s mpossble.
Fnd also returns ths error message f there s a soluton but the solver cannot fnd t. One example s z : 1 sn() z z 2 + 1 Fnd () z The problem here s that the only solutons to the gven equaton are complex numbers. (Graph sn(z) and z 2 + 1, and you'll see the curves do not ntersect.) The real guess value of z : 1 sets the solver off n the wrong drecton. In ths case, just as wth the root functon, tryng a complex guess may help z : 1 + sn() z z 2 + 1 Fnd( z) 0.488 + 0.785 Fnd returns an error f there are any mssng guess values. p 2 1 + p 1 p Fnd ( p ) The error message nforms you that the varable s undefned.
Fnd also returns an error f any of the functons n the solve block s undefned at a guess value. For example: x : 3 y : 4 Γ( x) y + 1 x + y 7 Fnd ( x, y ) Fnd returns the error message "Ths value cannot be 0 or a negatve nteger." At frst ths s confusng. To fnd the source of the error, rght-clck Fnd and select Trace Error. Then clck the Frst button n the Trace Error dalog. The cursor lands on the Gamma functon, tellng you that ths s where the error occurs. The Gamma functon s undefned at the value x: -3.. Γ( 33 ) Changng the value of x solves the problem.
Complex Solutons Solve blocks sometmes return complex solutons even when the guess values are real. The followng example, n whch the solver method s set to Levenberg-Marquardt, llustrates ths. u : 1 v : 2 us vs u 2 : Fnd( u, v) sn( v) v cos( u) u us 1.814 + 0.843 vs 2.181 + 0.704 us 2 sn( vs) vs 0.044 0.486 cos( us) us 0.044 0.486 Try changng the guess values for ths solve block from real to complex, and to dfferent values to see how the results change. When solve blocks begn solvng a problem, they evaluate the constrants at the guess values as a check to see f the problem s real or complex. If the values of the constrants are complex at the guesses, the solve block can produce complex solutons even f the guess values themselves are real. In other cases, where the constrants are only complex over a porton of ther doman, you mght be surprsed by a complex result. Ths can occur f the solver, n the course of calculatng ts teratons, wanders nto a complex regon of solutons as t refnes the guesses nto solutons. Check the constrants n the regons of the guess value f you get real answers when you expect complex ones, or vce versa.