Hello,

Here below is a more complete code with the data.

Also, remember I use **MAPLE 14**.

Sincerely yours

Jacqr

#####################################################

restart:with(plots):with(Statistics):with(ArrayTools):

#

Dens := proc(v)

local theta, r;

evalf[8](

Int(Int(

4*r/(1-0.84*cos(theta)^2)^(1/2)*exp(-r*(6.25-5.245*cos(theta)^2)^(1/2))

, theta = 0.0.. 2*Pi)

, r = 0. .. v)

) assuming v>=0

end proc;

proc(v) ... end;

a:=1.4:b:=.13:

#

depth:=[.033, .099, 0.198, 0.264, 0.363, 0.759, 1.25, 1.748, 2.246, 2.744, 3.232, 3.73]:

veloc:=[0.180, 0.25, 0.296, 0.324, 0.516, 0.606, 0.757, 0.760, 0.784, 0.804, 0.794, 0.790]:

veloc_errors:=[0.20, 0.15, 0.15, 0.170, 0.150, 0.10, 0.05, 0.05, 0.02,0.02, 0.02, 0.03]:

#

plot_veloc_sim:=plot( b*(1+a*u)/u*Dens( u/(1+a*u) ) , u = 0.0..4.0,color=["Blue"]):

plot_veloc := ErrorPlot(veloc, xcoords = depth, yerrors = veloc_errors):

display({plot_veloc_sim,plot_veloc});

#

FitFinalDens := NonlinearFit(

b*(1+a*u)/u*Dens(u/(1+a*u))

, depth

, veloc

, [u]

, initialvalues = [a = 1.4, b = 0.13]

, parameternames = [a, b]

, output = [leastsquaresfunction, residuals, parametervector]

, parameterranges=[a=1.1..3.0,b=0.02..0.8]

);

#

a= FitFinalDens[3][1];

b= FitFinalDens[3][2];

#

Error, (in Statistics:-NonlinearFit) invalid input: no implementation of NonlinearFit matches the arguments in call, 'NonlinearFit(.13*(1+1.4*u)*(Int(Int(4.*r*exp(-1.*r*(6.25-5.245*cos(theta)^2)^(1/2))/(1.-.84*cos(theta)^2)^(1/2), theta = 0. .. 6.2831854), r = 0. .. u/(1.+1.4*u)))/u, op(w), [u], initialvalues = [1.4 = 1.4, .13 = .13], parameternames = [1.4, .13], output = [leastsquaresfunction, residuals, parametervector], parameterranges = [1.4 = 1.1 .. 3.0, .13 = 0.2e-1 .. .8])'

1.4 = FitFinalDens[3][1]

0.13 = FitFinalDens[3][2]

#####################################################

**Also, I tried to run the file*** **dataFit.mw**,* and I obtained:

#####################################################

restart;

with(Statistics):

#

# Define a "useful" procedure

#

Dens := proc(v)

local theta, r;

evalf[8]

( Int

( Int

( 4*r/(1-0.84*cos(theta)^2)^(1/2)*exp(-r*(6.25-5.245*cos(theta)^2)^(1/2)),

theta = 0. .. 2*Pi

),

r = 0. .. v

)

) assuming v>=0

end proc:

#

# OP too inefficient to provide data for fit, so generate

# data using the model function, adding a random value to

# the dependent values. Use parameter values aPar=2.5, and

# bPar=0.75, just because I have to use something, and these

# are in the within the ranges specified by the OP.

#

# The fit process therefore *ought* to return something

# *close* to these values

#

aPar:= 2.5:

bPar:= 0.75:

r:= rand(-0.1..0.1);

depth:= [i $ i=1..10]:

veloc:= [ seq

( bPar*(1+aPar*k)/k*Dens(k/(1+aPar*k))+r(k),

k in depth

)

]:

Error, invalid input: rand expects its 1st argument, r, to be of type {posint, integer .. integer}, but received -.1 .. .1

#

# Set up and perform the fit

#

f:= (z, aVal, bVal)-> bVal*(1+aVal*z)/z*Dens(z/(1+aVal*z)):

FitFinalDens := NonlinearFit

( f(u,a,b),

depth,

veloc,

u,

initialvalues = [a = 1.4, b = 0.13],

parameternames = [a, b],

output = [residuals, parametervector],

parameterranges=[a=1.1..3.0, b=0.02..0.8]

);

Error, (in Statistics:-NonlinearFit) invalid input: no implementation of NonlinearFit matches the arguments in call, 'NonlinearFit(b*(1+a*u)*(Int(Int(4.*r*exp(-1.*r*(6.25-5.245*cos(theta)^2)^(1/2))/(1.-.84*cos(theta)^2)^(1/2), theta = 0. .. 6.2831854), r = 0. .. u/(1.+a*u)))/u, w[() .. (), 1 .. -2], w[() .. (), -1], (b*(1+a*u)*(Int(Int(4.*r*exp(-1.*r*(6.25-5.245*cos(theta)^2)^(1/2))/(1.-.84*cos(theta)^2)^(1/2), theta = 0. .. 6.2831854), r = 0. .. u/(1.+a*u)))/u, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [2.979399150+r(), 3.310608375+r(), 3.436306050+r(), 3.502378069+r(), 3.543099368+r(), 3.570706800+r(), 3.590655155+r(), 3.605742591+r(), 3.617552791+...

#

# Plot the data used and the fit achieved

#

dataPoints:= plots:-pointplot( depth,

veloc,

symbol=solidcircle,

symbolsize=20

):

fitCurve:= plot( z-> f( z,

FitFinalDens[2][1],

FitFinalDens[2][2]

),

1..10

):

plots:-display( [ dataPoints,

fitCurve

]

);

Error, (in plots:-pointplot) points cannot be converted to floating-point values

Warning, unable to evaluate the function to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct

Error, (in plots:-display) expecting plot structures but received: [dataPoints]

#####################################################