Skip to main content
Version: Next

Fit Basic Operations

This guide explains how to use the current Fit module implementation.

Before You Start

Prepare the following items first:

  1. A function-value entity, such as y.
  2. One or more variable entities, such as x and z.
  3. Reasonable ranges, default values, and units for each variable.
  4. Coefficients with initial values and bounds.

Recommended naming:

  1. Use ASCII identifiers for variables and coefficients, for example x, temp, a1, k_abs.
  2. 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:

  1. Expression editor.
  2. Coefficient and variable configuration area.
  3. Data table and chart area.
  4. 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:

  1. Whether the expression is valid.
  2. Referenced variables.
  3. Referenced coefficients.
  4. Unknown identifiers.
  5. The normalized expression.

If validation fails, fix the expression before continuing.

Step 2: Configure Coefficients

For each coefficient set:

  1. Symbol.
  2. Current value.
  3. Minimum value.
  4. Maximum value.
  5. Whether it should be fitted.

Best practices:

  1. Use an initial value close to the expected solution.
  2. 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:

  1. Default value.
  2. Lower bound.
  3. Upper bound.
  4. Scale.
  5. Unit.

Step 4: Fill the Data Table

The data table contains:

  1. A calculated-value column.
  2. An actual-value column.
  3. One column per variable.

Common usage patterns:

  1. For forward calculation, fill the variable columns.
  2. For coefficient fitting, fill the variable columns and actual-value column.
  3. 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:

  1. The calculated-value column is updated.
  2. The result window shows a summary and predicted-value preview.

Fit

Use Fit to estimate coefficients from the observed values.

Result:

  1. The coefficient panel is updated with fitted values.
  2. The result window shows fitting diagnostics.

Target Inversion

Use Target Inversion to solve variables from target function values.

Result:

  1. Variable columns are written back row by row.
  2. 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:

  1. Target expression.
  2. Target value.
  3. 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:

  1. Latest operation name.
  2. Timestamp.
  3. Updated row count.
  4. Convergence and diagnostics.
  5. Summary lines.
  6. Solved variables.
  7. Predicted values preview.

Writing Optimization Results Back

For optimization results, the result window provides three writeback actions:

  1. Write to a specified row.
  2. Write to row 1.
  3. Write to all rows.

These actions write the solved variable values back into the variable columns in the data table.

Workflow A: Validate and Calculate

  1. Bind variables and coefficients.
  2. Enter the expression.
  3. Wait for expression validation to pass.
  4. Fill variable samples.
  5. Click Calculate.

Workflow B: Fit Coefficients

  1. Enter the expression.
  2. Fill variable columns.
  3. Fill the actual-value column.
  4. Set coefficient initial values and bounds.
  5. Click Fit.
  6. Review the diagnostics in the result window.

Workflow C: Invert Variables from Target Values

  1. Enter a valid expression.
  2. Fix the coefficients.
  3. Fill the actual-value column with target values.
  4. Click Target Inversion.
  5. Review the written-back variable columns.

Workflow D: Solve Multi-Target Optimization

  1. Enter the main expression.
  2. Add one or more optimization targets.
  3. Fill target expressions, target values, and weights.
  4. Confirm that target validation shows no errors.
  5. Click Multi-Target Optimization.
  6. Review diagnostics in the result window.
  7. Write the solved variables back to the desired row or rows if needed.

Troubleshooting

Expression validation fails

Check the following first:

  1. A referenced variable may not be bound.
  2. A coefficient name and variable name may be mixed up.
  3. The expression may contain unsupported identifiers.

Fit does not converge

Check:

  1. Initial coefficient values.
  2. Coefficient bounds.
  3. Sample quality and quantity.
  4. Numerical singularities in the expression.

Inversion or optimization result looks unreasonable

Check:

  1. Variable ranges may be too narrow.
  2. The target value may be outside the reachable range.
  3. Default values may be too far from the desired solution.
  1. Fit Module Overview
  2. Floating Window
  3. Editing Table