MathGroup Archive 2013

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

Search the Archive

Re: Not-understandable warning

  • To: mathgroup at smc.vnet.net
  • Subject: [mg130397] Re: Not-understandable warning
  • From: Bob Hanlon <hanlonr357 at gmail.com>
  • Date: Mon, 8 Apr 2013 00:06:57 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net
  • References: <20130407015306.AC8EC6AC8@smc.vnet.net>

$Version

9.0 for Mac OS X x86 (64-bit) (January 24, 2013)

mat = SparseArray[
    {{i_, i_} -> 1}, {4, 4}]

SparseArray[<4>, {4, 4}]


mat2 = SparseArray[
    Table[{i, i} -> 1, {i, 4}]]

SparseArray[<4>, {4, 4}]


mat3 = IdentityMatrix[4]//
    SparseArray

SparseArray[<4>, {4, 4}]


mat == mat2 == mat3 == IdentityMatrix[4]

True


Bob Hanlon


On Sat, Apr 6, 2013 at 9:53 PM, <JikaiRF at aol.com> wrote:

> Dear members:
>
> I have a difficulty to understand programming in Mathematica.
>
> I input the following, based on a textbook titled ``Programming with
> Mathematica: An Introduction" by Paul Wellin, which is published by
> Cambridge University Press.
>
> mat = SparseArray[{i_, i_} \[RightArrow] 1, {4, 4}]
>
> Then, I received an answer as
>
>    SparseArray[{i_, i_} \[RightArrow] 1, {4, 4}]
>
> with a warning as
>
>   `` SparseArray::list: "List expected at position 1 in SparseArray[{i_,
> i_} \[RightArrow] 1, {4, 4}]".
>
> In this textbook, on page 32, there appears a correct answer as follows:
>
> SparseArray[<4>, {4,4}].
>
> Why my Mathematica cannot understand my input?
>
> By the way, I use Mathematica 8.0.4.0 version and Mac OS 10.5.8.
>
>      Sincerely,
>       Fujio Takata.
>
>
>
>
>
>
>


  • Prev by Date: Re: Testing a random integer generator
  • Next by Date: Re: Simplify an expression with respect to one of many
  • Previous by thread: Not-understandable warning
  • Next by thread: Re: Not-understandable warning