Dr. Patrick T

## 2088 Reputation

14 years, 30 days

## 32 or 64 bits?...

This may not be your problem, but I know there are problems installing 32 bits versions of Maple on a 64 bits machine, and perhaps vice versa; for instance 64 bits does not support "classic" gui, as far as I know.

## equally brutish...

`seq([m,is(floor(160/m)>=5*2^m)],m=1..10); [1, true], [2, true], [3, true], [4, false], [5, false], [6, false], [7, false], [8, false], [9, false], [10, false]`

## brute force...

I came to this question because it is listed as "unanswered," but it has obviously been answered, at a time when mapleprimes is going to be revamped I suggest that this is something that needs to be fixed: it should be easier to convert comments into answers, I mean perhaps quite simply have everything "up-thumbable" and be done with it!

for a brute force approach, something like this:

seq([m,evalf(160/m-5*2^m,3),floor(160/m)-5*2^m],m=1..5);

eval( floor(160/m)>=5*2^m , m=3);
eval( floor(160/m)>=5*2^m , m=4);
40 <= 53
80 <= 40

## radius of curvature...

as far as I can remember, the radius of curvature is R =  -1/diff(f(x),x,x), if that's what you need you could just replace the derivative in the proc by this expression, I'm afraid I don't know more than that. In economics we use an elasticity concept to measure something like curvature, x*diff(f(x),x,x)/diff(f(x),x). Presumably you know a formula you can substitute into the proc. All the best.

## something like this?...

I am not a Maple expert at all, but I like to attempt small challenges once in a while to practice my skill, so this is what I came up with:

`myplot:= proc(f::procedure)  print(plot(f(x),x=0..1));  print(plot(eval(diff(f(x),x)),x=0..1));end proc:myplot(x->x^2);`

I haven't tested it beyond the example given.

other users no doubt will know better/more efficient ways.

## thanks...

mine was a silly mistake, the syntax for dualaxisplot is 2 lists separated by a colon, naturally,

`plots:-dualaxisplot([seq([i,i],i=1..10)],[seq([i,1/i],i=1..10)]);`

It was holding me back a bit, so I'm glad to have sorted this issue out.

Building on this new skill I was able to produce some pretty fierce-looking plots, e.g.

`plots:-dualaxisplot(   [[seq([i,i],i=1..10)],  [seq([i,10-i],i=1..10)]],   [seq([i,1/i],i=1..10)],   n=1..10,   style=[[point,point],line],  symbol=[[circle,diamond],default],  symbolsize=12,   colour=[[red,green],blue]);`

At the time I seemed to need to add the "default" as a symbol, seems to work this way.

It is very satisfying and I thank you both very much for your timely help.

## confusing...

> But I found the many different modes of entry confusing {1D, 2D, document, worksheet} - that is to say, they have a steep learning curve and are not well documented - and put it aside for some time.

I agree, this is confusing, and there is also potential confusion between the standard and classic gui, and there is the matter of the obsolete packages that are still widely used... if I were the Japanese owners I'd ask for a clarification of this straight away...

## Harmonic Series Figure, second attempt...

It's the green arrow that links to the file manager now, thus: the differentiable line is the log approximation, log(x)+gamma,

thanks again for your help!

## axiswidth and axisheight in plotoptions...

Have you tried to control axiswidth and axisheight in plotoptions?

Example:

plotsetup(ps,plotoutput=`NameOfFigure.ps`,plotoptions=`color,portrait,noborder,axiswidth=400pt,axisheight=300pt`):﻿

## Harmonic Series Figure... couldn't find the mapleprimes file manager to upload the image, so I uploaded it at imageshack (I googled for it, was sent to a post from 2005 sending me to http://www.mapleprimes.com/filemanager, naturally enough, but nothing there at this time).

Not sure if the image is going to display properly because I don't see it in the preview pane. Here's the link:

http://img812.imageshack.us/i/harmonicnumbersplot.png/

## Harmonic Series Plot with Log Approximat...

Thanks to both of you for your help. Both approaches have their merit, very useful.

I apologize for posting mixed-up code earlier, it appears I was in the middle of an experiment or something.

I had a closer look at the wikipedia plot, which I ought to have done before, and it's plotting ln(x)+gamma, not Psi(x), so finally a way to replicate it is:

`Hf := proc(n::posint) # floating-point Harmonic series  evalf(add(1/i,i=1..n));end proc:`
`N:=10:step := n -> ([n,Hf(n)],[n+1,Hf(n)]):theHarmonicNumbersPlotWithSteps:= plot(step~([\$1..N-1]), colour=red):theLogApproximationPlot := plot(ln(x)+gamma,x=1..N, colour=blue):plots:-display([theHarmonicNumbersPlotWithSteps,theLogApproximationPlot]);`

## Introduction to the Secretary Problem --...

As I wrote earlier, I've recently been wanting to look into this Secretary Problem. I have finally managed to put aside a few days to think about it. I wrote a handout that is supposed to clarify the problem. The intention is for a simple, readable introduction for Alex, myself, and perhaps others. I'm not sure how clear/unclear it is, because I haven't shown it to anyone yet. It is temporarily hosted here:

http://patrick.toche.free.fr/teaching/DOCS/SecretaryProblem.pdf

If anyone has a look at it, please do let me know if there are errors, imprecisions, confusions --- any suggestions on how to improve the handout are welcome. It's ultimately intended for MBA students (lawyers, journalists, etc.).

There is nothing new whatsoever in my handout, it's all mostly lifted from the classic paper by Gilbert and Mosteller (written in 1966) and Robert's explanations in this thread.

As I write in the handout, the syntax of the code is not designed to be optimal for Maple, but rather to follow the logical steps of the problem. Hence I used a loop rather than seq. I did not find the need to optimize the code as it was running fast anyhow, but optimizing it is a project for future improvements.

I copy below some of the bits of code I used to produce the figures in the handout:

P := proc(s,n)
if s=1 then 1/n;
else (1/n)*sum((s-1)/(k-1),k=s..n);
fi;
end:

S := n -> [seq( [s, P(s,n)], s=1..n )]:

thePlot := plot(S(N),style=point,symbol=circle,color=red):
plots:-display(thePlot,labels=[s,p],view=[1..N,0..0.5]);

N := 10:
thePointPlot := seq( plot(S(n),style=point,symbol=solidcircle,symbolsize=14,color=(COLOR(HUE,n/N))),n=3..N):
theLinePlot := seq( plot(S(n),style=line,linestyle=dot,color=(COLOR(HUE,n/N))),n=3..N):
plots:-display({thePointPlot,theLinePlot},labels=[s,p],view=[1..N,0..0.5]);

N := 200:
theLinePlot := seq( plot(S(n),style=line,linestyle=dot,color=(COLOR(HUE,n/N))),n=3..N):
plots:-display(theLinePlot,labels=[s,p],view=[1..N,0..0.5]);

# Procedure to select a candidate based on skipping s-1 of n draws
Select := proc(s::nonnegint,n::nonnegint)
local L, M, m, r, c, k;
L := Statistics:-Shuffle([seq(i,i=1..n)]); # generate a random list
M := max(L[1..n]);       # the maximum on 1..n
m := max(L[1..s-1]);     # the maximum on 1..s-1
r := 0:                  # initialize the score
for k from s to n do     # select a candidate
if L[k]>m then c:=L[k]; k:=n; fi;
end do;
if c=M then r:=1; fi;    # update the final score
RETURN(r);
end proc:

T := 100:
Trials := [seq([t,evalf(add(i,i=[seq(Select(S,N),i=1..t)])/t)],t=1..T)]: # Frequency as the number of trials t rises from 1 to T

theTrialsPlot := plot(Trials,style=point,symbol=solidcircle,symbolsize=12,color=red):
plots:-display(theTrialsPlot,labels=[t,p],view=[1..T,0..1]);

T := 10000:
LargeTrials := [seq([t,evalf(add(i,i=[seq(Select(S,N),i=1..t)])/t)],t=1..T,T/20)]: # Frequency for t from 1 to T in steps of T/20

theTrialsPlot := plot(LargeTrials,style=point,symbol=solidcircle,symbolsize=12,color=red):
plots:-display(theTrialsPlot,labels=[t,p],tickmarks=[[1000,5000,10000],default],view=[2..T,0..1]);

Edit: changed the url and posted a slightly revised version

## latex...

your question is not very clear, it would be easier to answer you if you provided a specific example of the plot and label you want. As far as I know, there is a not-very-good support for some LaTeX symbols in Maple plots. See below:

http://www.mapleprimes.com/questions/96844-Latex-Output-From-Maple--LaTex-Editor

I personally use pstricks for that and not Maple, which is a shame...

## clear...

what you're doing is clear now, unfortunately I'm going to be away for the weekend and I can't spend any time on this just now, but here are a few ways you can make the code a little more automatic, to begin with -- it doesn't answer your questions though.

If I followed your explanations, you want to set the f and g functions defined below equal up to some terms in x^p, where p is some large integer, and x small.

restart;
N := 4:
f := (x,n) -> 1 + add(a[2*i]*x^(2*i),i=1..n):
f(x,N);
lambda := -a;
alpha := n-> (f(1,n))^(-1):
alpha(N);
g := (x,n) -> simplify(coeff(series(alpha(n)*f(f(x/alpha(n),n),n),x), x^n)):
g(x,N);
Lambda := g(x,2);
[seq( sort(simplify(expand(f(x,n)-g(x,n)))) ,n=1..N)];

your lambda and Lambda are just special cases of the above (that bit of notation was confusing, so I removed it in the code).

I had to stop here sorry.

## faq...

this question comes up all the time, please read the mapleprimes archives!

﻿