## 60 Reputation

5 years, 274 days

## @tomleslie  The metrics are the sa...

The metrics are the same, first code i simply inputted an arbitrary metric manually.

## Still not getting it...

 >
 >
 (1)
 >
 (2)
 >
 (3)
 >
 (4)
 >
 (5)

Hi,
I don't think thats the case it has worked for me before, but anyhow I have used your code and do not get the same result? Thanks,

## ...

 >
 >

Ah I have corrected these issues (H0 is supposed to be 4x4). CODE:

restart;

with(LinearAlgebra):

A := Matrix(4, 4, {(1, 1) = 1, (1, 3) = -1, (1, 4) = 3, (2, 2) = 2, (2, 3) = 1, (3, 1) = -1, (3, 2) = 1, (3, 3) = 6, (3, 4) = -1, (4, 1) = 3, (4, 3) = -1, (4, 4) = 10}, fill = 0):

b := Matrix(4, 1, {(1, 1) = 0, (2, 1) = -2, (3, 1) = -1, (4, 1) = -1}):

f := x -> (((1/2*Transpose(x)) . A) . x) + ((Transpose(b)) . x):

v0 := Matrix([[0.], [1.], [0.], [0.]]):

g0:=A*v0+b;

H0:=Matrix(4,4,{(1,1)=1,(2,2)=1,(3,3)=1,(4,4)=1},fill=0);

tot:=0:

while   (Norm(g0) > 1e-6) do;

d0:=-H0*g0

alpha0 := -(Transpose(g0).d0)/(Transpose(d0).A.d0);

v1 := v0 +alpha0*d0;

g1:=A*v1+b;

p0:=v1-v0;

q0:=g1-g0;

H1:=H0-(H0*q0*Transpose(q0).H0)/(Transpose(q0).H0.q0)+(p0*Transpose(p0))/(Transpose(p0).q0);

v0:=v1;

H0:=H1;

g0:=g1;

tot:=tot+1

od:

v0, g(v0);

## @vv  The post deleted itselft multi...

@vv
The post deleted itselft multiple times so I keep reposting it

## @guru kido  restart;  with(Li...

@guru kido
restart;

with(LinearAlgebra):

A := Matrix(4, 4, {(1, 1) = 1, (1, 3) = -1, (1, 4) = 3, (2, 2) = 2, (2, 3) = 1, (3, 1) = -1, (3, 2) = 1, (3, 3) = 6, (3, 4) = -1, (4, 1) = 3, (4, 3) = -1, (4, 4) = 10}, fill = 0):

b := Matrix(4, 1, {(1, 1) = 0, (2, 1) = -2, (3, 1) = -1, (4, 1) = -1}):

f := x -> (((1/2*Transpose(x)) . A) . x) + ((Transpose(b)) . x):

v0 := Matrix([[0.], [1.], [0.], [0.]]):

g0:=A*v0+b;

H0:=Matrix(2,2,{(1,1)=1,(2,2)=1},fill=0);

tot:=0:

for i from 1 by 1 while   (Norm(g(v0)) > 1e-6) do;

d0=-H0*g0

alpha0 := -(Transpose(g0).d0)/(Transpose(d0).A.d0);

v1 := v0 +alpha0*d0;

g1:=A*v1+b

p0:=v1-v0;

q0:=g1-g0;

H1:=H0-(H0*q0*Transpose(q0).H0)/(Transpose(q0).H0.q0)+(p0*Transpose(p0))/(Transpose(p0).q0);

f1:=(1/(2))*Transpose(v1).A.v1+Transpose(b)*v1

v0:=v1;

H0:=H1;

g0:=g1;

tot:=i

od:

v0, g(v0);

## mw@tomleslie    ...

 >
 >

The big green up arrow just inserts this as a photo...

 >
 (1)
 >
 >

Updated

## @tomleslie  Hi,    I have...

@tomleslie
Hi,
I have given you the code in my question. And they are all dots to represent matrix multiplication

 >
 >

## @guru kido    How do I do sim...

How do I do similar iterations with the formulae shown? I have tried to do this but I am stuck at the first hurdle, i do not know how to programme p(k) and q(k). Thanks in advance your help is much appreciated!

 >
 (1)
 >
 (2)
 >

 >
 (1)
 >
 (2)
 >

scrap that

## @vv Hi, How can I see how many iter...

@vv Hi,
How can I see how many iterations this has gone through?

## Hi,   I was aware of the misor...

Hi,
I was aware of the misordering I was just ignoring it but I have corrected now. Now this all makes sense and thank you for your help, but I have made changes and I am still not getting zero. Do you think I need to input more equations so that the computer can simplify more? I am stuck. Thanks in advance. How do I find help pages also? ALSO, the 'half flat metrics in 4D' is not a command, it is simply a note for myself. Thanks.

 >
 >
 >
 (1)
 >
 (2)
 >
 (3)
 >
 (4)
 >
 (5)
 >
 (6)
 >
 >
 (7)
 >
 >
 (8)
 >
 (9)
 >
 (10)
 >
 (11)
 >
 (12)
 >
 (13)
 >
 (14)
 >
 (15)
 >
 (16)
 >
 (17)
 >
 (18)
 >
 (19)
 >
 (20)
 >
 >
 >
 >
 >
 >
 >
 >
 (21)
 >

 >
 >
 >
 (1)
 >
 >
 (2)
 >
 (3)
 >
 (4)
 >
 (5)
 >
 >
 (6)
 >
 >
 (7)
 >
 (8)
 >
 (9)
 >
 >
 >
 >