New answers tagged

1 vote

Symbolic scalar-by-matrix derivative

I tried the NCAlgebra package: << NC`; << NCAlgebra`; SNC[X, A] NCGrad[tr[tp[tp[X] ** A] ** (tp[X] ** A)], A] And ...
user avatar
  • 1,616
4 votes
Accepted

Inverse of a matrix with symbolic variables

Replacing all machine-precision numbers by exact numbers: ...
user avatar
  • 35.6k
0 votes

How to solve this equation of n-order matrix?

Does this work for you? ident[i_, j_] := KroneckerDelta[i, j] jmat[i_, j_] := 1 mmat[i_, j_] := (k - \[Lambda]) KroneckerDelta[i, j] + \[Lambda] then: ...
user avatar
  • 2,058
4 votes

Timing for generating long matrix

This seems to produce the correct result and is much faster for small values of n. ...
user avatar
4 votes
Accepted

Timing for generating long matrix

I suspect you only want to optimize the last line, i.e. I haven't bothered speeding up s. In what follows I'll use the first 1000 x 1000 submatrix to show some ...
user avatar
0 votes

How to approximate a function using B-spline interpolation?

B splines are already built into MMA. To expand Sin[x] over the region 0 o 2 Pi into B splines of degree d=3 we choose a basis of b splines with uniform knots at a distance of 1/(d+1): ...
user avatar
  • 24.1k
8 votes
Accepted

How do I create and combine column matrices from lists

Mathematica uses the list for almost everything. You can think of a list as a row for now for purposes of making matrices. So when you write ...
user avatar
  • 108k
1 vote

Is there a way to apply a two-argument function to matrices?

Is the following application of MapThread with a level specification what you are looking for? ...
user avatar
  • 58.3k
3 votes

How does NDSolve treat matrices?

An alternative to Indexed to deal with matrices is to prevent f from evaluating until a matrix value is substituted for ...
user avatar
  • 213k
4 votes

How does NDSolve treat matrices?

I think that what you want to do with your broken code : f[rho_,t_]:=Table[rho[[n,m]],{n,1,2},{m,1,2}]Cos[t] is something similar to this code : ...
user avatar
  • 16.9k
0 votes

How to Create an Efficient Word Square Algorithm?

I have created an algorithm that takes about 2.4 seconds to find the word squares for "hair" and 10.5 seconds for "dogs". ...
user avatar
3 votes

NDSolve: there are more variables than equations, underdet

There are several typos in the code. First, initial data array probably should be in a form ...
user avatar
  • 33.7k
4 votes
Accepted

Derivative of quadratic form in NCAlgebra

As noted in the documentation of NCGrad: IMPORTANT: The expression returned by NCGrad is the transpose or the adjoint of the standard gradient. This is done so ...
user avatar
2 votes

Looking for a efficient way of solving a matrix which is function of some variable

Maybe you could use FindRoot? The trick is to know how to differentiate the determinant of a matrix, which is: $$\frac{d \det (g(x))}{dx} = \det\left(g(x)\right) \ \...
user avatar
  • 123k
1 vote
Accepted

Total Spin Matrix Squared (Casimir Operator)

Compute Dot[#,#] for each element # of the list and then sum up the results?! ...
user avatar
  • 2,240
1 vote

Looking for a efficient way of solving a matrix which is function of some variable

The type of dependence in f is critical here. For your example, it amounts to calculating a generalized eigenvalue. ...
user avatar
6 votes

Invert a generic n x n matrix

Clear["Global`*"] For the given example of DiagonalMatrix[n*Range[n]], the Inverse...
user avatar
  • 119k
1 vote

Help with equation within adjacency matrix

You could use, for instance: {i, j} = Transpose[List @@@ edges]; truedistance = scalefactor Sqrt[Total[Abs[coordinates[[i]]^2 - coordinates[[j]]^2], {2}]]; If you ...
user avatar
2 votes
Accepted

Insert a dynamic vector into a matrix

Maybe like this: NN = 3; n = 6; Flatten /@ (IdentityMatrix[n] /. 1-> Cs[NN])
user avatar
  • 30.4k
0 votes

Insert a dynamic vector into a matrix

I think you need to minimally modify your code using Sequence in a ReplaceAll. ...
user avatar
  • 5,684
1 vote

Insert a dynamic vector into a matrix

This method uses SparseArray and Band ...
user avatar
  • 11.4k
0 votes

Test First row of matrix

I think it may be better to use something like Association, but since this question is from 2012, but Association is introduced ...
user avatar
  • 6,507

Top 50 recent answers are included