Online Algebra Calculator
Many of users do not use powerful Maxima computer algebra system for systematic work, but for ad hoc algebraic calculations – equations, functions, matrixes, etc. only. To do this job, it is not useful to download the whole application from a web site.
Function: diagmatrix (<n>, <x>) Returns a diagonal matrix of size <n> by <n> with the diagonal elements all equal to <x>. diagmatrix (<n>, 1) returns an identity matrix (same as ident (<n>)).
![Diagmatrix Example A:matrix([2,1+t,0],[1-t,t,-1],[1+t,1,1]);
expr:charpoly(A,x);
expr2:ratexpand(expr);
c2:coeff(expr2,x,2);
c1:coeff(expr2,x,1);
d:expand(c2^2-4*c1);
solve(d);
solve(c1);
B:A+transpose(A)-2*diagmatrix(3,1);
determinant(B);
A . [1,0,1];
A . [-t,1,0];
A . [-1,0,1];](http://maxima-online.org//plot.html?g=i-1370011613.png&t=img&db=r1631324059)
<n> must evaluate to an integer, otherwise diagmatrix complains with an error message.
<x> can be any kind of expression, including another matrix. If <x> is a matrix, it is not copied; all diagonal elements refer to the same instance, <x>.
There are also some inexact matches for diagmatrix. Try ?? diagmatrix to see them.
(%o1) true (%i2)