Get Help

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Community
- :
- PTC Mathcad
- :
- PTC Mathcad
- :
- Matrices conundrum

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-15-2014
04:08 AM

08-15-2014
04:08 AM

Hi all,

I completed an introductory course on mathcad a few years back, but these sort of logical problems scrambles my brain, so if anyone could help me out I would be much abliged!

I have a problem whereby I have 25 different powder based flavourings of foods, each flavour is made up of a selection between 7-15 ingredients from a range of 51 different ingredients. Set flavourings are directed to three different extruders, 8 of these flavourings are directed to extruder A, 15 to extruder B, and 2 to C.

I’m looking to find the number of any combination of ingredients for any setup of all three extruders.

I have attempted it in Excel using Pivottable and select the three flavouring individually, which is fine if I need to know a specific setup, but it would take some considerable time to manually choose each combination of flavouring if I wanted to find the combination with the most ingredients.

I presume it is possible to display the results in a matrix format where the function was applied to all combinations. Also following this I will be adding data such as the combined weight of the mixes to determine maximum batch weight and selected ingredients. It would also be nice if i could display it in a 3D plot.

Regards,

James

Solved! Go to Solution.

Labels:

1 ACCEPTED SOLUTION

Accepted Solutions

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-15-2014
05:47 PM

08-15-2014
05:47 PM

AlanStevens wrote:

Werner Exinger wrote:

Where does your 252 come from?

2*14*9=252. Thats the number of possibilities to chose three flavours - one flavour from each extruder.

Ah! I see; the extruders always use just one of the allocated flavours. Must be so obvious to James, but wasn't to me!

Neither to me. But if I am correct about that interpretation, I guess that James is looking for something like the attached.

EDIT: There was an error in the function which should count the number of differernt ingredients - corrected

15 REPLIES 15

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-15-2014
04:49 AM

08-15-2014
04:49 AM

Re: Matrices conundrum

James Butler wrote:

Hi all,

I completed an introductory course on mathcad a few years back, but these sort of logical problems scrambles my brain, so if anyone could help me out I would be much abliged!

I have a problem whereby I have 25 different powder based flavourings of foods, each flavour is made up of a selection between 7-15 ingredients from a range of 51 different ingredients. Set flavourings are directed to three different extruders, 8 of these flavourings are directed to extruder A, 15 to extruder B, and 2 to C.

I’m looking to find the number of any combination of ingredients for any setup of all three extruders.

I have attempted it in Excel using Pivottable and select the three flavouring individually, which is fine if I need to know a specific setup, but it would take some considerable time to manually choose each combination of flavouring if I wanted to find the combination with the most ingredients.

I presume it is possible to display the results in a matrix format where the function was applied to all combinations. Also following this I will be adding data such as the combined weight of the mixes to determine maximum batch weight and selected ingredients. It would also be nice if i could display it in a 3D plot.

Regards,

James

I am not really sure what you are looking for.

In the first part you say that you are interested in the **number** of combinations, but in the second part you say you want to see a **table** and maybe even a 3D-plot.

For chosing 7 to 15 ingredients to make up one flavor you have about 5.2*10^12 combinations to do so.

To chose 25 flavor from these you have approx. 4.7*10^292 combinations.

You sure don't want to see all of those in a table. So I possibly miss the point as to which combinations of what you want to count and/or display.

Or do you mean that you simply want to know how to distribute given 25 flavors to the three extruders in the 15-8-2 way. Here you still have about 1.5*10^8 ways to do so.

When you write about your attempt in Excel you mention the selection of **three** flavors - how does this number relate to the problem you have setup above?

You are talking about a function which results you want to display in matrix format - which function? That function would have two input arguments (which ones?) and one output (which?).

Then you write that you want to add additional data like weight and do a 3D-plot. Do you really mean "add" data or do you have "replacing" data in mind? You already have a function with two inputs and one output. If you really add one data you have something which could only be displayed in 4D!

Maybe it will be a good idea to setup a worksheet with some data to play with and to demonstrate how you would like the result to look like. That way we could also see what version of Mathcad this question relates to.

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-15-2014
05:44 AM

08-15-2014
05:44 AM

Re: Matrices conundrum

Yea sorry, i its quite difficult to explain my thought train, expecially when i am not familiar with these programs or how to explain in the right terminology.

I've insered images of the excel doc where I originally attempted to solve this problem (not sure if i can attach a full .xlsx doument), hopefully this gives you an indication of what i am dealing with.

Selection of three flavours, one from each of the extruder lines so if i can somehow display the permutations/combinations* in a matracies then apply the function to this data to find the number of ingredients in each array, and then organise these to see which have the highest number of ingredients.

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-15-2014
07:44 AM

08-15-2014
07:44 AM

Re: Matrices conundrum

James Butler wrote:

Yea sorry, i its quite difficult to explain my thought train, expecially when i am not familiar with these programs or how to explain in the right terminology.

Just try normal math terminology.

I've insered images of the excel doc where I originally attempted to solve this problem (not sure if i can attach a full .xlsx doument),

You can, but I guess it won't help as motivation to look at hidden Excel cell formulas is rather low, especially as you write that this is not the solution of your problem (we still don't know what problem) but just a partial attempt.

hopefully this gives you an indication of what i am dealing with.

Unfortunately not. You haven't answered a single of the (implicit or explicit) questions.

Selection of three flavours, one from each of the extruder lines s

What do you know about the flavors available. Is the distribution of the 25 flavours to the three extruders known? If yes, we would have just 240 possible set of three flavors. You have to clearly state the problem, the condition and assumptions first. Again setting up a worksheet with variables, vectors or matrices to give us an idea of what information can be assumed as "given" may help. Then we can look for what you are trying to find out.

so if i can somehow display the permutations/combinations* in a matracies then apply the function to this data to find the number of ingredients in each array, and then organise these to see which have the highest number of ingredients.

Again, what kind of permutations/combinations? In what way you would like the result displayed im matrices (meaning of rows, columns and elelement value)? What function?

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-15-2014
09:08 AM

08-15-2014
09:08 AM

Re: Matrices conundrum

I'm not sure I fully understand, but, in Mathcad-speak, there are combin(25,8) = 1081575 ways of choosing 8 from 25 flavourings to send to A. For each of these there are combin(17,15) = 136 ways of choosing 15 from the remaining 17 flavourings to send to B (the remaining two go to C). In total therefore there are 1081575*136 = 147094200 combinations to be condsidered. That's a lot to tabulate!

Alan

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-15-2014
10:21 AM

08-15-2014
10:21 AM

Re: Matrices conundrum

Ok, lets break this problem down, the image below shows the 25 flavourings, both beef and chicken on EXtruder 3, 14 flavours on 2 and 9 on EX 1. Am i correct at saying there are 252 combinations? If so is there a way of showing it in a 3D matrix?

Now each of these flavours comprises of a set ingredients, and I want to find a way of relating functions to the '252' combinations, so that I don't have to have to assess them individually.

Tbh if this doesn't make sense now I think I'm out of my depths and I should probably brush up on my maths before I take it any further. But thanks for your input, its been a great help in knowing my limitations

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-15-2014
10:54 AM

08-15-2014
10:54 AM

Re: Matrices conundrum

There are 300 combinations for EX3 alone!

There are 25 different flavours that could go in the "top slot" in Ex3, For * each* of these there are 24 other flavours that could go in the 2nd slot in Ex3. This would give 25*24 = 600 combinations. However, we need to divide this by 2, to get 300, as each pair of flavours would occur twice in Ex3. For example, one combination would have Chicken in the top-slot and Beef in the 2nd-slot; while another combination would have Beef in the top-slot and Chicken in the 2nd-slot.

Where does your 252 come from?

Alan

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-15-2014
12:08 PM

08-15-2014
12:08 PM

Re: Matrices conundrum

Where does your 252 come from?

2*14*9=252. Thats the number of possibilities to chose three flavours - one flavour from each extruder. In the first post of James is was 2*15*8 because he stated slightly different numbers of flavors distributed to the extruders.

I am unsure about the meaning of the red, blue and black lines and I am clueless as to what kind of 3D plot or 3D-matrix James is expecting or what kind of functions he intends to "assign to the 252 combinations".

I already asked if the distribution of the 25 flavors to the three extruders is known and fixed or subject to change. But the problem with James is that he is not answering questions nor does he provide a sheet with the known information and data. So its hard up to impossible to be of help.

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-15-2014
05:39 PM

08-15-2014
05:39 PM

Re: Matrices conundrum

Werner Exinger wrote:

Where does your 252 come from?

2*14*9=252. Thats the number of possibilities to chose three flavours - one flavour from each extruder.

Ah! I see; the extruders always use just one of the allocated flavours. Must be so obvious to James, but wasn't to me!

Alan

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-15-2014
05:47 PM

08-15-2014
05:47 PM

AlanStevens wrote:

Werner Exinger wrote:

Where does your 252 come from?

2*14*9=252. Thats the number of possibilities to chose three flavours - one flavour from each extruder.

Ah! I see; the extruders always use just one of the allocated flavours. Must be so obvious to James, but wasn't to me!

Neither to me. But if I am correct about that interpretation, I guess that James is looking for something like the attached.

EDIT: There was an error in the function which should count the number of differernt ingredients - corrected

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-18-2014
06:15 AM

08-18-2014
06:15 AM

Re: Matrices conundrum

Ahh thank you, this is a great relief and it has been a steep learning curve for me, and sorry for the mistake earlier regarding the number of flavours to each extruder.

I had trouble attempting to open your zip attachment on PTC mathcad, the failure report says: The file type is not supported. Log file is located at C:\ProgramData\.......... (which doesn't exist)

Now that we have the number of combinations we could somehow display all the possible combinations, and relate inputs to each of these 25 flavours (flavours A-Y)

My thoughts were: lets say flavour A contains 5 ingredients from a selection of 51, we could display this in a binary matrix for example A=[1,0,0,0,1,0,1,0,1,1....] which would indicate that flavour A comprises of ingredient 1,5,7,9,10. If we can define all flavours using the same configuration, a combination (eg. A [extruder 1],D [extruder 2],Y [extruder3]) can be the addition of all 3 terms, eg f(A,D,Y) = [1,0,1,1,2,0,3,0,1,.....], so if we want to find the number of ingredients in that flavour combination any value >1 means that the ingredient is used in multiple extruders and therefore need to be considered 1, so following from the previous example f(A,D,Y) = [1,0,1,1,1,0,1,0,1,.....] then these can be simply added up to find the number of ingredients the combination.

Following this we need a way of applying this to all 252 combinations, any suggestions on how I can do this?

You've been a great help,

Cheers,

James

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-18-2014
06:39 AM

08-18-2014
06:39 AM

Re: Matrices conundrum

Now that we have the number of combinations we could somehow display all the possible combinations, and relate inputs to each of these 25 flavours (flavours A-Y)

My thoughts were: lets say flavour A contains 5 ingredients from a selection of 51, we could display this in a binary matrix for example A=[1,0,0,0,1,0,1,0,1,1....] which would indicate that flavour A comprises of ingredient 1,5,7,9,10. If we can define all flavours using the same configuration, a combination (eg. A [extruder 1],D [extruder 2],Y [extruder3]) can be the addition of all 3 terms, eg f(A,D,Y) = [1,0,1,1,2,0,3,0,1,.....], so if we want to find the number of ingredients in that flavour combination any value >1 means that the ingredient is used in multiple extruders and therefore need to be considered 1, so following from the previous example f(A,D,Y) = [1,0,1,1,1,0,1,0,1,.....] then these can be simply added up to find the number of ingredients the combination.

Following this we need a way of applying this to all 252 combinations, any suggestions on how I can do this?

What you outline is exactly what I Idid in the file I attached in the last post.

Unfortunately you hadn't provided a sample file to show the data structure you'd like to work with, so I created one at random to have something to play with.

Not sure why you had problems openeing the file - hope you could solve that. Its the normal compressed Mathcad file format created by Mathcad 15 (latest release) and you should be able to open it with any release of MC15 or MC14.

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-18-2014
07:00 AM

08-18-2014
07:00 AM

Re: Matrices conundrum

Bwahh, just realised I've made a rookie mistake, downloaded MC3 Prime edition instead of MC15, I think this might be the problem.

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-18-2014
07:10 AM

08-18-2014
07:10 AM

Re: Matrices conundrum

James Butler wrote:

And which version of Mathcad do you intend to solve your problem with?

Mathcad 15 sure is the more mature, mor epowerful and faster version, but unfortunately the mediocre Prime seems to be the future (if there is any future for Mathcad anyway).

But if you bought Prime you got a license for MC15 as well, so you may install and use both programs in parallel. You can also convert MC15 files to Prime format, but you will need a full installed MC15 to be able to do so.

At the time I can't do that for you as I have uninstalled Prime on some machines I usually work on because that program is of no use to me. I still have it installed on a few machines but at the moment they are out of my reach.

So while you are downloading and installing MC15 I attach a pdf printout of the file to give you an idea whats in.

Some routines may be simplified if we would use just a pure data table without row and column headers and if the flavors would not be specified by their name (string) but by their number (index). So there would be no need to use match or lookup to get the correct column of the data table and also we could omit the various submatrix commands which simply get rid of the column headers. Its up to you to provide the data in an appropriate format and probably depends on what else you want to achieve.

BTW, I already moaned about it - one problem in our communication is, that you are not answering questions. If you look at the last sentence of my first reply you find an (implicit) question about the version of MC you use.

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-18-2014
08:21 AM

08-18-2014
08:21 AM

Re: Matrices conundrum

I must admit it must be difficult for you to see what I'm taking about when I am describing in general term opposed to the correct mathematical context, to me it was clear as daylight, however its been almost a year sine I've done any such algebraic engineering mathematics so im extremely rusty, but even this encounter makes it rush back to me.

I've just joined a new engineering firm, as you would expect from a engineering company of this size MC should be accessible on most of their their computers, I've just been told that they have two licenses to MC15 but the computers that they are installed on have bitten the dust, so I'm left having to download the free copy of MC3 prime with 30 days free subscription till one of the Administrators will reinstall MC15 on my PC.

Thanks for the advice, if I have any more problems ill try explain myself in a more implicit fashion

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Notify Moderator

08-18-2014
08:45 AM

08-18-2014
08:45 AM

Re: Matrices conundrum

There is also a free 30-day eval version of Mathcad 15, which you can download. Working with Prime until you get MC15 installed doesn't make much sense as there is no way to convert a Prime worksheet into MC15 format, so you would have to type all your work again.