Hopp til innholdet
Hjem » How to solve equations with Mathcad

How to solve equations with Mathcad

    In PTC Mathcad Prime, you can solve linear, non-linear, and differential systems of equations.

    PTC Mathcad has a few methods that we can use:

    1. The lsolve function.
    2. The Solve Block construct.
    3. Solving symbolically.
    4. lsolve

    To solve linear systems of equations, we work with a built-in solving function, lsolve, to quickly find the solution.

    PTC Mathcad Tips 17-01

    The Solve Block

    To solve both linear and non-linear systems of equations, we use the Solve Block feature, which is an extremely powerful and flexible construct.

    The Solve Block can be found in the Math tab, and it contains three different sections:

    • Guess Values
      In this section, you initialise the variables that you want to solve by using the Definition operator to assign a value. If you are unsure of what to use, use a value of 1.
    • Constraints
      This is the section where you write your system of equations. Note: for the equals sign, you use the Comparison operator, not the Evaluation operator.
    • Solver
      Here, you create a vector for the variables you want to solve. Then use the Definition operator to assign the Find function for the same variables.
    PTC Mathcad Tips 17-02

    Then outside of the Solve Block, evaluate the vector or individual variables to see the solutions.

    The Solve Block is a special structure within Mathcad. In addition to solving systems of equations, it can be used to perform optimisations – finding the minimum or maximum for a function and differential equations.

    In addition, it is a great feature to use in reporting, as the reader can easily follow the calculation flow and is presented with a full picture of the calculations.

    Another example

    The non-linear system of equations is represented on a graph in the below example, where we can see the intersection points.

    In the example, we have inserted a solve block from the Math tab, and we type in the initial values, along with the constraints, which are limits for what we want to calculate.

    PTC Mathcad Tips 17-03

    Once you understand the solve block structure, you will feel confident in applying solve blocks engineering design problems when solving, for instance, a minimum pipe diameter to produce a given flow.

    PTC Mathcad Tips 17-04

    Symbolic Solving

    Sometimes when we have an equation or a system of equations, instead of solving them numerically, we want to solve them symbolically. We can do this using the Symbolic Evaluation operator and the solve keyword. After selecting the solve keyword, type in a comma followed by the variables that you want to solve symbolically:

    PTC Mathcad Tips 17-05