MathGroup Archive 2013

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

Search the Archive

Newton-Raphson Root Finding, Difficulty in coding

  • To: mathgroup at smc.vnet.net
  • Subject: [mg131809] Newton-Raphson Root Finding, Difficulty in coding
  • From: Cory <leahyc1 at apps.tcnj.edu>
  • Date: Wed, 9 Oct 2013 02:11:59 -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

Hello

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



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