Actually this might be a bug. I really don't understand this behavior
(latest 0.3.0-rc3):
feldt:~/tmp$ julia03
_
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: http://docs.julialang.org
_ _ _| |_ __ _ | Type "help()" for help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.3.0-rc3 (2014-08-10 02:54 UTC)
_/ |\__'_|_|_|\__'_| | Official http://julialang.org/ release
|__/ | x86_64-apple-darwin13.3.0
julia> -0.11292333772901704 ^ 1.0000060554544523
-0.11292184633488864
julia> x = -0.11292333772901704
-0.11292333772901704
julia> p = 1.0000060554544523
1.0000060554544523
julia> x ^ p
ERROR: DomainError
in ^ at math.jl:252
Den tisdagen den 12:e augusti 2014 kl. 14:04:58 UTC+2 skrev Robert Feldt:
>
> Can LsqFit.jl be used to fit multivariate model? I tried this but must
> have missed something (maybe xv and Y need to have same length?):
>
> using LsqFit
>
> # We want to try to use curve_fit to fit the parameters of this
> multivariate model:
> mvmodel(x, p) = begin
> p[1] .* ((x[1,:] .^ p[2]) ./ (x[2,:] .^ p[3]))
> end
> N = 10
> M = 2
> X = randn(M, N)
> Params = [1.0, 2.0, 2.0] # Actual params that we are looking for
>
> # Dependent var with small error term
> Y = mvmodel(X, Params)[:] + 0.01*randn(N)
>
> # We need a vector to submit to curve_fit:
> xv = X[:]
>
> # Reshape to get back the original matrix.
> orig_matrix(xv, M) = reshape(xv, (M, int(length(xv)/M)))
>
> # The model function we supply to curve_fit needs to take a vector...
> model(xv, p) = mvmodel(orig_matrix(xv, M), p)
>
> fit = curve_fit(model, xv, Y, [0.5, 0.5, 0.5])
>
>
> Den måndagen den 14:e juli 2014 kl. 20:10:02 UTC+2 skrev Blake Johnson:
>>
>> The curve fitting functionality in Optim.jl is being moved into its own
>> package: LsqFit.jl:
>>
>> https://github.com/JuliaOpt/LsqFit.jl
>>
>> Installable via Pkg.add("LsqFit").
>>
>