[Date Index]
[Thread Index]
[Author Index]
Re: Nonlinear Fit with complex model
*To*: mathgroup at smc.vnet.net
*Subject*: [mg19637] Re: Nonlinear Fit with complex model
*From*: "Kevin J. McCann" <kevinmccann at Home.com>
*Date*: Tue, 7 Sep 1999 00:28:35 -0400
*Organization*: @Home Network
*References*: <7qsfre$159@smc.vnet.net> <7qvttf$4nq@smc.vnet.net>
*Sender*: owner-wri-mathgroup at wolfram.com
Paul,
I noticed in the fragment you enclosed that upon execution the term in the
numerator:
deltaz(Es - I eta omega)
did not get magnitude squared as it should. I converted the original
expression to Normal form rather than Traditional and noted that this term
had square brackets, viz.
deltaz[Es - I eta omega]
seems that Mathematica got confused !?
Kevin
Paul Abbott <paul at physics.uwa.edu.au> wrote in message
news:7qvttf$4nq at smc.vnet.net...
> mtir at my-deja.com wrote:
>
> > Hi,
> >
> > I am trying to fit a data set of real values with
> > a model that involves complex numbers, i.e.
> > model[a,b,c,d]=Abs[<complex expression in
> > a,b,c,d>]^2
> >
> > When I am using NonlinearRegress (or
> > NonlinearFit) Mathematica complains that "One or
> > more derivatives of the model with respect to
> > parameters did not evaluate" and does not return a
> > result.
> >
> > I suspect that the reason for this is that Abs[],
> > Re[], Im[] etc. are not evaluated if the argument
> > is an expression rather than a number.
> >
> > Does anyone know a way round this?
> >
> > Thanks!
> > Sebastian
> >
> > (For those interested: I am trying to calculate
> > the complex refractive index of a thin film from
> > reflectance measurements as a function of angle)
>
> In the Notebook fragment below, I show a simple trick for computing the
> complex conjugate of complex expressions with real variables. The basic
>
> idea is to compute the conjugate using the replacement
>
> Complex[a_, b_] :> Complex[a, -b]
>
> actually implemented using the built-in SuperStar function (so that you
> can compute conjugates by raising them to the power *):
>
> SuperStar[x_] := x /. Complex[a_, b_] :> Complex[a, -b]
>
> The point then is that Abs[z]^2 = SuperStar[z] z which enables you to
> quickly and efficiently compute the type of expression you want.
>
> Notebook[{
> Cell[BoxData[
> \(TraditionalForm
> \`\(exp =
> \(b0\ \[CapitalDelta]z\
> \((Es - \[ImaginaryI]\ \[Eta]\ \[Omega])\)\)\/\(\(-m\)\
> \[Omega]\^2 + m\ \[Omega] -
> \[ImaginaryI]\ m\ \[Gamma]\ \[Omega] +
> b0\ \((Es - \[ImaginaryI]\ \[Eta]\ \[Omega])\)\); \)\)],
> "Input"],
>
> Cell[BoxData[
> \(TraditionalForm
> \`\(x_\^*\) := x /. Complex(a_, b_) \[RuleDelayed] Complex(a,
> \(-b\))\)],
> "Input"],
>
> Cell[CellGroupData[{
>
> Cell[BoxData[
> \(TraditionalForm\`\(\(exp\^*\) exp // ExpandAll\) // Simplify\)],
> "Input"],
>
> Cell[BoxData[
> \(TraditionalForm
> \`\(b0\^2\ \[CapitalDelta]z\^2\
> \((Es\^2 + \[Eta]\^2\ \[Omega]\^2)
> \)\)\/\(\((Es\^2 + \[Eta]\^2\ \[Omega]\^2)\)\ b0\^2 +
> 2\ m\ \[Omega]\
> \((\(-\[Omega]\)\ Es + Es + \[Gamma]\ \[Eta]\ \[Omega])\)\ b0
> +
> m\^2\ \((\[Gamma]\^2 + \((\[Omega] - 1)\)\^2)\)\
> \[Omega]\^2\)\)],
> "Output"]
> }, Open ]]
> }
> ]
>
> ____________________________________________________________________
> Paul Abbott Phone: +61-8-9380-2734
> Department of Physics Fax: +61-8-9380-1014
> The University of Western Australia
> Nedlands WA 6907 mailto:paul at physics.uwa.edu.au
> AUSTRALIA http://physics.uwa.edu.au/~paul
>
> God IS a weakly left-handed dice player
> ____________________________________________________________________
>
>
>
Prev by Date:
**Re: Re: Multiple sum with iterators that cannot equal**
Next by Date:
**Re: How to NDSolve the differential equation**
Previous by thread:
**Re: Nonlinear Fit with complex model**
Next by thread:
**FindMinimum to minimize e . w . e**
| |