Can anyone help with a problem I'm having with with a Given function inside a loop as shown below:
The function Fopt is defined previously. The steps work correctly one at time when f1 is not an indexed function but it won't work as shown. Any suggestions?
Solved! Go to Solution.
Thats true, nonetheless you can get what you are looking for by turning the solve block into a function.
For further details you would need to attach the worksheet.
Your constraint Ropt1<1000 seems to be useless and without any effect. We don't see how your Ropt1 is defined, but as can be seen in the pic, its not dependent on the variables Ropt2 or XOpt2. So there is only one equation for two variables.
And even if you make Ropt1 dependent on at least one of the two variables its an inequality and so its just a constraint and not a forcing equation. It means that you'll probably get an infinite number of solutions.
Hi,
One suggestion is to parametrize the solve block then use the resulting function to loop.
Enclose your sheet if you do not know how to parametrize the solve block.
As the solve block is only really one equation equal to zero you could try the root function.
Cheers
Terry
Hi Terry,
Thanks very much for your suggestions. I'll try the root function but I would be keep to see how the solve block can be parameterized. Is it possible to annotate the code I gave originally?
Regards,
Trevor
Hi,
I missed the really obvious.
Solving for two variables with only one equation is not going to work.
Cheers
Terry
Hi Terry,
Thanks. There is a second equation. We are searching only for real parts <= 1000. Maybe this hasn't been implemented correctly. As I said originally, the basic steps work singly but not when looped.
Trevor
As a first step it will be good to have solutions for separate i=1, 1=2 etc
Hi,
Here is an example of a parametrized solve block.
Cheers
Terry
Hi Terry,
Thanks for your help and suggestions.
Trevor
Thanks to all for your comments and suggestions. After all this I have seen in a MathCad manual (an old version) that 'MathCad does not allow inside a solve block ..,the use of range variables or expressions involving range variables of any kind'.
Thats true, nonetheless you can get what you are looking for by turning the solve block into a function.
For further details you would need to attach the worksheet.
Your constraint Ropt1<1000 seems to be useless and without any effect. We don't see how your Ropt1 is defined, but as can be seen in the pic, its not dependent on the variables Ropt2 or XOpt2. So there is only one equation for two variables.
And even if you make Ropt1 dependent on at least one of the two variables its an inequality and so its just a constraint and not a forcing equation. It means that you'll probably get an infinite number of solutions.