WOLFRAM

Enable JavaScript to interact with content and submit forms on Wolfram websites. Learn how
Wolfram Language & System Documentation Center

FormulaModel [expr,vars]

creates a model using the expression expr, in variables vars.

FormulaModel [expr,pars,vars]

creates a model using explicit parameters pars.

Details
Details and Options Details and Options
Examples  
Basic Examples  
Scope  
Hyperparameters  
"Formula"  
Variables  
Parameters  
Evaluation  
Information  
Fitting  
See Also
Related Guides
History
Cite this Page

FormulaModel [expr,vars]

creates a model using the expression expr, in variables vars.

FormulaModel [expr,pars,vars]

creates a model using explicit parameters pars.

Details

  • FormulaModel represents an arbitrary expression in the given variables in a format suitable for symbolic or numerical evaluation and fitting.
  • The current model representation can be expanded using FormulaModel [][{x1,}].
  • Hyperparameters
  • The following hyperparameters may be specified for this model:
  • "Formula" expr the symbolic formula
  • Variables
  • When not specified, variables will automatically be enumerated using x [i].
  • Valid variable specifications vars include:
  • n the number of variables
    symb a symbolic representation of a single variable
    {symb1,} a list of symbolic variables
  • Parameters
  • When not specified, parameters will automatically be enumerated using C [i].
  • Valid parameter pars specifications in the form {par1,} include:
  • val a fixed parameter value val
    par a symbolic parameter name par
    parval a symbolic name par set to a fixed value val
    {par,val0} a symbolic parameter named par with the initial value val0
  • Properties
  • Model properties can be extracted using Information [PowerModel[],prop].
  • Valid basic properties include:
  • "BaseType" model base type
    "Name" model name
    "ShortName" short identifier to use as label
    "InputType" supported input types
    "OutputType" supported output types
  • Valid data-related properties include:
  • "ColumnNames" names of the input features
    "ColumnVariableMap" map between column names and model variables
    "InputSize" dimensionality of the input
    "OutputSize" dimensionality of the output
    "Trainable" whether the model is fully specified and can be trained
    "Trained" whether the model can be evaluated numerically
    "VariableColumnMap" map between model variables and column names
    "Variables" name of the model variables
  • Best model-related properties include:
  • "Expression" model expression
    "Function" model as a pure function
    "SymbolicExpression" model expression with symbolic parameters
    "TabularFunction" pure function suitable to work on a tabular row
  • Parameter-related properties include:
  • "ParameterAssociation" association of parameter names and values
    "ParameterCount" the number of parameters
    "ParameterInitialValues" initial values for the fit
    "ParameterNames" parameter names
    "ParameterRules" list of rules with parameter names and values
    "Parameters" parameter values if present; names otherwise
    "ParameterValues" parameter values
    "Constraints" parameter constraints
  • Hyperparameter-related properties include:
  • "Hyperparameters" hyperparameter values

Examples

open all close all

Basic Examples  (4)

Specify a single-variable FormulaModel with one parameter:

Wolfram Language code: FormulaModel[Sin[k x], {k}, x]

Specify multiple parameters and variables:

Wolfram Language code: FormulaModel[A Sin[k x] + b y, {A, k, b}, {x, y}]

Specify a fixed parameter value:

Wolfram Language code: f = FormulaModel[Sin[k x], {k -> π}, x]

Evaluate the model:

Wolfram Language code: f[3.14]

Plot the model:

Wolfram Language code: Plot[Evaluate@f[x], {x, -5, 5}]

Plot a multivariate model:

Wolfram Language code: Plot3D[Evaluate[FormulaModel[α Sin[ω x] + γ Sqrt[x^2 + y^2], {α -> 1, ω -> π, γ -> 1}, {x, y}][{a, b}]], {a, -5, 5}, {b, -5, 5}, ColorFunction -> "Rainbow"]

Fit a formula to a list of points:

Wolfram Language code: points = {{1, 1}, {2, 0}, {2.5, -1}, {3, 0}};
Wolfram Language code: ModelFit[points, FormulaModel[Sin[k x + c], {k, c}, x]]

Scope  (15)

Hyperparameters  (2)

"Formula"  (2)

Specify the model formula using an expression:

Wolfram Language code: FormulaModel[a + b x ^ c, {a, b, c}, x]

Use the explicit hyperparameter name:

Wolfram Language code: FormulaModel[<|"Formula" -> a + b x ^ c|>, {a, b, c}, x]

Variables  (2)

Specify a model with a single variable:

Wolfram Language code: FormulaModel[A Sin[k x], {A, k}, x]

Specify multiple variables:

Wolfram Language code: FormulaModel[A (Sin[k1 x] + Sin[k1 y]), {A, k1, k2}, {x, y}]

Parameters  (3)

Define the model with a single parameter:

Wolfram Language code: FormulaModel[Sin[k x], {k}, x]

Specify multiple parameters:

Wolfram Language code: FormulaModel[A Sin[k x], {A, k}, x]

Set a parameter to a fixed value:

Wolfram Language code: FormulaModel[A Sin[k x], {A -> 2, k}, x]

Specify a parameter to a initial value prior to fitting:

Wolfram Language code: FormulaModel[A Sin[k x], {{A, 2}, k}, x]

Evaluation  (2)

Symbolically evaluate a single-variable model:

Wolfram Language code: FormulaModel[A Sin[k x], {A, k}, x][x]

Symbolically evaluate a two-variable model:

Wolfram Language code: FormulaModel[A Sin[k x] + m y, {A -> 2, k, m}, {x, y}][{a, b}]

Evaluate the model on multiple symbolic variables:

Wolfram Language code: FormulaModel[A Sin[k x] + m y, {A -> 2, k, m}, {x, y}][{{a, b}, {c, d}}]

Evaluate the model on a list of points:

Wolfram Language code: FormulaModel[A Sin[k x], {A, k}, x][{{1.}, {2.}, {3.}}]

Specify numeric parameters for a full evaluation:

Wolfram Language code: FormulaModel[A Sin[k x], {A -> 2, k -> 3}, x][{{1.}, {2.}, {3.}}]

Information  (3)

View general information about a model:

Wolfram Language code: Information[FormulaModel[A Sin[k x], {A, k}, x]]

Get specific properties from the model:

Wolfram Language code: Information[FormulaModel[A Sin[k x], {A, k}, x], "Variables"]

Retrieve multiple properties:

Wolfram Language code: Information[FormulaModel[A Sin[k x], {A, k}, x], {"Variables", "Parameters"}]

Fitting  (3)

Fit a FormulaModel to some data:

Wolfram Language code: ModelFit[{...}, FormulaModel[a Exp[Cos[ω x]] + c, {a, ω, c}, x]]

Specify initial values for some parameters:

Wolfram Language code: ModelFit[{...}, FormulaModel[a Exp[Cos[ω x]] + c, {a, {ω, 2Pi}, c}, x]]

Specify fixed values for some parameters:

Wolfram Language code: ModelFit[{...}, FormulaModel[a Exp[Cos[ω x]] + c, {a, ω -> 2Pi, c}, x]]
Wolfram Research (2026), FormulaModel, Wolfram Language function, https://reference.wolfram.com/language/ref/FormulaModel.html.

Text

Wolfram Research (2026), FormulaModel, Wolfram Language function, https://reference.wolfram.com/language/ref/FormulaModel.html.

CMS

Wolfram Language. 2026. "FormulaModel." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/FormulaModel.html.

APA

Wolfram Language. (2026). FormulaModel. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FormulaModel.html

BibTeX

@misc{reference.wolfram_2026_formulamodel, author="Wolfram Research", title="{FormulaModel}", year="2026", howpublished="\url{https://reference.wolfram.com/language/ref/FormulaModel.html}", note=[Accessed: 15-August-2026]}

BibLaTeX

@online{reference.wolfram_2026_formulamodel, organization={Wolfram Research}, title={FormulaModel}, year={2026}, url={https://reference.wolfram.com/language/ref/FormulaModel.html}, note=[Accessed: 15-August-2026]}

Top [フレーム]

AltStyle によって変換されたページ (->オリジナル) /