Published
Edited
Jan 13, 2021
Insert cell
Insert cell
Insert cell
nodeLocation = [0, 0]
Insert cell
adjointNodeLocations = [
[-1, 0],
[ 1, 0],
[ 0, -1],
[ 0, 1],
]
Insert cell
Insert cell
nbForces = adjointNodeLocations.length
Insert cell
Insert cell
viewof A = {
// Wir ereugen eine leere Matrix mit 2 Zeilen und nbForces Spalten.
let A = Eigen.Matrix.zeros([2, nbForces], invalidation);
// Die Koordinaten des betrachteten Knotens (A) speichern wir der einfachheitshalber in Variablen.
let ax = nodeLocation[0];
let ay = nodeLocation[1];
// Jetzt iterieren wir über alle benachbarten Knoten bzw. angreifenden Kräfte.
for (let i = 0; i < nbForces; i++) {
// Die Koordinaten des benachbarten Knotens (B) speichern wir wieder in Variablen.
let bx = adjointNodeLocations[i][0];
let by = adjointNodeLocations[i][1];
// Aufgabe 1: Abstand zwischen A und B berechnen (Hinweis: quadieren = x**2, Wurzel = Math.sqrt(x))
let length = 0.0;
// Aufgabe 2: directionX und directionY so berechnen, dass sie die normierte Richtung der Kraft angeben.
let directionX = 0.0;
let directionY = 0.0;
// Den Richtungsvektor tragen wir nun in die i-te Spalte ein.
A.set(0, i, directionX);
A.set(1, i, directionY);
}
// Abschließend geben wir die Matrix aus.
return A.show('A');
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
svd = A.bdcSVD(Eigen.ComputeThinU | Eigen.ComputeFullV, invalidation)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
rank = {
let nbEigenvalues = svd.singularValues(invalidation).rows;
let tolerance = 1e-8;
let rank = 0;
for (let i = 0; i < nbEigenvalues; i++) {
let eigenvalue = svd.singularValues(invalidation).get(i, 0);
if (Math.abs(eigenvalue) > tolerance) {
rank += 1;
}
}
return rank
}
Insert cell
Insert cell
nbZeroEigenvalues = nbForces - rank
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more