Sign up ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I'm trying to implement smooth approximations of Max and Abs functions. Moreover I want the functions to map element-wise on tensors. Here's my code.

$Assumptions = {
   Element[A, Arrays[{i, j, k}, Reals]],
   Element[Nlarge, Reals] (* Nlarge tends to infinity *)
Hyper[x_] := Map[Exp[Nlarge #1] &, x, -1]
Hypo[x_] := Map[Log[#1]/Nlarge &, x, -1]
SMax[x__] := Hypo[Plus @@ (Map[Hyper, {x}])]
SAbs[x_] := SMax[x, -x]
SAbs[A] // TensorDimensions

I'm expecting it to return {i, j, k}, but instead I get {}. What's wrong with it?

share|improve this question
Why do you expect it to return {i,j,k}? – Sjoerd C. de Vries Dec 23 '12 at 13:28
I expect SAbs[A] to have the same dimensions as A, where each element in SAbs[A] approximates to Abs of the corresponding entry in A – Ishan Arora Dec 23 '12 at 18:46
This supposes that Exp[A] is a tensor, which it doesn't seem to be. – Sjoerd C. de Vries Dec 23 '12 at 19:07
A is a symbolic array. In this case what would be the correct way to get element-wise Exp of a symbolic array? – Ishan Arora Dec 23 '12 at 20:02
I don't think there is any, but I'd be happy to be proven wrong. The symbolic tensor stuff works by using specific Assumptions. I don't think Exp has been updated to work with those. – Sjoerd C. de Vries Dec 23 '12 at 21:32

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.