# Help - matrix multiplication by number complex

Dear,

I’m working on a 3d mesh. I created a gradient function of the mass of Dirac (gdirac) and my force function would be the multiplication of gdirac by a complex value (moment). However, I can’t do this multiplication. Can anybody help me?

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Geometry import
include “cube.idp”

int[int] Nxyz = [10, 10, 10]; //discretization axis
real [int, int] Bxyz = [[0., 1.], [0., 1.], [0., .1]]; //block dimensions
int [int, int] Lxyz = [[1, 1], [2, 2], [2, 2]];

// Parameters

real E = 210;
real nu = 0.29;
real rho = 1;
real omega = 12;
real mu = E/(2*(1+nu));
real lamb = Enu/((1+nu)(1-2nu));
real coef = 2.0
(mu + lamb);
complex beta = 0.4 + 0.6i;

// Assemble mesh

mesh3 Th = Cube(Nxyz, Bxyz, Lxyz); // Th → domain triangulation and mesh3 → FEM mesh in 3d

// The finite element space (Vh) defined over Th

fespace Vh(Th, [P1, P1, P1]);
Vh [u1, u2, u3], [v1, v2, v3];

// The gradient of the Dirac mass

func matrix gdirac (real X, real Y,real Z, real Xc, real Yc, real Zc){
real xs = (X-Xc), ys = (Y-Yc), zs = (Z-Zc);
real dif = -(xsxs + ysys+ zszs)/(2);
real coef = 1.0/(2.0
pi);
real gx = coef * exp(dif)*xs;
real gy = coef * exp(dif)*ys;
real gz = coef * exp(dif)*zs;
matrix G=[[gx,gy,gz]];
return G;
}

complex moment=betacoef;
real xc=0.5, yc=0.5, zc=0.05;
complex M = moment
gdirac (x,y,z, xc, yc, zc);