1
$\begingroup$

This might be a very silly question but i'm defining a function as:

\[Chi][AR_] := ((AR^(2) - 1)/(AR^(2) + 1));

which is clearly a scalar function of AR; however when I do:

Dimensions[\[Chi][AR]]

It tells me this is a vector of two elements. Inded i tried to check what those elements where and i got:

In[21]:= \[Chi][AR][[2]]

Out[21]= 1/(1 + AR^2)

while the first element is:

In[22]:= \[Chi][AR][[1]]

Out[22]= -1 + AR^2

this is really annoying, anybody does why it's happening? (Maybe it's a silly question the solution is obvious but i'm too much asleep to notice it...)

thanks in advance

$\endgroup$
0

1 Answer 1

1
$\begingroup$

Dimensions>>Generalizations and Extensions says:

Dimensions works with any head,not just List.

So,

Dimensions[foo[x,y]]
(* {2} *)

and

foo[[1]]
(* x *)

foo[[2]]
(* y *)

In your case, checking the FullForm of χ[z]

FullForm[χ[z]]

gives

Times[Plus[-1,Power[z,2]],Power[Plus[1,Power[z,2]],-1]]

Thus,

χ[z][[0]]
(* Times *)

χ[z][[1]]
(* -1 + z^2 *)

χ[z][[2]]
(* 1/(1 + z^2) *)
$\endgroup$
2
  • $\begingroup$ So it's basically applying dimensiona to times[...]? Also if I define two vectorial functions, can i define the function given by their cross product by just doing Cross[f1[x],f2[x] ]? $\endgroup$
    – SSC Napoli
    Commented Feb 5, 2015 at 8:40
  • 1
    $\begingroup$ @user3810266, re "applying dimensions to Times", yes; and re "Also, if...", I think so. $\endgroup$
    – kglr
    Commented Feb 5, 2015 at 8:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.