MathGroup Archive 2010

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

Search the Archive

Re: Function construction and also symmetric matrices

  • To: mathgroup at smc.vnet.net
  • Subject: [mg108568] Re: Function construction and also symmetric matrices
  • From: "Diamond, Mark" <dot at dot.dot>
  • Date: Wed, 24 Mar 2010 04:40:00 -0500 (EST)
  • References: <hnva64$88k$1@smc.vnet.net> <hnvo3m$egu$1@smc.vnet.net> <ho76uf$sm$1@smc.vnet.net>

Brilliant. Thank you, both Raffy and Ray.


"Ray Koopman" <koopman at sfu.ca> wrote in message 
news:ho76uf$sm$1 at smc.vnet.net...
> On Mar 20, 12:46 am, "Diamond, Mark" <d... at dot.dot> wrote:
>> Thank you Ray.
>>
>> Have you any thoughts about the second question?
>>
>> Cheers,
>> Mark
>
> In[1]:=
> makesymat[n_] := ToExpression["symat[" <> ToString@n <> "] :=
> Function[" <> ToString@Table[
> Which[i > j, SequenceForm["#[[",(i-1)(i-2)/2 + j,"]]"],
>      i < j, SequenceForm["#[[",(j-1)(j-2)/2 + i,"]]"],
>      True,  "1"], {i,n},{j,n}] <> "]" ]
>
> In[2]:= makesymat[4]
>
> In[3]:= ?symat
>
> Global`symat
>
> symat[4] := {{1, #1[[1]], #1[[2]], #1[[4]]},
>             {#1[[1]], 1, #1[[3]], #1[[5]]},
>             {#1[[2]], #1[[3]], 1, #1[[6]]},
>             {#1[[4]], #1[[5]], #1[[6]], 1}} &
>
> In[4]:= symat[4]@{a,b,c,d,e,f}
>
> Out[4]= {{1, a, b, d},
>         {a, 1, c, e},
>         {b, c, 1, f},
>         {d, e, f, 1}}
> 




  • Prev by Date: Re: Tube plot function in Mathematica???
  • Next by Date: Solving differential equations in Mathematica 7.0
  • Previous by thread: Re: Function construction and also symmetric matrices
  • Next by thread: Need larger window for Manipulate Slider Control (ControlsRendering)