Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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?

share|improve this question
2  
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? –  Jens May 17 '13 at 21:29
    
@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.. –  user6818 May 17 '13 at 21:37
    
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. –  bill s May 18 '13 at 7:25
    
@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? –  user6818 May 18 '13 at 20:49
1  
Perhaps you are looking for Expand instead of FullSimplify ? –  Simon Woods May 18 '13 at 21:39
show 4 more comments

2 Answers 2

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]
share|improve this answer
    
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! –  user6818 May 17 '13 at 22:24
    
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. –  zentient May 18 '13 at 6:23
    
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? –  zentient May 18 '13 at 6:36
    
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! –  user6818 May 18 '13 at 21:31
    
Perhaps my edited answer is now closer to the mark. I have now applied the Expand command. –  zentient May 19 '13 at 7:10
add comment

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

share|improve this answer
    
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? –  user6818 May 19 '13 at 19:49
    
@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. –  Simon Woods May 19 '13 at 20:09
    
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? –  user6818 May 19 '13 at 20:20
    
(..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!..) –  user6818 May 19 '13 at 20:21
    
@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. –  Simon Woods May 19 '13 at 20:48
show 5 more comments

Your Answer

 
discard

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

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