Re: basic issue with do and :=
- To: mathgroup at smc.vnet.net
- Subject: [mg60418] Re: basic issue with do and :=
- From: David Bailey <dave at Remove_Thisdbailey.co.uk>
- Date: Fri, 16 Sep 2005 03:48:57 -0400 (EDT)
- References: <dgbevg$fol$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
David wrote:
> Hi all,
>
> this works as (I) expected
>
> -------------------------
> Do[a[i] = i, {i, 10}]
> Do[b[i] =a[i]+1, {i, 10}]
> -------------------------
>
> While this doesn't:
>
> --------------------------
> Do[a[i] = i, {i, 10}]
> Do[b[i] :=a[i]+1, {i, 10}]
> ---------------------------
>
> [note ":=" instead of "=" on the second line].
>
> namely the output is: "b[2]:=a[i]+1" for all i
>
>
>
> Is there any compact way to define: "b[i] :=a[i]+1" for all i ?
>
>
> Thank you in advance,
>
> David
>
David,
I think it would help if you explained what problem you are trying to
solve. Remember, Mathematica is not a theorem prover (although you could
write one using it).
I would also advise you to try lots of examples from the book and maybe
even go on a course.
David Bailey
http://www.dbaileyconsultancy.co.uk