<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
  <channel>
    <title>MaplePrimes - answers and comments on Question, Parameterized solutions</title>
    <link>http://www.mapleprimes.com/questions/41133-Parameterized-Solutions</link>
    <language>en-us</language>
    <copyright>2026 Maplesoft, A Division of Waterloo Maple Inc.</copyright>
    <generator>Maplesoft Document System</generator>
    <lastBuildDate>Tue, 09 Jun 2026 11:29:29 GMT</lastBuildDate>
    <pubDate>Tue, 09 Jun 2026 11:29:29 GMT</pubDate>
    <itunes:subtitle />
    <itunes:summary />
    <description>The latest answers and comments added to the Question, Parameterized solutions</description>
    <image>
      <url>http://www.mapleprimes.com/images/mapleprimeswhite.jpg</url>
      <title>MaplePrimes - answers and comments on Question, Parameterized solutions</title>
      <link>http://www.mapleprimes.com/questions/41133-Parameterized-Solutions</link>
    </image>
    <item>
      <title>Equations are not points</title>
      <link>http://www.mapleprimes.com/questions/41133-Parameterized-Solutions?ref=Feed:MaplePrimes:Parameterized solutions:Comments#answer76412</link>
      <itunes:summary>The thing is that your T function above returns &lt;code&gt;T = ...&lt;/code&gt; as its value.  In other words, it is a function call (to the function =) with 2 arguments.

You need to wrap a call to &lt;code&gt;rhs&lt;/code&gt; in your definition of T and L and all should work.  ie
&lt;code&gt;T := (w, r) -&gt; rhs(Maximize(Profit(T, L, w, r), assume = nonnegative)[2][1]);&lt;/code&gt;

One minor point: for long-term maintainability of your code, I suggest you use Optimization:-Maximize rather than relying on having a 'with' being done first.</itunes:summary>
      <description>The thing is that your T function above returns &lt;code&gt;T = ...&lt;/code&gt; as its value.  In other words, it is a function call (to the function =) with 2 arguments.

You need to wrap a call to &lt;code&gt;rhs&lt;/code&gt; in your definition of T and L and all should work.  ie
&lt;code&gt;T := (w, r) -&gt; rhs(Maximize(Profit(T, L, w, r), assume = nonnegative)[2][1]);&lt;/code&gt;

One minor point: for long-term maintainability of your code, I suggest you use Optimization:-Maximize rather than relying on having a 'with' being done first.</description>
      <guid>76412</guid>
      <pubDate>Mon, 09 Jul 2007 16:36:17 Z</pubDate>
      <itunes:author>JacquesC</itunes:author>
      <author>JacquesC</author>
    </item>
    <item>
      <title>re: Equations are not points</title>
      <link>http://www.mapleprimes.com/questions/41133-Parameterized-Solutions?ref=Feed:MaplePrimes:Parameterized solutions:Comments#answer76406</link>
      <itunes:summary>Thanks Jacques!  Your solution worked and allowed me to define T(w,r). Equations are indeed not points (although the RHS of an equation in MAPLE does become a point!).

  However when I try to plot one of these new functions, say how the optimal T changes as a function or r for w=0.5 held constant or T(0.5,r), Maple complains:
 
&lt;maple&gt;
plot(T(0.5, r), r = 0.3 .. 0.4);&lt;/maple&gt;
Error, (in Optimization:-NLPSolve) unable to execute seq

  T(0.5,0.3) and T(0.5,0.4) evaluate and are well defined, and all the points in between should be OK as well.  Any ideas as to what might be going wrong? 

  Thanks again for your suggestions. 

Jonathan 

P.S --   By the way, I have many Mathcad worksheets with (considerably more convoluted) maximization problems similar to this and plot the solutions easily. The mathcad code needed to do was something like this is very compact:

S(w,r):=Maximize(Profit,T,L)      
T(w,r):=Soln(w,r)_0 
L(w,r):=Soln(w,r)_1

and then just plot T(0.5,r)


 
</itunes:summary>
      <description>Thanks Jacques!  Your solution worked and allowed me to define T(w,r). Equations are indeed not points (although the RHS of an equation in MAPLE does become a point!).

  However when I try to plot one of these new functions, say how the optimal T changes as a function or r for w=0.5 held constant or T(0.5,r), Maple complains:
 
&lt;maple&gt;
plot(T(0.5, r), r = 0.3 .. 0.4);&lt;/maple&gt;
Error, (in Optimization:-NLPSolve) unable to execute seq

  T(0.5,0.3) and T(0.5,0.4) evaluate and are well defined, and all the points in between should be OK as well.  Any ideas as to what might be going wrong? 

  Thanks again for your suggestions. 

Jonathan 

P.S --   By the way, I have many Mathcad worksheets with (considerably more convoluted) maximization problems similar to this and plot the solutions easily. The mathcad code needed to do was something like this is very compact:

S(w,r):=Maximize(Profit,T,L)      
T(w,r):=Soln(w,r)_0 
L(w,r):=Soln(w,r)_1

and then just plot T(0.5,r)


 
</description>
      <guid>76406</guid>
      <pubDate>Mon, 09 Jul 2007 19:20:15 Z</pubDate>
      <itunes:author>Jonathan
 Conning
</itunes:author>
      <author>Jonathan
 Conning
</author>
    </item>
    <item>
      <title>handling symbolic arguments</title>
      <link>http://www.mapleprimes.com/questions/41133-Parameterized-Solutions?ref=Feed:MaplePrimes:Parameterized solutions:Comments#answer76405</link>
      <itunes:summary>The problem is that T cannot handle symbolic arguments.  There are a few ways to work around this.  One is to modify the assignment of T so that it does not generate an error if one or more of its arguments are symbolic. For example:&lt;pre&gt;
T := proc(w,r)
   if not (w::numeric and r::numeric) then return 'T'(w,r) end if;
   (w, r) -&gt; rhs(Maximize(Profit(T, L, w, r), assume = nonnegative)[2][1]);
end proc:&lt;/pre&gt;
This returns an unevaluated call to T if T is called with nonnumeric arguments.

A simpler approach, which avoids modifying T, is to create a one parameter function and pass it to plot:&lt;pre&gt;
plot( r -&gt; T(0.5,r), 0.3 .. 0.4);&lt;/pre&gt;Note that the second argument to plot is a "naked" range, there is no dummy parameter (i.e., r = 0.3..0.5).  This can also be achieved by using the curry procedure:&lt;pre&gt;
plot(curry(T,0.5), 0.3 .. 0.4)&lt;/pre&gt;See its help page for details.  

One final method is to prevent premature evaluation of the expression T(0.5,r).  That can be done by surrounding it with forward quotes:&lt;pre&gt;
plot('T(0.5,r)', r=0.3..0.5)&lt;/pre&gt;</itunes:summary>
      <description>The problem is that T cannot handle symbolic arguments.  There are a few ways to work around this.  One is to modify the assignment of T so that it does not generate an error if one or more of its arguments are symbolic. For example:&lt;pre&gt;
T := proc(w,r)
   if not (w::numeric and r::numeric) then return 'T'(w,r) end if;
   (w, r) -&gt; rhs(Maximize(Profit(T, L, w, r), assume = nonnegative)[2][1]);
end proc:&lt;/pre&gt;
This returns an unevaluated call to T if T is called with nonnumeric arguments.

A simpler approach, which avoids modifying T, is to create a one parameter function and pass it to plot:&lt;pre&gt;
plot( r -&gt; T(0.5,r), 0.3 .. 0.4);&lt;/pre&gt;Note that the second argument to plot is a "naked" range, there is no dummy parameter (i.e., r = 0.3..0.5).  This can also be achieved by using the curry procedure:&lt;pre&gt;
plot(curry(T,0.5), 0.3 .. 0.4)&lt;/pre&gt;See its help page for details.  

One final method is to prevent premature evaluation of the expression T(0.5,r).  That can be done by surrounding it with forward quotes:&lt;pre&gt;
plot('T(0.5,r)', r=0.3..0.5)&lt;/pre&gt;</description>
      <guid>76405</guid>
      <pubDate>Mon, 09 Jul 2007 20:49:21 Z</pubDate>
      <itunes:author>Joe
 Riel
</itunes:author>
      <author>Joe
 Riel
</author>
    </item>
    <item>
      <title>re:handling symbolic arguments</title>
      <link>http://www.mapleprimes.com/questions/41133-Parameterized-Solutions?ref=Feed:MaplePrimes:Parameterized solutions:Comments#answer76392</link>
      <itunes:summary>  Thanks Joe. The last three suggestions all worked.

  I'm still trying to comprehend the principle at work here however. Why is it that when I try this:  

&lt;code&gt;plot(T(.5, r), r = .3 .. .4)&lt;/code&gt;

..Maple interprets r as a symbolic argument (if I'm understanding you)?  Whereas x is not a symbolic argument in a simple procedure call like this:

&lt;code&gt;
plot(sin(x), x = 0 .. 2*Pi)&lt;/code&gt;


 Mystery aside, thanks to both of you. It would have taken me a long time to figure this all out, and now I know how to make what I want happen.</itunes:summary>
      <description>  Thanks Joe. The last three suggestions all worked.

  I'm still trying to comprehend the principle at work here however. Why is it that when I try this:  

&lt;code&gt;plot(T(.5, r), r = .3 .. .4)&lt;/code&gt;

..Maple interprets r as a symbolic argument (if I'm understanding you)?  Whereas x is not a symbolic argument in a simple procedure call like this:

&lt;code&gt;
plot(sin(x), x = 0 .. 2*Pi)&lt;/code&gt;


 Mystery aside, thanks to both of you. It would have taken me a long time to figure this all out, and now I know how to make what I want happen.</description>
      <guid>76392</guid>
      <pubDate>Tue, 10 Jul 2007 06:38:45 Z</pubDate>
      <itunes:author>Jonathan
 Conning
</itunes:author>
      <author>Jonathan
 Conning
</author>
    </item>
    <item>
      <title>more symbolic args</title>
      <link>http://www.mapleprimes.com/questions/41133-Parameterized-Solutions?ref=Feed:MaplePrimes:Parameterized solutions:Comments#comment85301</link>
      <itunes:summary>Excellent question.  In both cases the r is a symbolic argument.  However, the definition of the sin procedure is such that if it gets a symbolic argument (say x) it returns the unevaluated function sin(x).  You can inspect the sin procedure by typing&lt;pre&gt;
interface(verboseproc=2):
print(sin);&lt;/pre&gt;
The portion that returns the unevaluated function is a bit tricky. A somewhat clearer example is exp.  We can use the showstat procedure to examine the last couple of lines:&lt;pre&gt;
showstat(exp, 57..58);
exp := proc(x::algebraic)
local res, i, t, q, n, f, r;
       ...
  57     res := ('exp')(x)
       end if;
  58   exp(args) := res
end proc&lt;/pre&gt;
Here you can see that the local variable res is assigned ('exp')(x); the forward quotes prevent the procedure from being evaluated.  The final line returns the previously assigned res, but also directly inserts this value into the remember table for the procedure.  That way, a second call to exp with the same symbolic arguments avoids the computation and just looks up the result.  

The reason that the symbolic argument fails with the original assignment to T is that it does not know how to handle symbolic arguments; more specifically, the Optimization:-Maximize procedure cannot deal with the particular symbolic arguments it received.   Adding the conditional that I suggested avoids passing symbolic args to Maximize, instead returning an unevaluated call to T.  That works because the unevaluated call is then passed to plot, which, when it evaluates the expression at particular points, replaces the symbolic argument with a numerical value and evaluates the result.  
</itunes:summary>
      <description>Excellent question.  In both cases the r is a symbolic argument.  However, the definition of the sin procedure is such that if it gets a symbolic argument (say x) it returns the unevaluated function sin(x).  You can inspect the sin procedure by typing&lt;pre&gt;
interface(verboseproc=2):
print(sin);&lt;/pre&gt;
The portion that returns the unevaluated function is a bit tricky. A somewhat clearer example is exp.  We can use the showstat procedure to examine the last couple of lines:&lt;pre&gt;
showstat(exp, 57..58);
exp := proc(x::algebraic)
local res, i, t, q, n, f, r;
       ...
  57     res := ('exp')(x)
       end if;
  58   exp(args) := res
end proc&lt;/pre&gt;
Here you can see that the local variable res is assigned ('exp')(x); the forward quotes prevent the procedure from being evaluated.  The final line returns the previously assigned res, but also directly inserts this value into the remember table for the procedure.  That way, a second call to exp with the same symbolic arguments avoids the computation and just looks up the result.  

The reason that the symbolic argument fails with the original assignment to T is that it does not know how to handle symbolic arguments; more specifically, the Optimization:-Maximize procedure cannot deal with the particular symbolic arguments it received.   Adding the conditional that I suggested avoids passing symbolic args to Maximize, instead returning an unevaluated call to T.  That works because the unevaluated call is then passed to plot, which, when it evaluates the expression at particular points, replaces the symbolic argument with a numerical value and evaluates the result.  
</description>
      <guid>85301</guid>
      <pubDate>Tue, 10 Jul 2007 18:54:35 Z</pubDate>
      <itunes:author>Joe
 Riel
</itunes:author>
      <author>Joe
 Riel
</author>
    </item>
  </channel>
</rss>