Re: Convert from String to variable

• To: mathgroup at smc.vnet.net
• Subject: [mg70246] Re: [mg70229] Convert from String to variable
• From: "Peng Yu" <pengyu.ut at gmail.com>
• Date: Mon, 9 Oct 2006 01:56:02 -0400 (EDT)
• References: <200610080604.CAA11869@smc.vnet.net> <NDBBJGNHKLMPLILOIPPOAECNFDAA.djmp@earthlink.net>

```On 10/8/06, David Park <djmp at earthlink.net> wrote:
> Peng,
>
> Just use Symbol.
>
> Symbol["a" <> ToString[1] <> ToString[2] <> ToString[3]]
> Head[%]
> a123
> Symbol

What I really intent to define is a function like the following. l, m
and n could go from 0 to any positive integer. Here the parameter list
of CD should also be changed correspondingly.

CD[Ith_, z_, d_, Ith0_, a000_, a001_, a002_, a010_, a011_, a012_, a020_,
a021_, a022_, a100_, a101_, a102_, a110_, a111_, a112_, a120_, a121_,
a122_, a200_, a201_, a202_, a210_, a211_, a212_, a220_, a221_, a222_] :=
Sum[ToExpression["a" <> ToString[l] <> ToString[m] <> ToString[n]]*(
Ith - Ith0)^l*z^(2*m)*d^(n), {l, 0, 2}, {m, 0, 2}, {n, 0, 2}]

I tried this, but it is not working. The difficulty is in the left
hand side. Can I write a function to define a set of other functions?

CD[Ith_, z_, d_, Ith0_, Flatten@
Table[ToExpression["a" <> ToString[l] <> ToString[m] <> ToString[n] <>
"_"], {l, 0, 2}, {m, 0, 2}, {n, 0, 2}]] := Sum[ToExpression["a" <>
ToString[l] <> ToString[m] <> ToString[n]]*(Ith - Ith0)^l*z^(
2*m)*d^(n), {l, 0, 2}, {m, 0, 2}, {n, 0, 2}]

```

• Prev by Date: a simple product, but with "i = 1...n AND i != x"
• Next by Date: RE: Convert from String to variable
• Previous by thread: Convert from String to variable
• Next by thread: Re: Convert from String to variable