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

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Matrix Complex Subraction

rjaison
1-Visitor

Matrix Complex Subraction

Hello,

I have two one dimensional matrix An & Bn

n= No of column of the Matrix

Please see the attachment, which is quite easy to understand what I want to achieve

Thanks

PS I am using Math CAD 14

ACCEPTED SOLUTION

Accepted Solutions
LucMeekes
23-Emerald III
(To:rjaison)

Attached is a version that returns the result with units.

Note that Mathcad internally stores values with its internal representation of a unit. That's m2 (metres squared) for areas. If you want to display the result in mm2 (millimetres squared) you'll have to type mm^2 in the units placeholder following the result.

The calculated results should not differ for different input/output units, provided that you account for those units. So if both input vectors are given in mm2, you'll get the result (by default) in m2. Now realise that 1 m2 = 1 000 000 mm2.

Success!

Luc

View solution in original post

18 REPLIES 18
RichardJ
19-Tanzanite
(To:rjaison)

which is quite easy to understand what I want to achieve

Not to me. I understand how you get 0 as the first answer, and 600 as the second. Please explain the logic you use to get 0 as the third answer. It looks like this was calculated in an Excel spreadsheet, in which case please post the spreadsheet.

Hi,

I am sorry I made a terrible mistake

Please see the attachment "Complex Matrix Corrected"

BR,

J.Randeep

rjaison
1-Visitor
(To:rjaison)

Hi Everyone,

I am still struggling with this Matrix Complex Subtraction

I am thinking it is more like a Boolean Subtraction, but I couldn't figure this out though.

May be somebody comes up with a genius solution !

J.Randeep

RichardJ
19-Tanzanite
(To:rjaison)

Your question is still not fully defined. In your example the colored sections are all separated by a case where An=1000 and Bn=0, so the result is 1000. What to do if the colored sections overlap (for example, if the third element of Bn is 1100, or if the 9th and 10th elements of An and Bn are removed)? What to do if the sum of Bn is greater than the sum of An?

StuartBruff
23-Emerald III
(To:rjaison)

Randeep Jaison wrote:

I am sorry I made a terrible mistake

Please see the attachment "Complex Matrix Corrected"

Could you please post an image with the Formula display turned on for your Excel worksheet? That would give us more idea of what your are trying to achieve and possibly suggest a way of implementing it within Mathcad.

Stuart

Hi,

The Excel is just a principle of what I would like to achieve.

There is no actual calculation in that excel sheet, it is just a text.

But any ways I have attached that Excel Sheet, if it is of any help!

I can further clarify if you need any.

J.Randeep

LucMeekes
23-Emerald III
(To:rjaison)

Hi,

You give a puzzle, you get one in return.

See if attached sheet performs as you want it. Also with respect to Richards question: what if the regions overlap?

If not, send it back with more examples of what the output should be with given input.

Luc

Hi LucMeekes,

It is exactly the way I want it to be..

It is so perfect

About the overlap in the region there wont be any, as the constrains are set according.

How can I adopt this into my Math CAD sheet it seems like some kind of the special code.

Could you please advise.

Thanks.

J.Randeep

LucMeekes
23-Emerald III
(To:rjaison)

Just insert my sheet as a reference in (the top of) any of your sheets where you need the function

(From the menu: Insert -> Reference).

Have you tried different values in Vector A too?

Luc

rjaison
1-Visitor
(To:rjaison)

P.S I hope this subtraction function with any n number of row matrix.

J.Randeep

rjaison
1-Visitor
(To:rjaison)

Hi,

SymmetricSubtract Warning.JPG

I am getting this warning.

Is that mean if I do the reference as you mention then I have to have this sheet in the system I am working all the time.

Is there any way, I would preferred to have them in one sheet

J.Randeep

rjaison
1-Visitor
(To:rjaison)

Hi Again,

Yes I made a mistake on the Syntax I used minus sign instead of comma.

Yes it work fine with a bigger matrix as well.

Please do advise on the reference thing...If I would like to have that function in the same file without the refference

Thanks,

J.Randeep

rjaison
1-Visitor
(To:rjaison)

Hi,

I had one problem when the input matrix A and B has a unit mm2 when it dose the subtraction the output comes as meter2 as I have math cad sheet in SI unit system.

But when I change the output to mm2 the summation of the Output Matrix is quite different.

J.Randeep

LucMeekes
23-Emerald III
(To:rjaison)

Attached is a version that returns the result with units.

Note that Mathcad internally stores values with its internal representation of a unit. That's m2 (metres squared) for areas. If you want to display the result in mm2 (millimetres squared) you'll have to type mm^2 in the units placeholder following the result.

The calculated results should not differ for different input/output units, provided that you account for those units. So if both input vectors are given in mm2, you'll get the result (by default) in m2. Now realise that 1 m2 = 1 000 000 mm2.

Success!

Luc

RichardJ
19-Tanzanite
(To:LucMeekes)

Out of curiosity, why bury it in a locked area? What's so secret (if it's not so secret that you can't even tell me why it's so secret )?

LucMeekes
23-Emerald III
(To:RichardJ)

Rich,

I hid it because I wasn't really finished with it, because I wanted some more info on the borderline cases, but mostly because it was ugly.

I now attached a worksheet with two different implementations that I find presentable.

Luc

RichardJ
19-Tanzanite
(To:LucMeekes)

. I have published ugly code many times because I was too lazy to make it nicer. If I provide someone with a working but ugly solution they can make it pretty if they wish to spend the time

Hi,

It works perfect now.

I guess I have to use this function as a reference on the contrary I would have preferred this function in the same calculation sheet itself.

any ways, thanks for your help.

BR,

J.Randeep

Announcements

Top Tags