Hot answers tagged function-style
10
As described by Andy Ross in a comment, you can make a definition that preprocesses the argument(s) into a canonical form. Turning his example around simply to illustrate flexibility:
f[{args__}] := f[args]
f[args__] := Multinomial[args] / Plus[args]
f[{12, 7, 3}] == f[12, 7, 3]
True
This method is useful for more complicated preprocessing, but in ...
7
There are many ways to handle this. The approach I would most likely take can be illustrated by the following example:
f[seqn : ___] := Module[{args = {seqn}},
Switch[args,
{{___}}, "List of args",
{_}, "One arg",
{_, __}, "Two or more args",
{}, "No args"
]]
f[{x, y, z}]
(* ==> "List of args" *)
f[{x}]
(* ==> ...
4
Suppose your data is formatted as following:
data = Table[{x[t], y[t]}, {t, 0, 1, .2}]
{{x[0.], y[0.]}, {x[0.2], y[0.2]}, {x[0.4], y[0.4]}, {x[0.6], y[0.6]}, {x[0.8], y[0.8]}, {x[1.], y[1.]}}
You can use this symbolic "data" to peep into the FindFit to see what does the NormFunction take as its argument (as J.M. said (and the documentation), it's the ...
Only top voted, non community-wiki answers of a minimum length are eligible
