Distance - Maple Help

Student[NumericalAnalysis]

 Distance
 compute the distance between two matrices or vectors

 Calling Sequence Distance(A, B, p)

Parameters

 A - Matrix or Vector B - Matrix or Vector p - nonnegative, infinity, -infinity, Frobenius, Euclidean; the norm selector

Description

 • The Distance command computes the distance (the norm of the difference) between two matrices or two vectors with respect to a specified p-norm. For more information on various norms that can be computed, see Student,LinearAlgebra,Norm.
 • If A and B are both matrices then p must be one of 1, 2, infinity, Frobenius, or Euclidean.
 • If A and B are both vectors then p must be one of a non-negative number, infinity, -infinity, Frobenius, or Euclidean.
 • A and B must both be either vectors or matrices, not one of each.

Examples

 > $\mathrm{with}\left(\mathrm{Student}\left[\mathrm{NumericalAnalysis}\right]\right):$
 > $A≔\mathrm{Matrix}\left(\left[\left[1.432,5.223,6.444\right],\left[5.325,7.453,8.223\right],\left[6.432,8.343,8.222\right]\right]\right)$
 ${A}{≔}\left[\begin{array}{ccc}{1.432}& {5.223}& {6.444}\\ {5.325}& {7.453}& {8.223}\\ {6.432}& {8.343}& {8.222}\end{array}\right]$ (1)
 > $B≔\mathrm{Matrix}\left(\left[\left[5.224,9.809,8.932\right],\left[0.424,8.453,3.532\right],\left[2.533,9.435,0.423\right]\right]\right)$
 ${B}{≔}\left[\begin{array}{ccc}{5.224}& {9.809}& {8.932}\\ {0.424}& {8.453}& {3.532}\\ {2.533}& {9.435}& {0.423}\end{array}\right]$ (2)
 > $\mathrm{Distance}\left(A,B,\mathrm{\infty }\right)$
 ${12.790}$ (3)
 > $\mathrm{Distance}\left(A,B,\mathrm{Frobenius}\right)$
 ${12.87808806}$ (4)
 > $\mathrm{Distance}\left(A,B,1\right)$
 ${14.978}$ (5)
 > $a≔\mathrm{Vector}\left(\left[\left[2.42,5.34\right],\left[8.78,0.42\right]\right]\right)$
 ${a}{≔}\left[\begin{array}{c}{2.42}\\ {5.34}\\ {8.78}\\ {0.42}\end{array}\right]$ (6)
 > $b≔\mathrm{Vector}\left(\left[\left[4.32,9.32\right],\left[6.22,1.33\right]\right]\right)$
 ${b}{≔}\left[\begin{array}{c}{4.32}\\ {9.32}\\ {6.22}\\ {1.33}\end{array}\right]$ (7)
 > $\mathrm{Distance}\left(a,b,3.1\right)$
 ${4.401239994}$ (8)
 > $\mathrm{Distance}\left(a,b,-\mathrm{\infty }\right)$
 ${0.91}$ (9)