This is hopefully a simpler version of this previous unanswered question of mine.

Let me just focus on the two expressions $F_2^{(s)}$ and $F_3^{(s)}$ given in A.3 and A.4 of page 19 of this paper.

  • How do I get Mathematica to just even manipulate such vector expressions? Like if I want to calculate $(F_2^{(s)})^2$ or $F_2^{(s)} F_3^{(s)}$ etc?

To make the question clear let me add in some more details about what I exactly want,

I define the function F2s as,

F2s[q_, k1_] := (5/
14) + (3 (Norm[k1])^2)/(28 (Norm[q])^2) + (3 Norm[
   k1]^2)/(28 (Norm[q - k1])^2) - (5)/(28 (Norm[q])^2 (Norm[
    q - k1])^(-2)) - (5)/(28 (Norm[q])^(-2) (Norm[
    q - k1])^(2)) + ( (Norm[
   k1])^4)/(14 (Norm[q])^2 (Norm[q - k1])^2 )

But when I ask it to be squared all I get is this! (basically nothing has been done and the situation doesn't change with taking a FullSimplify either)

(2 Norm[k1]^4 - 5 (Norm[q]^2 - Norm[-k1 + q]^2)^2 + 3 Norm[k1]^2 (Norm[q]^2 + Norm[-k1 + q]^2))^2/(784 Norm[q]^4 Norm[-k1 + q]^4)

I would have wanted the answer to be given in the way I gave the functions $F2s$ - as a sum of fractions each of which is a product of powers of $q$, $k1$ and $\vert \vec{q} - \vec{k1}\vert$. How do I get that?

  • 2
    $\begingroup$ Those aren't vectors at all. The contain vectors, but they're scalars. What do you mean by "manipulate"? Surely not Manipulate, but what exactly? $\endgroup$ – Jens May 17 '13 at 21:29
  • $\begingroup$ @Jens Like, could tell me how I can get Mathematica to calculate say $(F_2^{(s)}(\vec{k},\vec{k}-\vec{q}))^2$ ? .. for example..or if you could help solve the previous question linked from here.. $\endgroup$ – user6818 May 17 '13 at 21:37
  • $\begingroup$ How about if you tell us what $F_2^(s)$ is, and we'll tell you how to calculate $F_2^(s) (k,k-q)$ where k and q are vectors. $\endgroup$ – bill s May 18 '13 at 7:25
  • $\begingroup$ @bills Didn't get you. $F_2^{(s)}$ function is as defined in equation A.3 on page 19 of my linked paper. I want to be able to say take the square of it. How do I do it? $\endgroup$ – user6818 May 18 '13 at 20:49
  • 1
    $\begingroup$ Perhaps you are looking for Expand instead of FullSimplify ? $\endgroup$ – Simon Woods May 18 '13 at 21:39

Based on the assumption that those F functions produce scalar results…

If you just want to manipulate the vectors as entities without considering their components, then you can enter the function for F2s

f2s[q_, k1_] := (5/
14) + (3 (Norm[k1])^2)/(28 (Norm[q])^2) + (3 Norm[
   k1]^2)/(28 (Norm[q - k1])^2) - (5)/(28 (Norm[q])^2 (Norm[
    q - k1])^(-2)) - (5)/(28 (Norm[q])^(-2) (Norm[
    q - k1])^(2)) + ((Norm[
   k1])^4)/(14 (Norm[q])^2 (Norm[q - k1])^2)

Then fill in two symbols which represent vectors (and optionally use TraditionalForm):

f2s[q, k1] // TraditionalForm

which produces

enter image description here

You can then take the square and to review it apply Expand and TraditionalForm:

f2s[q, k1]^2 // Expand // TraditionalForm

which produces

enter image description here

Alternatively, if you wish to work with the components of the vectors (using numbers here as example)

q1 = {1, 2, 3}
q2 = {4, 5, 6}

write a function such as F2 (simplified here relative to the paper you mention)

f2[v1_, v2_] := (5/7) + (1/2) (v1.v2)/(Norm[v1] Norm[v2])

use it to evaluate for any two vectors

f2[q1, q2]
(* 5/7 + (8 Sqrt[2/11])/7 *)

then square it if you wish

f2[q1, q2]^2

If you want to work with generalized vector components and know the dimensions of each vector, use for example

q1 = {x1, y1, z1}
q2 = {x2, y2, z2}
f2[q1, q2]
| improve this answer | |
  • $\begingroup$ I guess my question isn't well-framed. I didn't ask for such a thing. I am looking for an algebraic answer - and not for specific vectors you plugged in for $q1$ and $q2$. I can by hand calculate everything for general vectors - I guess there should be a way to do it in Mathematica also! $\endgroup$ – user6818 May 17 '13 at 22:24
  • $\begingroup$ Perhaps I've misunderstood what you're looking for in terms of manipulation or calculation, or perhaps I don't know how to squeeze it out of Mathematica. $\endgroup$ – TransferOrbit May 18 '13 at 6:23
  • $\begingroup$ MMA symbolically transforms symbols. Vectors are represented as lists (and matrices as lists within lists) within a symbol. The 'simplest' form of a resulting expression is a matter of opinion, and FullSimplify makes particular choices when changing the form according to built-in Rules (which can be augmented by a user). Check out what MMA can do with SymbolicTensors? $\endgroup$ – TransferOrbit May 18 '13 at 6:36
  • $\begingroup$ You can see the edits that I made in the question. I guess now I have made my question more clear about what I want. It would be great if you can help! $\endgroup$ – user6818 May 18 '13 at 21:31
  • $\begingroup$ Perhaps my edited answer is now closer to the mark. I have now applied the Expand command. $\endgroup$ – TransferOrbit May 19 '13 at 7:10

If you are using Mathematica version 9, the best approach is probably to use the new symbolic tensor functionality as suggested by zentient.

However for this problem it may be sufficient to explicitly specify a rule to convert expressions like Norm[-q] into Norm[q]:

myform = Expand[# /. Norm[-x_ + y_.] :> Norm[x - y]] &;

(F2s[q, k1]*F2s[-q, k2]) // myform // Short // TraditionalForm

enter image description here

| improve this answer | |
  • $\begingroup$ Thanks! Thats quite sophisticated! So you are basically putting in an extra rule to convert Norm[-x+y] to Norm[x-y]. But how does Mathematica understand this to convert Nor[-q] to Norm[q]? Does it on its own put a $0$ vector for the blank slot of y? $\endgroup$ – user6818 May 19 '13 at 19:49
  • $\begingroup$ @user6818, yes - the dot at the end of y_. tells Mathematica to use the default value for Plus (which is zero) if there isn't anything there to explicitly match the pattern. Look up Default in the documentation for a fuller explanation. $\endgroup$ – Simon Woods May 19 '13 at 20:09
  • $\begingroup$ Great that there is a site like this! Its just impossible to know so many "tricks" with a software every time one has to do something - which is trivial to do by hand! So your "myform" specification also takes care of thinks like converting Norm[-x-y] to Norm[x+y] or Norm[x-y] to Norm[y-x] and all such possible combinations? $\endgroup$ – user6818 May 19 '13 at 20:20
  • $\begingroup$ (..if it does all that a human would do with vector norms then I can go ahead use your script for various such large manipulations I would want to do - if the Norm factors are not combining well then I would have sieve through hundred of such expressions to pick by hand all the factors correctly!..) $\endgroup$ – user6818 May 19 '13 at 20:21
  • $\begingroup$ @user6818, my code just converts expressions like Norm[-a] and Norm[-a + b] into Norm[a] and Norm[a - b]. You could add more rules if there are other transformations you need. $\endgroup$ – Simon Woods May 19 '13 at 20:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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