Free cookie consent management tool by TermsFeed Creating a Helmert matrix using Scipy | Pythontic.com

Creating a Helmert matrix using Scipy

Overview:

  • A Helmert matrix is a square matrix of order n which is of the form

Helmert matrix

  • The SciPy function helmert() constructs and returns a Helmert matrix of order n.

  • A Helmet matrix is an orthogonal matrix. For an orthogonal matrix,its inverse is equal to its transpose.

Example:

# Example Python program that creates a Helmert 
# matrix using the helmert() function from the scipy.linalg
# module

import scipy.linalg as sclg

order = 5
# Create a Helmert matrix
helmertMatrix = sclg.helmert(5)
print("Helmert matrix of order %d:"%order)
print(helmertMatrix)

Output:

[[ 0.70710678 -0.70710678  0.          0.          0.        ]
 [ 0.40824829  0.40824829 -0.81649658  0.          0.        ]
 [ 0.28867513  0.28867513  0.28867513 -0.8660254   0.        ]
 [ 0.2236068   0.2236068   0.2236068   0.2236068  -0.89442719]]

 


Copyright 2025 © pythontic.com