Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #6982
| From | Chris Young <cy56@comcast.net> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Preventing unwanted threading by Inner |
| Date | 2011-12-07 11:18 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <jbni23$47f$1@smc.vnet.net> (permalink) |
I'm trying to prevent Inner from expanding my points into coordinates:
In[283]:= Inner[Times, {a, b, c}, {{A, α}, {B, β}, {C, χ}}, Plus]
Out[283]= {a A + b B + c C, a α + b β + c χ}
As I understand it, this has to do with Times being Listable:
In[304]:= Attributes[Times]
Out[304]= {Flat, Listable, NumericFunction, OneIdentity, Orderless, Protected}
But clearing the listable attribute doesn't do anything:
Unprotect[Times];
ClearAttributes[Times, Listable];
myInnnerProd = Inner[Times, {a, b, c}, {{A, α}, {B, β}, {C, χ}}, Plus];
SetAttributes[Times, Listable];
Protect[Times];
In[315]:= myInnnerProd
Out[315]= {a A + b B + c C, a α + b β + c χ}
In addition, I have to resort to using Hold on the points. Not sure
why; I would have thought that making Times non-listable would have
been enough.
In[343]:=
Unprotect[Times];
ClearAttributes[Times, Listable];
myInnerProd =
Inner[Times, {a, b, c}, Hold /@ {{A, α}, {B, β}, {C, χ}}, Plus];
myInnnerProd = ReleaseHold[myInnerProd]
SetAttributes[Times, Listable];
Protect[Times];
Out[346]= a {A, α} + b {B, β} + c {C, χ}
Back to comp.soft-sys.math.mathematica | Previous | Next — Next in thread | Find similar | Unroll thread
Preventing unwanted threading by Inner Chris Young <cy56@comcast.net> - 2011-12-07 11:18 +0000
Re: Preventing unwanted threading by Inner "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> - 2011-12-08 10:38 +0000
Re: Preventing unwanted threading by Inner Chris Young <cy56@comcast.net> - 2011-12-10 12:44 +0000
Re: Preventing unwanted threading by Inner Ray Koopman <koopman@sfu.ca> - 2011-12-08 10:42 +0000
Re: Preventing unwanted threading by Inner Chris Young <cy56@comcast.net> - 2011-12-10 12:43 +0000
Re: Preventing unwanted threading by Inner DrMajorBob <btreat1@austin.rr.com> - 2011-12-11 08:52 +0000
Re: Preventing unwanted threading by Inner Ray Koopman <koopman@sfu.ca> - 2011-12-08 10:42 +0000
Re: Preventing unwanted threading by Inner Chris Young <cy56@comcast.net> - 2011-12-10 12:29 +0000
Re: Preventing unwanted threading by Inner DrMajorBob <btreat1@austin.rr.com> - 2011-12-09 10:58 +0000
Re: Preventing unwanted threading by Inner Vince Virgilio <blueschi@gmail.com> - 2011-12-10 12:30 +0000
csiph-web