FormulaModel[expr,vars]
creates a model using the expression expr, in variables vars.
FormulaModel[expr,pars,vars]
creates a model using explicit parameters pars.
FormulaModel
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,…}].
- The following hyperparameters may be specified for this model:
-
"Formula" expr the symbolic formula - 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 - 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 - 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
Hyperparameters
Variables
Parameters
Properties
Examples
open all close allBasic Examples (4)
Specify a single-variable FormulaModel with one parameter:
FormulaModel[Sin[k x], {k}, x]Specify multiple parameters and variables:
FormulaModel[A Sin[k x] + b y, {A, k, b}, {x, y}]Specify a fixed parameter value:
f = FormulaModel[Sin[k x], {k -> π}, x]f[3.14]Plot[Evaluate@f[x], {x, -5, 5}]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:
points = {{1, 1}, {2, 0}, {2.5, -1}, {3, 0}};ModelFit[points, FormulaModel[Sin[k x + c], {k, c}, x]]Scope (15)
Hyperparameters (2)
Variables (2)
Parameters (3)
Define the model with a single parameter:
FormulaModel[Sin[k x], {k}, x]FormulaModel[A Sin[k x], {A, k}, x]Set a parameter to a fixed value:
FormulaModel[A Sin[k x], {A -> 2, k}, x]Specify a parameter to a initial value prior to fitting:
FormulaModel[A Sin[k x], {{A, 2}, k}, x]Evaluation (2)
Symbolically evaluate a single-variable model:
FormulaModel[A Sin[k x], {A, k}, x][x]Symbolically evaluate a two-variable model:
FormulaModel[A Sin[k x] + m y, {A -> 2, k, m}, {x, y}][{a, b}]Evaluate the model on multiple symbolic variables:
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:
FormulaModel[A Sin[k x], {A, k}, x][{{1.}, {2.}, {3.}}]Specify numeric parameters for a full evaluation:
FormulaModel[A Sin[k x], {A -> 2, k -> 3}, x][{{1.}, {2.}, {3.}}]Information (3)
View general information about a model:
Information[FormulaModel[A Sin[k x], {A, k}, x]]Get specific properties from the model:
Information[FormulaModel[A Sin[k x], {A, k}, x], "Variables"]Information[FormulaModel[A Sin[k x], {A, k}, x], {"Variables", "Parameters"}]Fitting (3)
Fit a FormulaModel to some data:
ModelFit[{...}, FormulaModel[a Exp[Cos[ω x]] + c, {a, ω, c}, x]]Specify initial values for some parameters:
ModelFit[{...}, FormulaModel[a Exp[Cos[ω x]] + c, {a, {ω, 2Pi}, c}, x]]Specify fixed values for some parameters:
ModelFit[{...}, FormulaModel[a Exp[Cos[ω x]] + c, {a, ω -> 2Pi, c}, x]]Related Guides
History
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: 12-June-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: 12-June-2026]}