Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

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

Search the Archive

Manipulating Solution List from NDSolve

  • To: mathgroup at smc.vnet.net
  • Subject: [mg112718] Manipulating Solution List from NDSolve
  • From: blamm64 <blamm64 at charter.net>
  • Date: Tue, 28 Sep 2010 06:04:21 -0400 (EDT)

Hi,

Given:

var = {a, b, c} (variables input to NDSolve)

and the output solution list

sol = {{a -> 1, b -> 2, c -> 3}}

(I'm just using 1, 2, and 3 instead of InterpolatingFunction).

Do the following:
I would like to create a list, say "solList" that is

solList = {as,bs,cs}

using the list var, instead of typing it out by hand.

Next, with solList in hand, I would like to end up with the equivalent
to

{as=1,bs=2,cs=3}.

but using only solList, var, and sol lists.

All that is equivalent to doing

{as,bs,cs} = var /. sol[[1]] .

But I would like to avoid typing it all out by hand because the actual
list var is a lot longer.

With solList in hand and doing

solList = var /. sol[[1]]

of course does not work.

I created a notebook and defined

var = {a,b,c};
sol = {{a -> 1, b -> 2, c -> 3}};
solList = {as, bs, cs}

(giving up on trying to create solList using var), and started trying
different methods, all failing to get the equivalent of

{as,bs,cs} = var /. sol[[1]] .

without typing it all in by hand.

I have a notebook wherein several different cases can be submitted to
NDSolve, and it's quite tiresome to readjust the post-processing I'm
performing depending on which case is run.  The length as well as some
of the elements of list var change from one case to the next.

Thanks to all, (once again!)

-Brian L.


  • Prev by Date: Re: How do I test for existence of a list element?
  • Next by Date: Re: Mathematica calculates RSquared wrongly?
  • Previous by thread: Re: Defining a function using common notation for absolute value (not Abs[x])
  • Next by thread: Re: Manipulating Solution List from NDSolve