Hello again … now i am doing the job in my own program … now i did the imput to my problem, i think … i can not put my entire program here, i will put only the important part, and tell me what is going one …
optim.jl , the way i am using it, is not working … it is not giving the correct value of x[1] and x[2] ( remember, i want just one value of each to fit all my experimental values together ) – look the ### commented lines
in my program i have this 
function dΩ11(x,g,sigma,T)
R = 0.388/sigma # R in aRe
α = 0
ϕ = 0.9*(1-1/(1+(R/x[1])^x[2])) # x[1] and x[2] values here !!
θ = ϕ*exp(-α*g^2/T)
γ = 1
g^5*θ*Qb(g,α)*exp(-g^2/T) + g^5*(1-θ)*γ*Qa(g)*exp(-g^2/T) +
g^5*(1-θ)*(1-γ)*Qc(g)*exp(-g^2/T)
end
Ω11(x,sigma,T) = 1/T^3*quadgk(g-> dΩ11(x,g,sigma,T) ,0 , 10, abstol=1e-3)[1] # here is the integral the integral that # uses x[1] and x[2] calculated by the optim.jl
function X2(x)
aΩ11 = zeros( lenR )
for i in lenR
aΩ11[i] = afΩ11[i](x)
end
# sum((aΩ11-aΩ11e).^2)
sum(abs2,aΩ11-aΩ11e) # aΩ11 is the results of Ω11(x,sigma,T) for the array of R in aRe ( another name for R )
end
opt = optimize(X2, [2.5, 17.5],NelderMead(), Optim.Options(g_tol=1e-32)) # principal imput for optim.jl ... works, but give wrong results ..
println(Optim.minimizer(opt)) # gives the results of x[1] and x[2] ... ( wrong results ) - i did manually the best value for x[1] and x[2] under this conditions ... and i know the x[1] and x[2] values ... i just testing the program to get confiance
A_opt = Optim.minimum(opt) # i do not know what is it !! can you answer me ?
plot(aRe, aΩ11e) # plot my experimental points
plot(aRe, A_opt) # i wish this plots my calculated point using x[1] and x[2] , but is not work ... gives this error : PyError #(:PyObject_Call) <type 'exceptions.ValueError'>
#ValueError(u'x and y must have same first dimension, but have shapes (11,) and (1,)',)
aditional informations :slight_smile:
aRe = [1.28; 1.47; 1.65; 1.94; 2.25; 2.39; 2.68; 2.91; 3.13; 3.75; 4.46] # Array with experimental R
aΩ11e = [2.52; 2.26; 2.07; 1.92; 1.90; 2.08; 2.31; 2.53; 2.68; 2.51; 2.27] # Array with Ω11 experimental
aΩ11 = zeros(length(aRe)) # Array com os valores calculados com cada função afΩ11[i](sigma)
lenR = length(aRe)
i know it is not a working example anymore, but i need two things 
1 ) a best method to optmize this, and get the correct x[1] and x[2] ( i am already know what is ), maybe change the options or methods …
- how to plot the calculated points of omega11 using x[1] and x[2]