Hi folks!
Please see the attached file.
How can I multiply the two columns so that I get another column?
This sound confusing but if you look at the file you see values
for B = (0,6,7, 8, 9,10)
for B1= (2,8,9,10,11,12)

What I would want to get now is another column with values (0,48,63,80,99,120).
Is this possible?

Another question is, can Mathcad find for wich B value, B*B1=99 ?

I can only second IRstuff's advice to study the help (which BTW is really good in MC15 and below with all its examples, quicksheets, etc.) as vectorization and built-in functions like match() and lookup() are quite standard when dealing with vectors and matrices and can easily be found in the help. Lookup() and Match() (note the capital inital letters) are a bit harder to find and may also be useful.

Guys thanx!
Ive went thru v14 help topics but not much is there.
Ill have to upgrade to V15.
One question more, in rmix22 file the c=99, is there any chance that if you type for c=98, Mathcad can find the closest value wich is available for c and return values for B and B1?

The help is pretty much the same in MC14 and MC15.

If you go to Help/Vectors and Matrices/Calculating with arrays (which basically is what you are doing) you find a link to the vectorization operator and also a link to the Vector & Matrices Tutorial. At the end of that tutorial you find as an example exactly the answer to your first question - the vectorization of the product of two vectors.

The lookup functions can be found in the chapter "Functions", subchapter "Lookup Functions".

Answer to your new question: I knew it Thats exactly what the second set of lookup functions will do for you. Replace match or lookup for Match and Lookup and add as last argument the modifier string "near". This should do the job. Those functions are part of one of the four extension packs that come with Mathcad (15 and 14 as well) and the functions containing in those packs are not covered in the normal help but in the appropriate E-book. Goto Help/E-Books/Data Analysis Extension Pack and you will see in under utilities the chapter on Matching and Lookup.
As an alternative you may simply type Lookup somewhere in your sheet and while the cursor is still somewhere inside that word press F1.

If you have an educational license it may be that the e-books are installed but the license won't allow you to use those extended functions. If thats the case you would have to write your own routines to get nearest values.

I forgot to thank you rmix22.
It works like a chram.
Just as you mentioned the Capital letter makes a big difference
Can you please look at the picture attached.
Thanks to your advices guys I made a simple range that was able to cacluate Area enclosed by a line and a shape as seen in the picture. Limit condition were also defined
x was defined as a range.
bx was dependedn on the x and angle fi (wich was fixed).

The situation that I would do next is that the angle fi also varies. eg. from 0 deg to 45 deg
I could make ranges of x0deg , x1deg, x2deg,....and get all values but is there any way that this could be automated so that fi and x are defined as a ranges....
egsample
First :
for fi=0deg Mathcad uses x=1, x=2, x=3, x=4...and finds areas for this situation

second:
for fi=1deg Mathcad runs x again x=1, X=2, x=3, x=4...and finds areas for this situation

Third:
for fi=2deg Mathcad runs x again x=1,x=2,x=3, x=4....you get the picture

You'd better use vectors instead of range variables.
You should use ranges only for three reasons:

use a range to index matrix/vector elements

use a range in a program for-loop

use a range on the abscissa of a xy-xplot

As tempting as it may be, refrain from using ranges for anything else!

That said create two vectors x and phi and two ranges to index those vector (running from 0 in stepwidth 1), lets say i.x and i.phi. Then you easily can create a matrix with all your combinations of x and phi by defining M[i.x,i.phi:=<calculations using x[x.i und phi[i.phi>

BTW, why post you again pictures instead of mathcad sheets!

Sorry,
heres the mathcad file with an egsample of calculating area with fixed angle (like in the picture previously attached)
rmix22,
can you do an egsample of what you said in your previous post,on varying the angle alpha also...

Your picture is wrong! Either the position of phi is wrong or it should be bx=x/tan(phi)!! How should it be?

Can you provide a correct drawing with all used variables (x,xb,bx,phi and possible an a,too, to fully dimension the rectangle

What should be the result if the line does not only cut off a triangle but a trapezoid or even a pentagon? Should the result be the correct area or should it be simply NaN to denote an invalid situation?

What should be the range for x and its stepwidth (it has not to be 1mm or the like, it can be anything

Whats the range and stepwidth of phi

The end result would be a table. Should a row of this table show the results for a constant x and varying angle phi and the column the values for a constant phi or should it be the other way round?

Is the table supposed to have column and row headers or should it consist of the pure data?

Your two equations are contradictory. Your picture shows bx/x = tan(phi), while your Mathcad shows bx/x = 1/tan(alpha)

Moreover, you have only one independent variable, since you've structured the problem to be a tangent problem and alpha is atan(x/bx), so cannot independently vary alpha and x

@IRstuff: You (like me) got confused as of bx vs. xb. So we can vary both x and the angle and create a table of values very easily (Area(x,phi):=x^2/(2*tan(phi))) but some of the values in the table are invalid as the line would cross the top line more than b away from the upper right corner.

Guys, this is just too much of me to ask you.
If I explain the whole situation youll inderstand what Im after but the thing is just HUGE and I dont wanna be a person who get everything served.
I like to tackle my brain and accept the challange of doing something on my own.
Ill ask few question thats for shure but until I dont fully understand and point out the problems of my task its just not OK from me to bother you with it.
Hope you understand.
I definetly need your help around some things until then I must do this on my own...

I guess nobody asked for the whole, huge project being explained. The problem was that you supplied a wrong drawing and the problem of your question was insufficient specified and would have required closer specifications.

Does your answer mean that the table I provide was not what you were looking for?

OK.
As you noticted earlier when I posted the image of a rectangle shape, there were lot of things unexplained.
The dimensions of a rectangle are defined values. These are h and b.
Angle phi and x value vary and are basicly main factors wich influence the end results, lets call them U1, U2 and V values.
Looking at the previous picture you can see that when angle phi is 0deg and x=0, the area would be 0.
When x stars to "climb" you would basicly have rectangle area wich is defined by the width b and the height x (until x is greater then height of the rectangle, then it uses h value instead of x)...you can seens some programin lines aready!
1st case is when phi=0deg and x ranges from 0mm to infinty.
Ive programed this and it works great.
Mathcad calulates area thats enclosed by the angle and the x value and in the end it gives vaue for U1 U2 and V.
SO basicly for phi=0deg and x=0...infinty I should get a plot of value for U (abcis) and V (ordinate)
Same procedrue goes for phi=1deg and then for phi=2deg, 3 deg u to 90deg.
Only difference is that Ive given Mathcad conditions on how to calculate area of a shape since when the angle is not 0 deg, you can have a triangle, trapez, pentangle and finaly rectangle wich also depend on the x value.
For each of these diferent steps in phi from 1deg-90deg...you should get a plot of values U and V wich basicly create a 3D plot (a shape enclosed in 90deg, like a line revolve around the axis thats pointing upwards).
rmix22 posted and egsammple of how to maybe solve this but used a vector approach wich seems to worked but it didnt do what I ment, due to my poor explenation.
Hope this is more clear now.
Now, Ive writen the whole program wich caclulates final values but it only gives results for one value of phi and one value of x.
This should be converted to rmix22 showed previously...
Could it be done and how much pain in the A.. is this?

Sorry, but I don't understand what you mean and what you need.
I don't have the slightest idea what U, I1, U2 and V should be and what you are after.
Please start from scratch: new thread, new sketch (most important, I guess), new explanation and new Mathcad sheet.

infinity? what's the point of that? nothing beyond h makes any sense, does it?

pentangle? where does that come from? I don't see anything more than a trapezoid

In any case, I don't see that programming is absolutely needed. This is 2-D problem, so a 2-D array is all that is needed, along with some IF statements, unless you've still not fully described the problem. It's only now that the problem even remotely makes any sense, and it's sounding a lot like homework, which is forbidden.

I agree with IRStuff that this smells like homework and this is not the right place to ask for homeworks help.
You sure will find places where homework help is offered but when you go there, there are some points to consider. First in most of those places you have to show that you did something yourself first. People possibly are not willing to do your whole work there. Most important is to describe the problem as crisp and clear as possible - short and to the point. If you use a drawing to illustrate what you are after, it should show ALL the variables used in your description! So far you were talking about variables phi, x, bx, xb, then you introduced U, U1, U2 and V and your new drawing talks about two new angles alpha and beta.
Looks like you should get clear about the problem yourself first and not just copy illustrations from different sources which use different names.

As this all really looks like somebody struggling with his homework and as the subject of this long thread reads "Range problem..." I consider the thread answered and bow out. Good luck!

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts. The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Learn methods and guidelines for using stereolithography (SLA) 3D printed molds in the injection molding process to lower costs and lead time. Discover how this hybrid manufacturing process enables on-demand mold fabrication to quickly produce small batches of thermoplastic parts. Download Now

Examine how the principles of DfAM upend many of the long-standing rules around manufacturability - allowing engineers and designers to place a partâ€™s function at the center of their design considerations. Download Now

Metal 3D printing has rapidly emerged as a key technology in modern design and manufacturing, so itâ€™s critical educational institutions include it in their curricula to avoid leaving students at a disadvantage as they enter the workforce. Download Now

This ebook covers tips for creating and managing workflows, security best practices and protection of intellectual property, Cloud vs. on-premise software solutions, CAD file management, compliance, and more. Download Now

## RE: Range problem...

http://files.engineering.com/getfile.aspx?folder=3...

TTFN

FAQ731-376: Eng-Tips.com Forum Policies

Need help writing a question or understanding a reply? forum1529: Translation Assistance for Engineers

## RE: Range problem...

I can only second IRstuff's advice to study the help (which BTW is really good in MC15 and below with all its examples, quicksheets, etc.) as vectorization and built-in functions like match() and lookup() are quite standard when dealing with vectors and matrices and can easily be found in the help. Lookup() and Match() (note the capital inital letters) are a bit harder to find and may also be useful.

## RE: Range problem...

Ive went thru v14 help topics but not much is there.

Ill have to upgrade to V15.

One question more, in rmix22 file the c=99, is there any chance that if you type for c=98, Mathcad can find the closest value wich is available for c and return values for B and B1?

## RE: Range problem...

If you go to Help/Vectors and Matrices/Calculating with arrays (which basically is what you are doing) you find a link to the vectorization operator and also a link to the Vector & Matrices Tutorial. At the end of that tutorial you find as an example exactly the answer to your first question - the vectorization of the product of two vectors.

The lookup functions can be found in the chapter "Functions", subchapter "Lookup Functions".

Answer to your new question: I knew it Thats exactly what the second set of lookup functions will do for you. Replace match or lookup for Match and Lookup and add as last argument the modifier string "near". This should do the job. Those functions are part of one of the four extension packs that come with Mathcad (15 and 14 as well) and the functions containing in those packs are not covered in the normal help but in the appropriate E-book. Goto Help/E-Books/Data Analysis Extension Pack and you will see in under utilities the chapter on Matching and Lookup.

As an alternative you may simply type Lookup somewhere in your sheet and while the cursor is still somewhere inside that word press F1.

If you have an educational license it may be that the e-books are installed but the license won't allow you to use those extended functions. If thats the case you would have to write your own routines to get nearest values.

## RE: Range problem...

It works like a chram.

Just as you mentioned the

Capital letter makes a big differenceCan you please look at the picture attached.

Thanks to your advices guys I made a simple range that was able to cacluate Area enclosed by a line and a shape as seen in the picture. Limit condition were also defined

x was defined as a range.

bx was dependedn on the x and angle fi (wich was

fixed).The situation that I would do next is that the angle fi also varies. eg. from 0 deg to 45 deg

I could make ranges of x0deg , x1deg, x2deg,....and get all values but is there any way that this could be automated so that fi and x are defined as a ranges....

egsample

First :

for fi=0deg Mathcad uses x=1, x=2, x=3, x=4...and finds areas for this situation

second:

for fi=1deg Mathcad runs x again x=1, X=2, x=3, x=4...and finds areas for this situation

Third:

for fi=2deg Mathcad runs x again x=1,x=2,x=3, x=4....you get the picture

## RE: Range problem...

You should use ranges only for three reasons:

- use a range to index matrix/vector elements
- use a range in a program for-loop
- use a range on the abscissa of a xy-xplot

As tempting as it may be, refrain from using ranges for anything else!That said create two vectors x and phi and two ranges to index those vector (running from 0 in stepwidth 1), lets say i.x and i.phi. Then you easily can create a matrix with all your combinations of x and phi by defining M[i.x,i.phi:=<calculations using x[x.i und phi[i.phi>

BTW, why post you again pictures instead of mathcad sheets!

## RE: Range problem...

heres the mathcad file with an egsample of calculating area with

fixed angle(like in the picture previously attached)rmix22,

can you do an egsample of what you said in your previous post,on varying the angle alpha also...

## RE: Range problem...

used variables (x,xb,bx,phi and possible an a,too, to fully dimension the rectangleall## RE: Range problem...

Moreover, you have only one independent variable, since you've structured the problem to be a tangent problem and alpha is atan(x/bx), so cannot independently vary alpha and x

TTFN

FAQ731-376: Eng-Tips.com Forum Policies

Need help writing a question or understanding a reply? forum1529: Translation Assistance for Engineers

## RE: Range problem...

@mar2850: The attached file should help.

## RE: Range problem...

If I explain the whole situation youll inderstand what Im after but the thing is just HUGE and I dont wanna be a person who get everything served.

I like to tackle my brain and accept the challange of doing something on my own.

Ill ask few question thats for shure but until I dont fully understand and point out the problems of my task its just not OK from me to bother you with it.

Hope you understand.

I definetly need your help around some things until then I must do this on my own...

## RE: Range problem...

Does your answer mean that the table I provide was not what you were looking for?

## RE: Range problem...

## RE: Range problem...

As you noticted earlier when I posted the image of a rectangle shape, there were lot of things unexplained.

The dimensions of a rectangle are defined values. These are h and b.

Angle phi and x value vary and are basicly main factors wich influence the end results, lets call them U1, U2 and V values.

Looking at the previous picture you can see that when angle phi is 0deg and x=0, the area would be 0.

When x stars to "climb" you would basicly have rectangle area wich is defined by the width b and the height x (until x is greater then height of the rectangle, then it uses h value instead of x)...you can seens some programin lines aready!

1st case is when phi=0deg and x ranges from 0mm to infinty.

Ive programed this and it works great.

Mathcad calulates area thats enclosed by the angle and the x value and in the end it gives vaue for U1 U2 and V.

SO basicly for phi=0deg and x=0...infinty I should get a plot of value for U (abcis) and V (ordinate)

Same procedrue goes for phi=1deg and then for phi=2deg, 3 deg u to 90deg.

Only difference is that Ive given Mathcad conditions on how to calculate area of a shape since when the angle is not 0 deg, you can have a triangle, trapez, pentangle and finaly rectangle wich also depend on the x value.

For each of these diferent steps in phi from 1deg-90deg...you should get a plot of values U and V wich basicly create a 3D plot (a shape enclosed in 90deg, like a line revolve around the axis thats pointing upwards).

rmix22 posted and egsammple of how to maybe solve this but used a vector approach wich seems to worked but it didnt do what I ment, due to my poor explenation.

Hope this is more clear now.

Now, Ive writen the whole program wich caclulates final values but it only gives results for one value of phi and one value of x.

This should be converted to rmix22 showed previously...

Could it be done and how much pain in the A.. is this?

## RE: Range problem...

I don't have the slightest idea what U, I1, U2 and V should be and what you are after.

Please start from scratch: new thread, new sketch (most important, I guess), new explanation and new Mathcad sheet.

## RE: Range problem...

pentangle? where does that come from? I don't see anything more than a trapezoid

In any case, I don't see that programming is absolutely needed. This is 2-D problem, so a 2-D array is all that is needed, along with some IF statements, unless you've still not fully described the problem. It's only now that the problem even remotely makes any sense, and it's sounding a lot like homework, which is forbidden.

TTFN

FAQ731-376: Eng-Tips.com Forum Policies

Need help writing a question or understanding a reply? forum1529: Translation Assistance for Engineers

## RE: Range problem...

You sure will find places where homework help is offered but when you go there, there are some points to consider. First in most of those places you have to show that you did something yourself first. People possibly are not willing to do your whole work there. Most important is to describe the problem as crisp and clear as possible - short and to the point. If you use a drawing to illustrate what you are after, it should show ALL the variables used in your description! So far you were talking about variables phi, x, bx, xb, then you introduced U, U1, U2 and V and your new drawing talks about two new angles alpha and beta.

Looks like you should get clear about the problem yourself first and not just copy illustrations from different sources which use different names.

As this all really looks like somebody struggling with his homework and as the subject of this long thread reads "Range problem..." I consider the thread answered and bow out. Good luck!