Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #16037
| From | Murray Eisenberg <murray@math.umass.edu> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Newton-Raphson Root Finding, Difficulty in coding |
| Date | 2013-10-10 02:05 +0000 |
| Message-ID | <l35212$a6s$1@smc.vnet.net> (permalink) |
| References | <20131009061159.57E046A24@smc.vnet.net> |
| Organization | Time-Warner Telecom |
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@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@math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower
University of Massachusetts
710 North Pleasant Street
Amherst, MA 01003-9305
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Re: Newton-Raphson Root Finding, Difficulty in coding Murray Eisenberg <murray@math.umass.edu> - 2013-10-10 02:05 +0000
csiph-web