Post Reply 
hp prime programing with symbolic matrix
12-01-2017, 01:33 PM
Post: #1
hp prime programing with symbolic matrix
Hi guys.
I'm trying to make a program with symbolic matrix.
My steps are the next:
first I make a matrix with zeros.
Then i tried to input in each element of the matrix an expresion in a for loop:
(z(i):=z(i)*(("X")-a(j)));

No mather if i put a "x" or an "X". I return from the program "incorrect argument"
If I put:
CAS (z(i):=z(i)*(("X")-a(j)));
then x will be replaced by zero because x haven't a value yet ( i don't want a value at all).

How can I make a matrix with symbolic elements?

Thanks in advance.
Find all posts by this user
Quote this message in a reply
12-01-2017, 02:25 PM
Post: #2
RE: hp prime programing with symbolic matrix
Is this what you are trying to do?
z:=[[1,2],[3,4]]
z(1,1):=quote(x+2)
Find all posts by this user
Quote this message in a reply
12-02-2017, 12:02 AM
Post: #3
RE: hp prime programing with symbolic matrix
yes it's that (i didn't knew that function at all) but it says samething. I tried it in the simplest way:
z(1,1):=quote(X);
same return... Incorrect argument :/
Find all posts by this user
Quote this message in a reply
12-02-2017, 02:25 AM
Post: #4
RE: hp prime programing with symbolic matrix
Are you writing a CAS program?

Works here, e.g. with

z:=MAKEMAT(QUOTE(x),n,m);

or variants of this -- look up help for MAKEMAT -- as the central statement within the CAS program, and n and m the number of rows and columns of the desired matrix, respectively.
Find all posts by this user
Quote this message in a reply
12-18-2017, 12:22 PM
Post: #5
RE: hp prime programing with symbolic matrix
Hello.
Sorry for this long long long delay.

No, I'm not writing a CAS mode program. It's a normal program where I'm triying to make some cas operations.

Now Im triying with:
z:=cas(MAKEMAT(1,"c(2)"));

It says that the code is fine, but when I'm runing the program it returns that it's a bad argument value (without stop the program).

what I'm trying to do:
Make a matrix considered as symbolic matrix where i can put some symbolic elements.
For example. In Matlab y can type:

Z=sym(ones(1,m)) to make an ones matrix considered as symbolic to put all type elements.

What it returns:
bad argument value.

Thanks for your help and again, sorry for the delay.
Find all posts by this user
Quote this message in a reply
12-18-2017, 08:26 PM
Post: #6
RE: hp prime programing with symbolic matrix
Dear all
Is that a possible solution?

list2mat(mat2list(seq("x"+string(k),k = (0 .. 8))),3)

[["x0","x1","x2"],["x3","x4","x5"],["x6","x7","x8"]]

I do not have the option to change the strings in quotes or symbolics.

Best Regards

Rudi
Find all posts by this user
Quote this message in a reply
12-18-2017, 10:17 PM
Post: #7
RE: hp prime programing with symbolic matrix
Or you can try with something like: CAS("matrix(2,2,(j,k)→c(j+k))")
Find all posts by this user
Quote this message in a reply
12-19-2017, 03:05 PM (This post was last modified: 12-19-2017 04:16 PM by Rudi.)
Post: #8
Solved: hp prime programing with symbolic matrix
Dear all

I think, that I've solved this Problem.

Only in CAS-View:
restart // purge all CAS-Variables or use purge()
list2mat(mat2list(seq(expr("x"+string(k)),k = (0 .. 8))),3);

// StartValue is 0 i.e. x0
// EndValue is 8 i.e. x8
// Columns of the Matrix is 3

Result:
[[x0,x1,x2],[x3,x4,x5],[x6,x7,x8]]

Only to Info:
Save Values to the Variables
[[x0,x1,x2],[x3,x4,x5],[x6,x7,x8]]:=[[1,2,3],[4,5,6],[7,8,9]]

Best Regards
Rudi
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)