Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: Re: Re: Language vs. Library

  • To: mathgroup at smc.vnet.net
  • Subject: [mg61260] Re: [mg61236] Re: Re: Language vs. Library
  • From: Sseziwa Mukasa <mukasa at jeol.com>
  • Date: Fri, 14 Oct 2005 05:53:52 -0400 (EDT)
  • References: <dii8o0$9cc$1@smc.vnet.net> <200510130539.BAA04590@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

On Oct 13, 2005, at 1:39 AM, Steven T. Hatton wrote:

> Try this:
>
> A = Array[a (10#1 + #2) &, {3, 3}]
> v = {x, y, z}
> A.v // MatrixForm
> Clear[A,v];
> A = Array[a (10#1 + #2) &, {3, 3}] // MatrixForm
> v = {x, y, z} // MatrixForm
> A.v
>
> Why are the results different?

MatrixForm is a wrapper which affects display but otherwise doesn't  
change results.  The expression A = Array[a (10#1 + #2) &, {3, 3}] //  
MatrixForm puts a head of MatrixForm on A so whenever A is displayed  
it will be as a matrix rather than a list, likewise with the second  
expression for v.  Taking two expressions with the head MatrixForm  
and forming their inner product, as the second A.v does, results in  
another expression with the head MatrixForm.

>
> Explain this:
>
> Clear[a, i]
> a[i] = eye;

You have associated the value eye with the symbol a[i]

> i = 3;

You have associated the value 3 with i

> a[3] = three;

You have associated three with a[3]

> Print["a[i]=", a[i]]

Since at this moment i evaluates to 3 this is equivalent the Print["a 
[i]=",a[3]] and from the line above we know that a[3] is three so  
this becomes Print["a[i]=",three] with the expected final result.

> Clear[i];

This dissociates i from the value 3, i's value is now i.

> Print["a[i]=", a[i]]

 From the first line we know that a[i]=eye so as with the previous  
Print statement the result is unsurprising.

I am not sure what is supposed to be demonstrated here.

Regards,

Ssezi


  • Prev by Date: Re: Language vs. Library
  • Next by Date: Re: No visualisation of unmatched brackets anymore
  • Previous by thread: Re: Re: Re: Language vs. Library
  • Next by thread: Re: Re: Re: Language vs. Library