15 Reputation

3 Badges

1 years, 357 days

MaplePrimes Activity

These are questions asked by ira044

I'm having a hard time trying to understand and use the various fitting functions.

For starters, if I copy and paste the code from the example on the Maple support Help page for NonlinearFit(), I'm not able to successfully execute the code. It gives the error:

Error, (in Statistics:-NonlinearFit) complex value encountered

I've attached my Maple file:


I've tried many combinations of assume(), simplify(), expand(), and evalc(), and I simply can't figure out how to make Maple evaluate my symbolic expression as a purely real valued expression. I know that my expression must be able to be expressed solely in real-valued terms since any number times its complex conjugate is real-valued. What function do I use to accomplish this? Thanks for your consideration. I've attached the code in question below.


v := 6000;

# Define the Fresnel reflection coefficient, rp
eta0 := 4; eta1 := n1+I*kappa1;
theta0 := (1/180)*ang*Pi; theta1 := arcsin(eta0*sin(theta0)/eta1);
xi0 := eta0*cos(theta0); xi1 := eta1*cos(theta1);
rp := (-eta0^2*xi1+eta1^2*xi0)/(eta0^2*xi1+eta1^2*xi0);

# Define the complex conjugate of the Fresnel reflection coefficient, rpCon
eta1Con := evalc(conjugate(eta1));
theta1Con := arcsin(eta0*sin(theta0)/eta1Con);
xi1Con := eta1Con*cos(theta1Con);
rpCon := (-eta0^2*xi1Con+eta1Con^2*xi0)/(eta0^2*xi1Con+eta1Con^2*xi0);

# Take the product of rp and its complex conjugate, rpCon. This should necessarily evaluate to a real-valued quantity.
prod := evalc(rp*rpCon);

Page 1 of 1