Re: Manipulating Solution List from NDSolve

• To: mathgroup at smc.vnet.net
• Subject: [mg112764] Re: Manipulating Solution List from NDSolve
• From: blamm64 <blamm64 at charter.net>
• Date: Wed, 29 Sep 2010 04:16:41 -0400 (EDT)
• References: <i7seo7\$ppq\$1@smc.vnet.net> <i7shb6\$rmi\$1@smc.vnet.net>

```On Sep 28, 6:51 am, Albert Retey <a... at gmx-topmail.de> wrote:
> Am 28.09.2010 12:07, schrieb blamm64:
>
>
>
>
>
> > 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.
>
> setting as,bs,cs,... is relatively simple, if they are not yet having
> values:
>
> Evaluate[solList] = var /. sol[[1]]
>
> it is somewhat more complicated to clear the definitions once they have
> been made, and you have to do so for your second run. Here is one
> possibility:
>
> ReleaseHold[
>  Apply[Clear, Extract[OwnValues[solList], {1, 2}, Hold], {1}]
> ]
>
> hth,
>
> albert- Hide quoted text -
>
> - Show quoted text -

Thanks Albert,

You wouldn't believe all the things I tried ... on the right and side.
Anyway, many thanks.
Any ideas on how to create a list such as {as,bs,cs} from {a,b,c},
when neither has been evaluated?  That is a, b, and c are just symbols
as I would llike to create {as,bs,cs}, which would then be evaluated
as you explained above.
-Brian L.

```

• Prev by Date: Re: Defining a function using common notation for absolute value (not Abs[x])
• Next by Date: Re: Defining a function using common notation for absolute value (not Abs[x])
• Previous by thread: Re: Manipulating Solution List from NDSolve
• Next by thread: Re: Manipulating Solution List from NDSolve