problems with FindRoot: what worked with 4.2 does not work with 5.0
- To: mathgroup at smc.vnet.net
- Subject: [mg47356] problems with FindRoot: what worked with 4.2 does not work with 5.0
- From: "Edgar Dachs" <edgar.dachs at sbg.ac.at>
- Date: Tue, 6 Apr 2004 06:36:54 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
I have written a Mathematica program called PET (Petrological elementary tools) for Mathematica (Dachs, 1998, Computers & Geosciences, 24/3: 219-235) und worked out a new version that I tested with Mathematica version 4.2. With 5.0, I now find problems that several of my functions do not work any more, obviously do to changes that have been employed between 4.2 and 5.0 concerning FindRoot. Below is a little test-function that illustrates the problem: the return-value of the function depends on the value of x, as in the much more complex petrological functions that I have written, where calculations depend e.g. on the value of the temperature. test[x_] := Module[{y}, If[x > 0, y = x + 1]; If[x <= 0, y = x - 1]; Return[y] ] With 4.2 FindRoot (using two startin values for x) could have been used to solve for a special value, e.g. FindRoot[test[x] == 5, {x, {8, 9}}] with the obvious result: {x -> 4.} With 5.0 the call FindRoot[test[x] == 5, {x, 9}] (only one starting value can be specified with 5.0) yields the error message: FindRoot::nlnum "the function value {..} is not a list of numbers with dimension {1} at {x} = {9} I would be grateful if someone could help me solving this problem, at the moment I don't know what to do, but it looks like a compatibility problem between Mathematica versions 4.2 and 5.0. Thanks in advance, Dr. Edgar Dachs Department of Mineralogy University Salzburg Austria
- Follow-Ups:
- Re: problems with FindRoot: what worked with 4.2 does not work with 5.0
- From: Gerry Flanagan <flanagan@materials-sciences.com>
- Re: problems with FindRoot: what worked with 4.2 does not work with 5.0