Fit Basic Operations
This guide explains how to use the current Fit module implementation.
Before You Start
Prepare the following items first:
- A function-value entity, such as
y. - One or more variable entities, such as
xandz. - Reasonable ranges, default values, and units for each variable.
- Coefficients with initial values and bounds.
Recommended naming:
- Use ASCII identifiers for variables and coefficients, for example
x,temp,a1,k_abs. - Do not reuse the same name as both a variable and a coefficient in one expression.
Screen Layout
The Fit workspace has four main areas:
- Expression editor.
- Coefficient and variable configuration area.
- Data table and chart area.
- Right-side action buttons.
Step 1: Define the Main Expression
Enter the expression in the editor, for example:
a * x + b
After you type, the module validates automatically and shows:
- Whether the expression is valid.
- Referenced variables.
- Referenced coefficients.
- Unknown identifiers.
- The normalized expression.
If validation fails, fix the expression before continuing.
Step 2: Configure Coefficients
For each coefficient set:
- Symbol.
- Current value.
- Minimum value.
- Maximum value.
- Whether it should be fitted.
Best practices:
- Use an initial value close to the expected solution.
- Avoid overly wide bounds unless you truly need them.
Step 3: Bind Variables
Add the variables used by the expression and bind them to variable entities.
The module uses the bound entity metadata during inversion and optimization, including:
- Default value.
- Lower bound.
- Upper bound.
- Scale.
- Unit.
Step 4: Fill the Data Table
The data table contains:
- A calculated-value column.
- An actual-value column.
- One column per variable.
Common usage patterns:
- For forward calculation, fill the variable columns.
- For coefficient fitting, fill the variable columns and actual-value column.
- For target inversion, fill the actual-value column; the variable columns can optionally hold initial guesses.
Right-Side Actions
Calculate
Use Calculate to evaluate the current expression against the current coefficients and variable samples.
Result:
- The calculated-value column is updated.
- The result window shows a summary and predicted-value preview.
Fit
Use Fit to estimate coefficients from the observed values.
Result:
- The coefficient panel is updated with fitted values.
- The result window shows fitting diagnostics.
Target Inversion
Use Target Inversion to solve variables from target function values.
Result:
- Variable columns are written back row by row.
- Both single-variable and multi-variable models are supported in the current implementation.
Multi-Target Optimization
Use Multi-Target Optimization when you want to solve variables against several weighted objectives.
The target editor below the main expression supports:
- Target expression.
- Target value.
- Weight.
You can also use the button to copy the current main expression into empty targets.
Before solving, check the optimization-target validation messages. Every target must be valid and every weight must be greater than zero.
Result Window
The result window shows:
- Latest operation name.
- Timestamp.
- Updated row count.
- Convergence and diagnostics.
- Summary lines.
- Solved variables.
- Predicted values preview.
Writing Optimization Results Back
For optimization results, the result window provides three writeback actions:
- Write to a specified row.
- Write to row 1.
- Write to all rows.
These actions write the solved variable values back into the variable columns in the data table.
Recommended Workflows
Workflow A: Validate and Calculate
- Bind variables and coefficients.
- Enter the expression.
- Wait for expression validation to pass.
- Fill variable samples.
- Click Calculate.
Workflow B: Fit Coefficients
- Enter the expression.
- Fill variable columns.
- Fill the actual-value column.
- Set coefficient initial values and bounds.
- Click Fit.
- Review the diagnostics in the result window.
Workflow C: Invert Variables from Target Values
- Enter a valid expression.
- Fix the coefficients.
- Fill the actual-value column with target values.
- Click Target Inversion.
- Review the written-back variable columns.
Workflow D: Solve Multi-Target Optimization
- Enter the main expression.
- Add one or more optimization targets.
- Fill target expressions, target values, and weights.
- Confirm that target validation shows no errors.
- Click Multi-Target Optimization.
- Review diagnostics in the result window.
- Write the solved variables back to the desired row or rows if needed.
Troubleshooting
Expression validation fails
Check the following first:
- A referenced variable may not be bound.
- A coefficient name and variable name may be mixed up.
- The expression may contain unsupported identifiers.
Fit does not converge
Check:
- Initial coefficient values.
- Coefficient bounds.
- Sample quality and quantity.
- Numerical singularities in the expression.
Inversion or optimization result looks unreasonable
Check:
- Variable ranges may be too narrow.
- The target value may be outside the reachable range.
- Default values may be too far from the desired solution.