# How to Solve Systems of Equations Through Solve Blocks in PTC Mathcad

Solve blocks are a PTC Mathcad construct that lets you solve any number of equations and unknown variables.

The function Find returns a solution to a system of equations given by a solve block. You can use Find to solve a linear system or nonlinear systems.

How to Use PTC Mathcad Prime Solve Blocks

1. Insert a Solve Block from the Math tab and add two guess values. Note that the Guess Values label moves to bracket that section. The algorithm for Find starts at these values and moves toward a solution.The solve block box allows you to reposition the solve block on the page, without worrying about losing any of the pieces. Definitions inside the solve block are local to the solve block.

2. Next add your constraints. You must have the same number of constraints as variables you are solving. You do not need the word Given, unlike earlier versions of PTC Mathcad.
3. For the equals sign, use the Boolean Equals operator, Ctrl+=Note: The entries of the solution vector correspond to the variables in the same order that the variables appear after Find. Type in Find(y, x) to return the entries in reverse order. Evaluate the left-hand sides of the system with the found results to confirm that the solution is correct.
4. All of the data has been entered

Multiple Solutions
Take a look at the solve block below.

Now, one as an example

The first equation represents an ellipse, while the second represents a straight line. These are plotted below, along with the solution point.

The same block, presented graphically

As the graph shows, the solution corresponds to the point in the first quadrant where the curve and the line intersect. However, there is another solution to the system, corresponding to the point of intersection in the second quadrant. How can you get Find to return this second solution?

Change the Guess Value
Changing the guess values reveals other solutions. Keep in mind that the result returned by the function Find (as well as by the functions Minerr, Minimize, and Maximize) is directly related to the guess values for the unknown variables, and at most one solution is returned for a given set of guess values.

So changing the guess values might lead to a different solution.

Looking at the graph above, you can see that the second solution lies in the second quadrant. So it seems reasonable to try guess values corresponding to a point – the guess point – that also lies in the second quadrant. Try the guess point (-3, 3).

The solver finds the same answer as the graphical solution.

This time Find returns the second solution.

Usually, if you choose a guess point close to a solution, Find returns that solution. However, as with the root function, Find does not always return the solution that is closest to the given guess point.

You can see the relationship between guess points and their corresponding solutions graphically by defining a function that takes a guess point to the resulting solution.

For any guess point (x, y), the function Pt(x,y) returns one of the two solutions. For example:Now, see what happens when you apply the Pt function to 25 guess points, equally spaced on a circle of radius 4 with center at the origin. Draw a line from each guess point to the solution produced by the Pt function for that guess. The resulting plot is quite interesting. By changing the guess point, you can find both possible solutions.

Notice that most guess points in the right half-plane (x > 0) lead to the solution (4,3). However, some points in the right half-plane lead to the solution (-3.71, 0.657)Try changing R to 6 in the example above to see what happens when the guess points lie on a circle of radius 6.

Find uses the Levenberg-Marquardt method, a very stable routine that is tolerant of poor guesses.

What these examples show is that choosing guess values is actually a guessing game. A picture can help you identify the guess points that return the solutions you are looking for.

There’s lots more to learn about solve blocks, but this should get you going. Part two of this article will discuss what to do when the solve block does not find a solution.

This entry was posted in Tips & Tricks and tagged , , , , , , . Bookmark the permalink.

## 18 thoughts on “How to Solve Systems of Equations Through Solve Blocks in PTC Mathcad”

1. Mathias Bachmann says:

I have problems solving something a little diferent than what’s shown. Can I get any help here?

1. Mathias,
You can ask questions there and even upload a worksheet so others can see the problem. The Community members are very willing to help!

Bettina

2. Rodolfo says:

use Gauss method, it is the simple method to solve the “system of equations.

3. Al says:

What is the shortcut to implement Find()? I type it in and it doesn’t do anything?

4. Jakov Kucan says:

“find” must be part of a solve block — it will not work outside. Simply type “find(” you will notice that it changes font as you type “(“. This is because the KEYWORD label is applied. You can also apply the KEYWORD label using Labels drop-down on the Math tab. Hope this helps.

Another way to get started with solve blocks is to search help for Solve Block examples. You can copy equations from help into the worksheet.

5. Kyle says:

How could you solve a system of equations that have a greater number of constraints than variables in Mathcad?

6. Anna Giangregorio says:

Hi Kyle- we’ve attached examples of how to do this here: http://communities.ptc.com/docs/DOC-4237

7. Torgrim says:

How did you plot the equation 2x^3 + 3y^2 = 59?
Can Mathcad Prime plot implicit functions/equations? I tried in my Mathcad but only get error messages.

1. Your suspicions are correct. Mathcad Prime does not support the plotting of implicit equations. The red circle you’re referring to was most likely generated with two functions: +/- sqrt(59 – 2*x^2) / 3.

8. Néstor Montoya says:

Dear colleagues, in many engineering applications it is more convenient to use matrix notation, how I could solve a system of nonlinear equations using matrix notation?. I’m using Mathcad prime 3.0.

Thanks for your attention. best regards.

1. Aaron Shaw says:

Hi Nestor,

Thank you for your question and interest in PTC Mathcad. Unfortunately, you can only solve linear equations this way. If you have a specific example, we may be able to be more helpful. Please email me at ashaw@ptc.com

Thanks,
Aaron

9. You can solve a system of nonlinear equations using matrix notation – symbolically, in Mathcad Prime 3.0!?

Example:
Make a 2×1 matrix (2 rows and 1 column). Enter the two equations (one per row),
x^2+y^2 = 9
x+y = 3
Click Ctrl+. (Symbolic evaluation/arrow)
Enter solve,x,y above the arrow, and press Enter key on your keyboard to get your solution.

Hope this helps.

10. Tobias says:

Looking for help.

v:= 16.2 L/hr c,1:= 4200 J/kg*K rho:= 1000 kg/m^3

k.1 := 50 k.2 := 1.3126 k.3 := 942

t.f := 343.15K t.r := 313.15K P := 3000 W

Given

P = rho*v.1*c(t.f – t.r)

P = {[(t.f + t.r)/ 2 / k.1] ^k.2} * k.3

t.r
:= Find(t.f , t.r)
t.f

Problem is, that i tells me that t.f is undefined… If i switch t.r and t.f around then it tells me t.r is undefined. Anyone who know why?

Thanks,
Tobias

1. Tobias says:

P = rho*v.1*c(t.f – t.r) Made a typo here in my comment. In my sheet the equations is as following: P=rho*v*c.1(t.f-t.r)