MathGroup Archive 2013

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

Search the Archive

Re: Newton-Raphson Root Finding, Difficulty in coding

  • To: mathgroup at smc.vnet.net
  • Subject: [mg131816] Re: Newton-Raphson Root Finding, Difficulty in coding
  • From: Murray Eisenberg <murray at math.umass.edu>
  • Date: Wed, 9 Oct 2013 22:10:47 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-outx@smc.vnet.net
  • Delivered-to: mathgroup-newsendx@smc.vnet.net
  • References: <20131009061159.57E046A24@smc.vnet.net>

As you've surmised, and as the docs suggest, FindRoot will locate only a 
single root at a time and for a single equation. To use it for your 
whole list of equations:

  FindRoot[v[[#]] == 0, {vi, 4}] & /@ Range[60]

I omitted the WorkingPrecision option: as the warning messages generated 
will suggest, you're going to have to play with that as well as 
PrecisionGoal, AccuracyGoal, and MaxIterations.

On Oct 9, 2013, at 2:11 AM, Cory <leahyc1 at apps.tcnj.edu> wrote:

> I need to use the Newton Raphson Method to find values of Specific 
Volume from the Van der Waal equation over a process of constant 
Temperature but variant Pressure.
>
> I've worked Mathematica to be able to spit out a list of however many 
iterations I want between the desired Pressure min and max (3.9 atm to 
59.2 atm).  Further, I am able to find the root of a single specified 
element in the list.  However, I am unable to figure out how to get the 
roots (Specific volumes) for all elements at once.
>
> For example:
>
> ----------------------------------------------------------
>
> FindRoot[v[[59]] == 0, {vi, 4}, WorkingPrecision -> 20]
>
> ----------------------------------------------------------
>
> will show vi, specific volume, for the 59th element in the list.
>
> I've tried the following, thinking this would work for multiple elements:
>
> ----------------------------------------------------------
>
> FindRoot[v[[1;;60]] == 0, {vi, 4}, WorkingPrecision -> 20]
>
> ----------------------------------------------------------
>
> However I receive an error. 
>
> "FindRoot::nveq: "The number of equations does not match the number of variables in FindRoot[v[[1;;60]]==0,{vi,4},WorkingPrecision->20].""
>
> This is my code:
>
> ----------------------------------------------------------
>
> a = 1.36;
> b = .003183;
> R = .0820578;
> T = 333;
> inc = (59.2 - 3.9)/60;
>
> v = Table[
>  vi - ((((atm) + (a/vi^2)) (vi - b) - (R*T))/((atm) - (a/
>         vi^2) + (2 a*b/vi^3))), {atm, 3.9, 59.2, inc}]
>
> FindRoot[v[[59]] == 0, {vi, 4}, WorkingPrecision -> 20]
>
> ---------------------------------------------------------
>
> Any help would be greatly appreciated!  Thanks
>

---
Murray Eisenberg                                    
murray at math.umass.edu
Mathematics & Statistics Dept.      
Lederle Graduate Research Tower           
University of Massachusetts 
710 North Pleasant Street  
Amherst, MA 01003-9305








  • Prev by Date: Re: Version 9 Trial contaminates Version 8 running paid version
  • Next by Date: Re: Newton-Raphson Root Finding, Difficulty in coding
  • Previous by thread: Newton-Raphson Root Finding, Difficulty in coding
  • Next by thread: Re: Newton-Raphson Root Finding, Difficulty in coding