Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #8119 > unrolled thread
| Started by | Stefan Salanski <wutchamacallit27@gmail.com> |
|---|---|
| First post | 2012-01-24 10:06 +0000 |
| Last post | 2012-01-24 10:06 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.soft-sys.math.mathematica
Mapping Distribute, losing constant factor Stefan Salanski <wutchamacallit27@gmail.com> - 2012-01-24 10:06 +0000
| From | Stefan Salanski <wutchamacallit27@gmail.com> |
|---|---|
| Date | 2012-01-24 10:06 +0000 |
| Subject | Mapping Distribute, losing constant factor |
| Message-ID | <jflvr3$jp4$1@smc.vnet.net> |
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
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web