# Question:Programming a tensor with zero components apart from diagonal

## Question:Programming a tensor with zero components apart from diagonal

Maple

I want to know how to program a metric g_[ ]  so that entries are zero apart from the diagonal.
Basically I am using the physics package and can set it as arbitrary or can set it to be specific values but I just want arbitrary values across the diagonal. e.g

with(Physics);
Setup(mathematicalnotation = true);
[mathematicalnotation = true]

Setup(metric = arbitrary);
[metric = {(1, 1) = _F1(X), (1, 2) = _F2(X), (1, 3) = _F3(X), (1, 4) = _F4(X), (2, 2) = _F5(X), (2, 3) = _F6(X),  (2, 4) = _F7(X),

(3, 3) = _F8(X), (3, 4) = _F9(X),  (4, 4) = _F10(X)}]

SO here I want to keep F1 F5 F8 and F10, thanks in advance!

THIS IS WHAT I TRIED:

with(Physics);
Setup(mathematicalnotation = true);
Setup(Coordinatesystem = (X = [x1, x2, x3, x4]), metric = f(dx1^2+dx2^2+dx3^2+dx4^2));
* Partial match of  'Coordinatesystem' against keyword

'coordinatesystems'

Default differentiation variables for d_, D_ and dAlembertian

are: (Xequals(x1,x2,x3,x4))
Systems of spacetime Coordinates are: (Xequals(x1,x2,x3,x4))
Error, (in Physics:-Setup) expected definition of a metric as a tensorial algebraic expression with two free indices; received one with free indices {}

﻿