## 5 Reputation

5 years, 343 days

## @Carl Love  Actually, this is perf...

Actually, this is perfect! Thank you so much.

The code is in fact just as general as I could wish for, as it is exactly what I was imagining. Also thanks for the remarks, they helped me understand some things better.

It's nice that there are people who help someone out even with the (for them) more trivial tasks.

## @Carl Love  It is tremendously nic...

It is tremendously nice of you to try make me understand the deeper mechanisms underlying Maple's kind of dealing with my input. But please do not spend so much time on these (assumingly) trivial things, I can cope with the contents you have given me so far and it will do for my small project.

But of course I appreciate your effort and am grateful for every piece of advice - especially when, as you put it, I seem to have chosen very awkward commands for my first run with Maple. :)

## @Carl Love  Yes, this does of cour...

Yes, this does of course work in this special case. As I am new to Maple, I may have expected too much in terms of a user-friendly handling. I thought there might be an intuitive way to rearrange the inequalities for w/p, then substitute this expression with z, and finally translate all inequalities into one piecewise representation.

But I am willing to learn and already received some insights into how Maple works from you, so thank you for that.

Maybe as a follow-up: with your idea I can easily receive the intervals defining when which q*(z) is chosen. Is there then one command with which I could merge these intervals into one piecewise expression programmatically, or do i have to rely on the 'manual way' by simply writing it in text as I would do in LaTeX?

## @Carl Love  Maybe I am confused by...

Maybe I am confused by the (for me, foreign) terminology but I want it just as it is pictured in my image and as you have already answered in your first reply (`q*`(z) = piecewise(2/3 < z and z <= 1, 0, 1/3 < z and z <= 2/3, 1, 0 <= z and z <= 1/3, 2);). But as this is only a representation and not programmatically derived, I would like to do this step by step in Maple to reach this piecewise expression from the 4 inequalities. Explicitly, I want q*(z) in ascending order {0,1,2} with the arguments being differentiated by a value z ∈ [0,1].

Now my primary problems are that I do not even get Maple to aggregate the 4 inequalities into a piecewise representation as is wished and shown, but that I also cannot get Maple to let me rearrange my inequalities in a matter that they are in relation to z := w/p.

Thanks you very much in advance.

## @Carl Love  restart; x[0] := 0:&n...

restart;

x[0] := 0: x[1] := 1: x[2] := 2:

q[0] := 0: q[1] := 1: q[2] := 2:

u := proc (x, q) options operator, arrow; p*min(x, q)-w*q end proc;

U := proc (x, q) options operator, arrow; sum((1/3)*u(x[i], q), i = 0 .. 2) end proc;

z := w/p;

solve(U(x, 0) > U(x, 1), w);

solve(U(x, 1) >= U(x, 0), w);
solve(U(x, 1) > U(x, 2), w);

solve(U(x, 2) >= U(x, 1), w);

Now, what I'd love is to have the 4 inequalities at the end to be aggregated to this nice form you have already posted. For this the inequalities must be rearranged to w/p which will then be substituted with the cost-price-ration z.

## @Carl Love  First of all, thanks a...

First of all, thanks a bunch!

It's good to know you can write it like that, but how can I get from the 4 inequalities to this solution, as you said, programmatically?

 Page 1 of 1
﻿