Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X
Of course in trhe actual sheet I would define those vectors in front of the solve block and also use a definition for the "Price" function which does not use predefined ranges:
Ну вот, а день так хорошо начинался.
ВФ, зачем Вы перешли на MCP4?
See please the sheet for Mathcad 15 but not in Matrix form.
Now I am preparing the matrix form will send it late!
@ValeryOchkov wrote:
Mathcad 15 in matrix form in attach
Why an error?
The sheet you posted does not throw any error!?
The effect which confuses you is due to the way Mathcad handles expression with ranges.
Sorry!
It was my error with indexes - hire are only 2 elements.
And I we cannot use indexes in Given-Find. I forgot about it!
See plrase my old message about it https://community.ptc.com/t5/PTC-Mathcad-Questions/Matrix-and-vector-in-Solver/m-p/20672
I was pretty sure that it would be you who would find the solution for this thread, but why not simply use vectors and matrices straightforeward? Seems the most easy way to do it to me.
BTW, if you don't like the hardcoded vector of 1's, you may replace it by funny expressions like seen in the following pic to make the solve block independent fron the matrix dimensions:
I forgot one of the easiest ways: diag(mp)*0+1
P.S.: I am not sure why the condition mp >= 0 has so much influence on the outcome (give it a try and delete it).
Thanks, Viktor and Werner!
But!
I solve the transport task of transporting coal from two mines (m) to two power plants (p) with a minimal total price.
But I want to increase the number of mines and power plants, enter the required data (new elements in vectors m and p, new rows and cols in matrix pm - prices of coil transportation from one mine to one plant) and get a new answer without adding/changing the operators in the solver block.
I see that this can not be done in Mathcad 15 and Prime - we can not work with array indexes in this block.
This is not good! Sorry!
But I want to increase the number of mines and power plants, enter the required data (new elements in vectors m and p, new rows and cols in matrix pm - prices of coil transportation from one mine to one plant) and get a new answer without adding/changing the operators in the solver block.
I suspected that and thats exactly what my last reply is dealing with!
I see that this can not be done in Mathcad 15 and Prime - we can not work with array indexes in this block.
It CAN be done - see my last reply. And you don't have to deal with array indices which is awkward anyway.
Thanks, Werner.
But we can have m=2 and p=3 for example - not square matrix mp.
Val
Must be
@ValeryOchkov wrote:
Thanks, Werner.
But we can have m=2 and p=3 for example - not square matrix mp.
I can't see any problems here:
Or, to be more generic, you can use one of the ideas given above:
BTW, I feel that the images you insert, are far too large. Images that large tend to destroy the readability of a thread.
Of course in trhe actual sheet I would define those vectors in front of the solve block and also use a definition for the "Price" function which does not use predefined ranges:
Yes! it may be the solution
And how we can here have only one not 10 equation in Solver? (the Mathcad 15 sheet in attach)
Hoorray - catanary(?) again 😉
@ValeryOchkov wrote:
And how we can here have only one not 10 equation in Solver? (the Mathcad 15 sheet in attach)
Maybe simply by using an auxiliary function which calculates the vector of distances (squared).
I got rid of your mix of literal and vector subscripts and changed back the ORIGIN to 0.
Thanks Werner!
But it is not a catenary but a big problrem of Mathcad
Careful!
p/p or m/m may throw an error if a vector element happens to be zero!
Vectors m and p have only positive values!
More interest form of input data. Mathcad Prime 5 in attach!
One More interest form of input data. Only with Mathcad Prime:
So why did they need tables, when arrays would do?
@Fred_Kohlhepp wrote:
So why did they need tables, when arrays would do?
For show Mathcad Prime!
Mathcad needs this tool: not only a 2D-table but a 3D table!