From: SourceForge.net <no...@so...> - 2010-12-03 20:03:32
|
Bugs item #3123933, was opened at 2010-11-30 23:29 Message generated for change (Comment added) made by crategus You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=3123933&group_id=4933 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Lisp Core - Solving equations Group: None >Status: Pending >Resolution: Works For Me Priority: 5 Private: No Submitted By: quwerty (doe140) Assigned to: Nobody/Anonymous (nobody) Summary: Incorrect solution to equation Initial Comment: I have the foolowing code: c:3e+8$ mu_r1:1$ mu_r2:1$ sigma_1:0$ sigma_2:0$ eps_r1:3.3$ eps_r2:1.6$ h:1e-6$ f:180e+12$ P2:0.01e-3$ eps_0:8.85e-12$ mu_0:4*%pi*1e-7$ eps_a1:eps_r1*eps_0$ eps_a2:eps_r2*eps_0$ mu_a1:mu_0*mu_r1$ mu_a2:mu_0*mu_r2$ omega:2*%pi*f$ /* [wxMaxima: input end ] */ /* [wxMaxima: input start ] */ kill(x, y)$ x:find_root(sqrt(omega^2*h^2*(eps_a1*mu_a1-eps_a2*mu_a2)-x^2)+eps_a2/eps_a1*x*tan(x)=0, x, 0, 5); y:float(sqrt(omega^2*h^2*(eps_a1*mu_a1-eps_a2*mu_a2)-%^2)); y1:float(-eps_a2/eps_a1*x*tan(x))$ With these limits y!=y1. If I run x:find_root(..., x, 1.7, 2); I get correct answer. This seems a little strange. May this be of tan(x)'s behaviour at x=%pi/2? ---------------------------------------------------------------------- >Comment By: Dieter Kaiser (crategus) Date: 2010-12-03 21:03 Message: At first, it is very helpful to have a small example. I think the function of interest for this example is eqn: 0.4848484848484849*x*tan(x)+sqrt(0.7799327999999998*%pi^3-x^2) One important and documented restriction of the algorithm of find_root is, that the function has to be continuous over the interval, which is given as an argument to find_root. If I do a plot of the function for the interval [0,5] with the command plot2d(eqn,[x,0,5],[y,-100,100]) I can see that the function is not continuous at two points and that the function has one root. Furthermore, the root is near the value 1.75. If I take the function of this example and the interval [1.6,2.0] I get the desired root: (%i1) eqn:.4848484848484849*x*tan(x)+sqrt(.7799327999999998*%pi^3-x^2); (%o1) .4848484848484849*x*tan(x)+sqrt(.7799327999999998*%pi^3-x^2) This is the root of the equation: (%i2) result:find_root(eqn,x,1.6,2); (%o2) 1.753812411159384 Backsubstitution shows that the result is a root within an expected accuracy (%i3) float(subst(result,x,eqn)); (%o3) -1.77635683940025e-15 The algorithm of find_root fails in the interval [0,5] because the function is not continuous over the interval. I think we do not have a bug. The numerical routine find_root has documented limitations. Setting the status to pending and the resolution to "works for me". Dieter Kaiser ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=3123933&group_id=4933 |