Help with FindRoot

• To: mathgroup at smc.vnet.net
• Subject: [mg100840] Help with FindRoot
• From: "versianeleao at gmail.com" <versianeleao at gmail.com>
• Date: Tue, 16 Jun 2009 21:49:19 -0400 (EDT)

```Deal All

I would like some help again since I=B4m stuck with this code. I=B4m
trying to fit a series of data "Fa" using FindMinimum but the sistem
must solve an equation "eq == 0, {y, 1}".  I=B4m trying FindRoot to do
so, but it is not working. For "n = 2" for instance, NSolve works, but
I need n to vary and need to use FindRoot but  it seems I=B4m doing
something wrong. Can anyone help?

Directory[]
ClearAll[cilas, x, gama, \[Alpha], \[Beta], j, i, b, p, \[Sigma], \
\[Mu], cilas1, modelo, ajuste, l, l1, z, z1, log\[Sigma], dados, \
lognormal, \[Mu]1, d2, \[Mu]2, \[Sigma]1, \[Sigma]2, a, Dp, Dmax,
krn, t, X, extra=E7=E3o, eq, k1, k2, k3, Fa, deriv, R0, \[Rho], zeta, \
kRQ, Deff, n, \[Theta], argumento2, ajuste2, dados]
R0 = Sqrt[45*37]/2./10^6
\[Rho] = 2.5
ConNaOH = 6000.
extra=E7=E3o =
ReadList["silicato NaOH-80oC.txt", Number, RecordLists -> True];
pontos = ListPlot[extra=E7=E3o, PlotStyle -> PointSize[0.012]]
X[t_] = k1*t^2 + k2*t + k3
ajuste1 =
Sum[(X[extra=E7=E3o[[i, 1]]] - extra=E7=E3o[[i, 2]])^2, {i, 1,
Length[extra=E7=E3o]}];
d1 = FindMinimum[ajuste1, {k1, k2, k3}]
{minimo1, argumento1} = d1
argumento1
XE = X[t] /. argumento1
extra=E7=E3o1 = extra=E7=E3o
deriv = D[XE, t]
For[j = 1, j <= Length[extra=E7=E3o], j++,
extra=E7=E3o1[[j, 2]] = XE /. t -> extra=E7=E3o[[j, 1]]]
modelo1 =
ListPlot[extra=E7=E3o1, PlotStyle -> PointSize[0.015], Joined -> True]
Show[pontos, modelo1]
F = Fa = extra=E7=E3o;
For[j = 1, j <= Length[extra=E7=E3o], j++,
Fa[[j, 2]] = (-(4/3))*Pi*R0^3*\[Rho]*deriv /. t -> extra=E7=E3o[[j, 1]]]
Print[Fa]
alfa := Table[0, {i, 1, Length[extra=E7=E3o]}]
\[Alpha]1 =
Table[(1 - extra=E7=E3o[[i, 2]])^(2/3), {i, 1, Length[extra=E7=E3o]}]
\[Alpha]2 =
Table[(1 - extra=E7=E3o[[i, 2]])^(1/3), {i, 1, Length[extra=E7=E3o]}]
dados = Table[Fa[[i, 2]], {i, 1, Length[extra=E7=E3o]}]
eq = Simplify[y/(4*Pi*kRQ*\[Alpha]1[[i]]) + (ConNaOH + y/(4*Pi*Deff*\
[Alpha]2[[i]]))^n]
\[Sigma] = Table[FindRoot[eq == 0, {y, 1}], {i, 1, Length[extra=E7=E3=
o]}];
alfa1 = y /. \[Sigma]
ajuste2 =
Sum[(alfa1[[i, 1]] - dados[[i]])^2, {i, 1, Length[extra=E7=E3o]}];
d2 = FindMinimum[ajuste2, {kRQ, 1}, {Deff, 2}, {n, 2}]

```

• Prev by Date: Re: Re: Re: Extracting contour values from
• Next by Date: Re: Extracting contour values from ContourPlot
• Previous by thread: Re: Continuous updating in Manipulate
• Next by thread: Huge wide plot placing into a pane