pagan

5147 Reputation

23 Badges

17 years, 122 days

 

 

"A map that tried to pin down a sheep trail was just credible,

 but it was an optimistic map that tried to fix a the path made by the wind,

 or a path made across the grass by the shadow of flying birds."

                                                                 - _A Walk through H_, Peter Greenaway

 

MaplePrimes Activity


These are replies submitted by pagan

I see, thanks. Maybe further discussion of the new help browser functionality in 14 could move to a new thread, just for clarity's sake.

I believe that saving as .mws can produce a .hdb (provided a .mw version was not also saved into that .hdb under the same topic) viewable under commandline, and so the OP's question may be answered.

Well, maybe there's another thing. Suppose that you save the .mw to mylocation/foo.hdb and the .mws to mylocation/classic/foo.hdb . Then add mylocation to libname in a Maple session. I believe that this can allow the topic (stored in both .hdb's but in different formats) to be viewed in all interfaces with the most "appropriate" view. That is, in Standard it can show the .mw help with 2D input if you had it there, and the .mws version in the other interfaces. Maybe someone else could test this in their installed Maple.

I see, thanks. Maybe further discussion of the new help browser functionality in 14 could move to a new thread, just for clarity's sake.

I believe that saving as .mws can produce a .hdb (provided a .mw version was not also saved into that .hdb under the same topic) viewable under commandline, and so the OP's question may be answered.

Well, maybe there's another thing. Suppose that you save the .mw to mylocation/foo.hdb and the .mws to mylocation/classic/foo.hdb . Then add mylocation to libname in a Maple session. I believe that this can allow the topic (stored in both .hdb's but in different formats) to be viewed in all interfaces with the most "appropriate" view. That is, in Standard it can show the .mw help with 2D input if you had it there, and the .mws version in the other interfaces. Maybe someone else could test this in their installed Maple.

Can you set it as helpbrowser=classic, in the Classic GUI, and get anything other than the java browser?

Can you set it as helpbrowser=classic, in the Classic GUI, and get anything other than the java browser?

You can put the procedures (which do the actual work, behind the scenes) inside a code-edit region or a collapsed block of a Document. You can toggle that code section as autoexecute when the Document is opened. You can program your LP solver/visualizer in either Maplets (launchable from the same Document) or as Embedded Components within that Document. And then you can use the green arrow button in the mapleprimes edit-bar to upload it here, for all the world to enjoy.

But here's a question: why do all that when there is already the Optimization:-Interactive assistant? That is available from Maple's own menubar via Tools->Assistants, or as a command. Inside it, you enter objective, constraints, and then hit the Solve button, and then the Plot button. The plot can show the optimal point, and the objective surface, and the constraints. And it can also do QP and NLP problems.

You can put the procedures (which do the actual work, behind the scenes) inside a code-edit region or a collapsed block of a Document. You can toggle that code section as autoexecute when the Document is opened. You can program your LP solver/visualizer in either Maplets (launchable from the same Document) or as Embedded Components within that Document. And then you can use the green arrow button in the mapleprimes edit-bar to upload it here, for all the world to enjoy.

But here's a question: why do all that when there is already the Optimization:-Interactive assistant? That is available from Maple's own menubar via Tools->Assistants, or as a command. Inside it, you enter objective, constraints, and then hit the Solve button, and then the Plot button. The plot can show the optimal point, and the objective surface, and the constraints. And it can also do QP and NLP problems.

sol:=Optimization:-LPSolve(x+y,{x>=0,y>=0,y<=60,x+3*y<=20,2*x+2*y<= 30},
                           x=-70..70,y=-70..70,maximize);

X,Y:=op(eval([x,y],sol[2]));

plots:-textplot([X,Y,sprintf("Local Maxima %4.2f %4.2f",X,Y)]);

You can use typeset() instead of sprintf(), if you want.

What do you mean by "automate the process"? Are you saying that you want a procedure that does it all, including overlaying all the various plots and textplots? What would the input be, the objective and constraints?

sol:=Optimization:-LPSolve(x+y,{x>=0,y>=0,y<=60,x+3*y<=20,2*x+2*y<= 30},
                           x=-70..70,y=-70..70,maximize);

X,Y:=op(eval([x,y],sol[2]));

plots:-textplot([X,Y,sprintf("Local Maxima %4.2f %4.2f",X,Y)]);

You can use typeset() instead of sprintf(), if you want.

What do you mean by "automate the process"? Are you saying that you want a procedure that does it all, including overlaying all the various plots and textplots? What would the input be, the objective and constraints?

Try putting in this instead, where you defined PEffv.

PEffv := unapply(normal(eval(PEff, [yc = Eg/(k*TC), ys = Eg/(k*TS)])), Eg);

evalf(PEffv(0));

plot(PEffv,0..2);

You may still need to adjust some constants, and check PEff, etc. But PEffv should work and plot, quickly.

Note that, if you have an expression involving a name like `Eg`, assigned already to `expr`, then you cannot create an operator from `expr` by just issuing

  Eg -> expr

But instead, you can use `unapply` to create that operator.

Note that the `normal` is there so that the 1/Eg in both numerator and denominator are allowed to simplify in the resulting formula. If not, you can get spurious division-by-zero errors, such as when you call PEffv(0).

And lastly, I removed the evalf inside your PEffv definition. It still works with `plot`, since `plot` will automatically try and evalf or evalhf the thing. And you can always evalf your own calls to PEffv, as I showed above. As you had it coded, the evalf would actually remove the method option, like in the following example.

> restart:

> evalf(Int(x^2,x=a..b,epsilon=0.001,method=_d01amc)):

> lprint(%);
Int(x^2,x = a .. b)

That behaviour adds programming awkwardness for numerical quadrature in Maple, with its whole evalf@Int design.

Try putting in this instead, where you defined PEffv.

PEffv := unapply(normal(eval(PEff, [yc = Eg/(k*TC), ys = Eg/(k*TS)])), Eg);

evalf(PEffv(0));

plot(PEffv,0..2);

You may still need to adjust some constants, and check PEff, etc. But PEffv should work and plot, quickly.

Note that, if you have an expression involving a name like `Eg`, assigned already to `expr`, then you cannot create an operator from `expr` by just issuing

  Eg -> expr

But instead, you can use `unapply` to create that operator.

Note that the `normal` is there so that the 1/Eg in both numerator and denominator are allowed to simplify in the resulting formula. If not, you can get spurious division-by-zero errors, such as when you call PEffv(0).

And lastly, I removed the evalf inside your PEffv definition. It still works with `plot`, since `plot` will automatically try and evalf or evalhf the thing. And you can always evalf your own calls to PEffv, as I showed above. As you had it coded, the evalf would actually remove the method option, like in the following example.

> restart:

> evalf(Int(x^2,x=a..b,epsilon=0.001,method=_d01amc)):

> lprint(%);
Int(x^2,x = a .. b)

That behaviour adds programming awkwardness for numerical quadrature in Maple, with its whole evalf@Int design.

Using Maple 12.02, 32bit Windows (Core2 Duo, your machine might be different), I got these timings for plot(PP,2..10) with the PP proc as given above.

Classic: 0.047 sec

Standard: 0.032 sec

I saw the same timing behaviour using Maple 13.01, 32bit Windows. Hence it doesn't appear to me that f is noticeably (or significantly) faster than PP.

In Standard I saw a full plot, even for 2 to 200 (including 100..110 subrange) if I made the thickness larger or added axes=none. I suspect that it merely appears that the tail is not plotted when actually the axis is blocking it from view. I don't like that the axis is allowed to block the line, by default. In Classic I too saw error messages about overflow and instruction to shorten the axes.

 

Using Maple 12.02, 32bit Windows (Core2 Duo, your machine might be different), I got these timings for plot(PP,2..10) with the PP proc as given above.

Classic: 0.047 sec

Standard: 0.032 sec

I saw the same timing behaviour using Maple 13.01, 32bit Windows. Hence it doesn't appear to me that f is noticeably (or significantly) faster than PP.

In Standard I saw a full plot, even for 2 to 200 (including 100..110 subrange) if I made the thickness larger or added axes=none. I suspect that it merely appears that the tail is not plotted when actually the axis is blocking it from view. I don't like that the axis is allowed to block the line, by default. In Classic I too saw error messages about overflow and instruction to shorten the axes.

 

Do that account for symmetry under reflection or rotation?

Do that account for symmetry under reflection or rotation?

The number of integers between integers A and B, inclusive, is B-A+1.

So between 0 and 7, inclusive, there are eight integers.

You can check this by counting from 0 to 7 on your fingers. If that is confusing, then try it first from 1 to 8. And then think about why that is the same as counting from 0 to 7.

Hence

> add(0.5,x=0..7);
                                      4.0
 
> add(0.5,x=1..8);
                                      4.0
 
> 0.5*8;
                                      4.0
First 45 46 47 48 49 50 51 Last Page 47 of 81