Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
I feel like this may be a simple question to answer, but I'm having a hard time finding a solution on my own, so hopefully someone can help me with this.
I've been exploring symbolic/explicit calculation for a short while now, but keep running into a wall when I want to display the solution to a max or min function as the actual variable and not the numeric solution. What I keep getting is:
a:=1
b:=2
c:=3
min(a,b,c) -> min(a,b,c),
min(a,b,c) -> min(1,2,3), or
min(a,b,c) -> 1
What I would like to be able to see is:
min(a,b,c) -> a
If someone could point me in the right direction as to what keywords to use to achieve this, I'd really appreciate it.
Don't think that "explicit" or any other keyword will do what you want as soon as we have concrete values for a,b,c.
Not exactly what you demanded but the best I could come up is
So there's no way to symbolically evaluate a max/min function once you have concrete values?
For my current project I'm looking to evaluate different safety ratios, so a,b,c and are actually (Vd1/Vr1), (Vd2/Vr2), (Vd3/Vr3), which will need numerical values in order to compare them.
In case anyone else is looking for this as well, this is a method that works, but looks ugly as sin and will only get worse with the more variables you're comparing.
It's a series of "if" statements that compare the number/variable to the solution of the max/min function. It works fine if no units are involved (in the case of comparing Vd/Vr as "lbf" cancel out), but otherwise if comparing numbers with units, you have to remove them in order to avoid an error ("value must be scalar"). Here's a sample of both cases:
Clever workaround.
Still not as easy and natural as it should be, but could using vectors be an option?
Here's yet another (cumbersome) way of indicating which variable is the minimum .
Alan
Nice.
Your version is a lot more compact, and is easily modifiable for more/less values. Only restriction seems to be variables that rely on numerical subscript, but I think you can get around that by including some "substitute" lines after "explicit,minidx" if you had to use letters instead (i.e. substitute, V[sub]cb = V[sub]1)
Not sure how the substitute would interact with the (rather sensible) explicit, but maybe worth a try.