@@ -197,11 +197,46 @@ struct CurvefitCache{
197197end
198198
199199"""
200- Curvefit(u, t, m, p0, alg; extrapolate = false, ub = nothing, lb = nothing)
200+ Curvefit(
201+ u, t, model, p0, alg, box = false, lb = nothing, ub = nothing;
202+ extrapolate = false
203+ ) -> CurvefitCache
201204
202- Construct an interpolation by fitting the model `m(t, p)` to data values `u` at
203- timepoints `t`, using `p0` as the initial parameter guess and `alg` as the
204- optimization algorithm.
205+ Fit `model(t, p)` to data values `u` at sample locations `t` with Optim.jl and return the
206+ resulting callable interpolation. The returned interpolation evaluates `model` with the
207+ optimized parameters available as its `pmin` field.
208+
209+ # Arguments
210+
211+ - `u`: observed scalar data values.
212+ - `t`: sample locations corresponding to `u`.
213+ - `model`: callable with signature `model(t, p)`, where `p` is a parameter vector.
214+ - `p0`: initial parameter vector supplied to Optim.jl.
215+ - `alg`: Optim.jl optimization algorithm, such as `LBFGS()`.
216+ - `box::Bool = false`: use boxed optimization when `true`; both bounds must then be given.
217+ - `lb = nothing`: lower parameter bounds used when `box` is `true`.
218+ - `ub = nothing`: upper parameter bounds used when `box` is `true`.
219+
220+ # Keywords
221+
222+ - `extrapolate::Bool = false`: permit evaluation outside the range of `t`. When `false`,
223+ out-of-range evaluation throws `ExtrapolationError`.
224+
225+ # Returns
226+
227+ - `CurvefitCache`: a callable fitted interpolation. Its `pmin` field contains the optimized
228+ parameter vector.
229+
230+ # Examples
231+
232+ ```julia
233+ using DataInterpolations, Optim
234+
235+ model(t, p) = p[1] .* t .+ p[2]
236+ A = Curvefit([1.0, 3.0, 5.0], [0.0, 1.0, 2.0], model, [0.0, 0.0], LBFGS())
237+
238+ A(1.5)
239+ ```
205240"""
206241function Curvefit ()
207242 error (" CurveFit requires loading Optim and ForwardDiff, e.g. `using Optim, ForwardDiff`" )
0 commit comments