Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #16029

Newton-Raphson Root Finding, Difficulty in coding

From Cory <leahyc1@apps.tcnj.edu>
Newsgroups comp.soft-sys.math.mathematica
Subject Newton-Raphson Root Finding, Difficulty in coding
Date 2013-10-09 06:02 +0000
Message-ID <l32ri7$540$1@smc.vnet.net> (permalink)
Organization Time-Warner Telecom

Show all headers | View raw


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

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Newton-Raphson Root Finding, Difficulty in coding Cory <leahyc1@apps.tcnj.edu> - 2013-10-09 06:02 +0000

csiph-web