MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: FindRoot vs Solve

  • To: mathgroup at smc.vnet.net
  • Subject: [mg22477] Re: [mg22427] FindRoot vs Solve
  • From: BobHanlon at aol.com
  • Date: Sat, 4 Mar 2000 02:26:42 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

eqn = (28. Cos[phi Degree] - 20. == 0);

Solve[eqn, phi]

Solve::"ifun": "Inverse functions are being used by \!\(Solve\), so some \
solutions may not be found."

{{phi -> -44.4153}, {phi -> 44.4153}}

FindRoot[eqn, {phi, 0.1, 0.1, 90.}]

FindRoot::"regex": "Reached the point \!\({96.71124978216424`}\) which is \
outside the region \!\({\({0.1`, 90.`}\)}\)."

{phi -> 96.7112}

FindRoot[lhs==rhs, {x, xstart, xmin, xmax}] searches for a solution, stopping 
the search if x ever gets outside the range xmin to xmax. As indicated by the 
FindRoot::regex message, the search went outside of the specified range. 
Consequently, the search stopped. The returned value is not the "solution" 
merely the value at the time that the search terminated.

You can either try a new starting value

FindRoot[eqn, {phi, 30., 0.1, 90.}]

{phi -> 44.4153}

or eliminate the restriction on the search region.

FindRoot[eqn, {phi, 0.1}]

{phi -> 44.4153}

Bob Hanlon

In a message dated 3/1/2000 2:06:22 AM, mitterma at linz.vai.co.at writes:

>Why is FindRoot not able to solve an equation using "Degree"? Solve can
>do
>it.
>
>In[]=
>
>Solve[28. Cos[phi Degree] - 20. == 0, phi]
>FindRoot[28. Cos[phi1 Degree] - 20. == 0, {phi1, 0.1, 0.1, 90.}]
>
>Out[]=
>
>{{phi->-44.4153},{phi->44.4153}}
>{phi1->96.7112}
>
>Only the following statement gives the right result:
>
>In[]=
>FindRoot[28. Cos[phi2] - 20. == 0, {phi2, 0.1, 0.1, 90.}]
>Out[]=
>{phi2->0.775193}
>

	by smc.vnet.net (8.8.8+Sun/8.8.8) with ESMTP id MAA25152
	for <mathgroup at smc.vnet.net>; Wed, 1 Mar 2000 12:24:44 -0500 (EST)
From: BobHanlon at aol.com
To: mathgroup at smc.vnet.net
	by imo16.mx.aol.com (mail_out_v25.3.) id k.77.1e1eb0f (1840);
	Wed, 1 Mar 2000 12:22:44 -0500 (EST)
Subject: [mg22477] Re: [mg22405] (no subject)

There is a standard package

Needs["Calculus`VectorAnalysis`"]

sphericalToCartesian = 
  Thread[Rule[{r, theta, phi}, 
      CoordinatesFromCartesian[{x, y, z}, Spherical]]]

{r -> Sqrt[x^2 + y^2 + z^2], 
  theta -> ArcCos[z/Sqrt[x^2 + y^2 + z^2]], 
  phi -> ArcTan[x, y]}

polarToCartesian = Drop[sphericalToCartesian /. z -> 0, {2}]

{r -> Sqrt[x^2 + y^2], phi -> ArcTan[x, y]}

cartesianToSpherical = 
  Thread[Rule[{x, y, z}, CoordinatesToCartesian[{r, theta, phi}, Spherical]]]

{x -> r*Cos[phi]*Sin[theta], y -> r*Sin[phi]*Sin[theta], 
  z -> r*Cos[theta]}

cartesianToPolar = Drop[cartesianToSpherical /. theta -> Pi/2, -1]

{x -> r*Cos[phi], y -> r*Sin[phi]}

Bob Hanlon

In a message dated 3/1/2000 1:53:32 AM, MAvalosJr at aol.com writes:

>Anyone know of a program that transforms Polar equations to Cartesian and
>
>visa versa? 
>


  • Prev by Date: Re: ListPlot with missing values
  • Next by Date: Impulsreconstruction
  • Previous by thread: Re: FindRoot vs Solve
  • Next by thread: Re: FindRoot vs Solve