Items tagged with matrix

Feed

hi 

I have a matrix (for example a 6*6 matrix) and I want to add a row and a column between row and column of number 3 and 4. it means that finally, we have a 7*7 matrix.

tnx

 

The link below has my code for generating 2 matrices.  The 1st one does not generate flfoating point numerical data; whereas, the 2nd one does.  What is wrong with the 1st case?  I am attempting to single out one harmonic which works in the 2nd case.  Also, is there a way I can generate a spectrum of S2(k= 1 to 100, t= 0 to 1)?

?untitled6.mw

 

Hi,

I have some matrix valued functions that that I can only define piecewise. Unfortunately I have some problems to manipulate those functions. Piecewise sees to do the job for  scalar valued functions. There I can easily differentiale and add results. For Matrix valued functions however, those features seem to not be availible.
 

I can work around these limitations by manually applying all operations to the operands of the piecewise function. Like I show here:


 

restart:

# a piecewise function

p1:=piecewise(a(t)^2=0,<cos(a(t))^2+sin(a(t))^2,0>,<1,1/a(t)>)

p1 := piecewise(a(t)^2 = 0, Vector(2, {(1) = cos(a(t))^2+sin(a(t))^2, (2) = 0}), Vector(2, {(1) = 1, (2) = 1/a(t)}))

(1)

# differentiation does not work

diff(p1,t)

diff(piecewise(a(t)^2 = 0, Vector(2, {(1) = cos(a(t))^2+sin(a(t))^2, (2) = 0}), Vector(2, {(1) = 1, (2) = 1/a(t)})), t)

(2)

# selecting individual entries does not work

r:=p1(1)+1

r := (piecewise(a(t)^2 = 0, Vector(2, {(1) = cos(a(t))^2+sin(a(t))^2, (2) = 0}), Vector(2, {(1) = 1, (2) = 1/a(t)})))(1)+1

(3)

# strange simplification behaviour

simplify(p1)

piecewise(t = RootOf(a(_Z)), _z1(RootOf(a(_Z))), Vector(2, {(1) = 1, (2) = 1/a(t)}))

(4)

# current workaround, define new piecewise function by using op

r:=piecewise(op(1,p1),op(2,p1)(1)+1,op(3,p1)(1)+1)

r := piecewise(a(t)^2 = 0, cos(a(t))^2+sin(a(t))^2+1, 2)

(5)

 


 

Download Scratch.mw

 

I think my workaround is very cumbersome and error prone. Is there a better way to tackle this probem? Or should I try to overload all needed operations, and is this even possible?

Thanks for all suggestions!

Honigmelone

I am a newbie at generating numeric data sets using the Matrix command.  Linked is the code I used to generate a time profile for various values of k.  The output results in 10 separate matrices for each value of k.  Instead I would like one matrix that has all ten data sets included.   Can anyone provide assistance?

untitled5.mw

 

 

 

I have two square matrices (LS,RS) in the form of generalized eigen-value problem as below:

LS*z=omega*RS*z

One time, I am using inverse of RS multiplying by LS to get the eigen values as
MS := MatrixInverse(RS) . LS:
VL1, VR1 := Eigenvectors(MS):

Next time, I am using direct method as below to get the eigen values 

VL2, VR2 := Eigenvectors(LS, RS);
 

I am wondering there are meaningful differences between VL1 and VL2 as well as VR1 and VR2.

Does anybody know why?

RS.mw

LS.mw

 

 

 

Dear Maple users,

I am solving a system of linear equations Ax=b where A is a matrix (243*241) which contains a rational polynomial of unknown "kappa" along with floating numbers. As suggested in some other posts I am using Linear algebra package with the LinearSolve command and option "solve" to find out unknown vector x. b is a vector having entries zero and 1. The system is such that two equations are redundant but it is difficult to recognise which two are redundant and hence for the time being I am keeping them in the matrix. (For a known value of kappa (say kappa=2) I have checked that two equations are redundant.) For the reference, the matrix and the right-hand vector b is attached as text.

There are two issues

1) Maple takes very long time (12 hours and so) to get x=b\A;

2) The result is a long expression i.e.  x[i] is a rational polynomial in kappa; a very long rational polynomial which I am importing as a text. I am not sure if maple exports all terms in the polynomial as for the different value of kappa I see Ax-b >0. 

How can I overcome this problem? Any help will be greatly appreciated. 

I have written a Maple code which extracts terms in a matrix into two new matrices dependent on certain markers. I am running into problems with this particular code as it requires enormous amounts of RAM when going to large matrix sizes (32GB+); and will take 4-5 days to complete for larger matrix sizes, or simply crashes.

Each matrix element is an algebraic expression containing A and B and the markers hh and ss. The example in the attached Maple file (3 x 3 matrix) is a minimal working example and the actual expressions are much longer and the matrices much larger (5000 x 5000 or larger). I utilise the symmetry of the matrix to ease the process, and use the tril command of MTM to extract only the lower triangular matrix; as this is all that is needed for the next stage (I have yet to test how efficient this command is, but use it for now).

The two markers hh and ss are targeted and if found in an expression that term will be extracted accordingly. The matrix elements are expanded and a procedure run over the matrix and will extract terms with hh into one matrix and terms with ss into another matrix. I think the map(expand,...) part is what causes the memory issue; but I believe this needs to be done to correctly extract terms.

Any help or tips are greatly appreciated on how to increase efficiency and improve this method.
 

Sub_matrix_extraction.mw

-Yeti

 

 

I am having trouble exporting a matrix.  Attached is my file.  When I export the matrix the values for tpeak are not numeric.  They are string values indicating the analytical expression that MAPLE is displaying.  I cannot seem to find the option to express the results as numeric.

Can anyone help?

untitled5.mw

I have an analytical equation with respect to time that is a Fourier series expansion of a specific function.  I would like MAPLE to generate a table of results against time.  I have always used MATLAB to handle numeric data.  How can I generate a data table in MAPLE.  I have never used the Spreadsheet tool in MAPLE.  Is that the way to go?  Is there some examples on how to do this?

My analytical function is attached:

untitled4.mw

I read from another posting that plottools:-getdata is the way to go, but I do not see that functionality in MAPLE 12?

Is it possible to export a big symbolic matrices or lists, from Maple mileu to Matlab in new versions of Maple?

If no, why Maple dont have such ability?

Simplest way to extract diagonal elements of a square symbolic matrix?

The diag command gives error

Error, (in linalg:-diag) parameters must be square matrices or scalars
 

I have a big matrix 1000*1000, How Maple could declare the number (corresponding row and coulumn) of element that is maximum?

Suppose the element (113,987) of my matrix has the maximum value, which command returns (113,987)?

 

Hey there. 

I recently had to install maple 2017, because the licensens for 2016 had expired. 

And in the new version, whenever i want to copy a matrix from a result, it gives me an _rtable, and a number. The result is the same, but it makes it harder to read and i am not able to edit values in this copied matrix. 

How do i change this?

how can we compute wighted norm of a matrix or a vector in maple? 

See WA30 attached.  Why the error?  The variable that represents the vector is in vector form.  If I need to change this to THAXexa := ([1988.0, 1989.0, 1990.0 , ... etc], datatype=float, is there an easy way to convert the THAXexa matrix?

Thanks, Les  WA30.mw

1 2 3 4 5 6 7 Last Page 1 of 41