[Date Index]
[Thread Index]
[Author Index]
Mapping Distribute, losing constant factor
*To*: mathgroup at smc.vnet.net
*Subject*: [mg124542] Mapping Distribute, losing constant factor
*From*: Stefan Salanski <wutchamacallit27 at gmail.com>
*Date*: Tue, 24 Jan 2012 05:05:41 -0500 (EST)
*Delivered-to*: l-mathgroup@mail-archive0.wolfram.com
Hello all, I ran across this interesting problem in some quick
calculations i was doing with matrix generators.
the following matrix was the result of a generator function i defined,
but the error persists if i just copy this in by itself:
a = {{1+1/2 E^-\[Theta] (-1+E^\[Theta])^2,1/2 E^-\[Theta] (-1+E^\
[Theta]) (1+E^\[Theta]),0,0},{1/2 E^-\[Theta] (-1+E^\[Theta]) (1+E^\
[Theta]),1+1/2 E^-\[Theta] (-1+E^\[Theta])^2,0,0},{0,0,1,0},{0,0,0,1}}
My goal being to simplify this and obtain the sinh and cosh function
representations, i found that using Expand followed by ExpToTrig works
perfectly:
In[13]:= ExpToTrig[Expand[a]]
Out[13]= {{Cosh[\[Theta]], Sinh[\[Theta]], 0, 0}, {Sinh[\[Theta]],
Cosh[\[Theta]], 0, 0}, {0, 0, 1, 0}, {0, 0, 0, 1}}
However, my first attempt at simplifying involved using Distribute
(which was my first guess for getting it into a nice form). And it was
using distribute that i noticed the constant factor 1/2 in each matrix
element was dropped. Distribute[a] didnt change anything, so I mapped
it over a as follows:
In[17]:= Map[Distribute, a, 2]
Out[17]= {{2 + E^-\[Theta] (-1 + E^\[Theta])^2, -E^-\[Theta] + E^\
[Theta], 0, 0}, {-E^-\[Theta] + E^\[Theta], 2 + E^-\[Theta] (-1 + E^\
[Theta])^2, 0, 0}, {0, 0, 1, 0}, {0, 0, 0, 1}}
The factors of 1/2 in the non-trivial matrix elements seem to have
disappeared. Though testing it on individual elements works fine
(though doesn't seem to have done a whole lot of distributing, maybe
because the Head is Plus, and not Times or something else)
In[22]:= Distribute[a[[1, 1]]]
Out[22]= 1 + 1/2 E^-\[Theta] (-1 + E^\[Theta])^2
So my question is whether this disappearance of the 1/2 factor is a
bug, or due to a lack of understanding of Distribute and/or Map on my
part.
-Stefan Salanski
University of Virginia
Prev by Date:
**Re: exercises: suppress printing of answers**
Next by Date:
**Automatically colred and indexed custom locators**
Previous by thread:
**Re: Mathematica 8 + OS X + McAfee = trouble; help?**
Next by thread:
**Re: Mapping Distribute, losing constant factor**
| |