cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

About matrix definition

jayeszamudio
1-Newbie

About matrix definition

Hi, i suppose my problem has a easy solution, but I cant find it.

I define a simple operation k(B), I got the results but by some circunstance I got a solution that I need to change, so I want to create a new matrix with the modified results and call it back to use it on an equation but I wrong results... (image attached)..

As you can see in the image, when I select the new matrix, I can not change the Math Properties (Tab).

Hope you can help me.

1 ACCEPTED SOLUTION

Accepted Solutions
athurin
4-Participant
(To:jayeszamudio)

I think I cracked the problem. 1st problem comes form the fact that B is NOT a vector, but a range variable. Because B and the manually defined jB are different in nature (range variable VS matrix), the functions applied to them are applied differently.

The second problem is much easier. If I uunderstand what you are trying to do, all you need to do is to define I1, I2... as functions of z, and it all works.

Sheet attached with solution to both problems (at the end).

View solution in original post

7 REPLIES 7
athurin
4-Participant
(To:jayeszamudio)

When you define j(B), you actually define a function that returns a constant vector/matrix. Not sure that's what you intended...

Next, your program does operation on the whole B vector, which, in my opinion, is bad karma. It depends on what your Df variable is, but I would personally work with the elements of B, not B itself.

That being said, when I try to do something similar; I don't get the same result. OK, I am too lazy to copy every single value, but overall, it works for me. What I would suggest is :

1/ try using the vectorization tool in your dc function

2/ upload your sheet (providing it is not Mathcad Prime 3.1)

j(B) isn't really a function of B; try re-defining it as jB:=

As jB is no t=longer a function of B the same argument should apply to the definition of D.c.

since prime doesn't use the array B in the function, I think that it is repeating the Dc function call for each row in B and generating the same result (using the static values in j(B) each time).

Thanks Adrien Thurin and A Westerman‌ for your time!

I tried to solved using your suggestions but I couldn't; I attached the file, hope you can help me.

By the way, I attached in the same file a problem similar to the previous, hope can check it and help me to solve it.

Greetings.

athurin
4-Participant
(To:jayeszamudio)

The second problem is easy : you are trying to multiply matrix with incompatible sizes. if M is a matrix, M*M is a matrix product, and you can't multiply vectors this way. You need to replace your product by a scalar product, or an element-by-element product, depending on the result you are expecting.

But, either way, if I am not mistaken, the problem isn't set properly. In my understanding, you want to express Iz as a function of z. Which means : calculate I1, I2... and Iz for each value of z. If that's the case, using vectors is probably not the simplest way to do so. Am I right ?

Your first problem is weird, I don't understant yet what is happening, but I am working on it ...

athurin
4-Participant
(To:jayeszamudio)

I think I cracked the problem. 1st problem comes form the fact that B is NOT a vector, but a range variable. Because B and the manually defined jB are different in nature (range variable VS matrix), the functions applied to them are applied differently.

The second problem is much easier. If I uunderstand what you are trying to do, all you need to do is to define I1, I2... as functions of z, and it all works.

Sheet attached with solution to both problems (at the end).

Hi Adrien!!.. thank you a lot for your interest and time.

I saw your solution and it is totally right... but I didn't told you that this "problem" is a part of a bigger calculation sheet where all functions are dependant of the B range variable... so I would like to ask you if there's workaround for that problem using the range variable option...

Or I was thinking if theres a way to use a kind of if instruction to force that the first k(B) value should be equal to 1 when B=1, because this is the only value at which my formula k(B) gives a strange result.

Thanks a lot.

LAST UPDATE: I am trying to change everything to a vector style...

athurin
4-Participant
(To:jayeszamudio)

What is the problem with B=1 ?

When B=1, Df/B = 1.5, therefore k(B) = atan(1.5) which, according to my calculator, is indeed equal to 0.98.

If what you want is k(B)=1 when B<Df, you can write it

k(X):=min(1,Df/X)

when you apply it to B, your result will be in "range variable" type, and should give the right result ... (or at least, it gives the same result for B>= 1.5 ...)

Top Tags