Solve Blocks > About Solve Block Variables
About Solve Block Variables
When you define variables inside a solve block, the following rules apply:
You can only use the definition operator to define variables inside solve blocks, but you cannot use the global definition operator for such definitions.
When you use the definition operator to assign a value to a variable, the assignment is limited to inside the solve block. The assigned value can be a number or a previously defined solve block variable.
You can use the definition operator to assign the output of a solve block function to a variable. Such assignment is recognized inside and outside the solve block.
For example, in the solve block below:
The definition operator is used to define the guess value variables x, y, and z.
Three equations are used to define the constraints.
The solve block function Find is used to find the solution that fits the constraints.
The definition operator is used to assign the output of Find to variable vec.
The guess values are evaluated at the bottom of the solve block.
Click to copy this expression
Evaluating the solve block variables outside the solve block shows that:
Variable vec is defined and returns the same result inside and outside the solve block.
Click to copy this expression
Variables x, y, and z are undefined outside the solve block, and evaluating them returns a similar error message.
Click to copy this expression
Click to copy this expression
Click to copy this expression
Was this helpful?