Gonzalo Garcia

150 Reputation

6 Badges

16 years, 204 days

MaplePrimes Activity

These are replies submitted by

@acer  many thankls!! I feel that is what I wanted...

@Kitonum and @vv

Many thanks for your answers! If attache a "pioneer" paper on the issue on the Frechet distance between two polygonal lines, for if you are interested...This problem, in its general version, is very hard.


Also, in the following link, you can find some "hints", if you are interested, to code a program to compute the Frechet distance between two polygonal curves:



I reiterate my gratitude.

@vv First at all, many thanks fopr the procedure.

It seems works correct and fastly!! :)


I reiterate my gratitude for your useful help.



@vv see the images with the formal proof, in French (sorry if they are "crappy" but are photos with my phone)

More generally, a precompact and path-wise connected set of a metric space is densifiable. I do not understand at all yor statenmtent "...find (effectively) t in [0,1] for which g(t) \in H.".   You'd be so kind to provide me a Maple code, please?

The idea is, exactly, what you propose in your post: fin a t in [0,1] such that the cosines curve belongs to the same sub-rectanlge H which belongs the given point P.

Many thanks for all!

@vv Thanks for your inetrest! The correct term for this kind of curve is "alpha-dense curve". The formal definition:

Let (X,d) ametric space, alpha>=0 and g:[0,1] -->X continuous. We say that g is an alpha-dense curve in a subset B of X if:

(1) g([0,1]) is a subset of B

(2) for each x in B, there is y in g([0,1]) such that d(x,y)<=alpha.

If for every alpha>0 there is an alpha-dense curve in B, the set B is said to be densifiable

Effectively, this concept generalizes that of "space-filling curve" (Peano curve, Hilbert curve, etc). For more details, you can see, for instance:




Respect to this question, in the book

Y. Cherruault, G Mora, Optimisation Globale. Théorie des courbes alpha-denses, Economica, Paris, 2005

 it is proved (Proposition 9.5.4) in a constructive way that the hypercube J:=[0,1]x...x[0,1] (d times) is a densifiable set. In fact, let the mapping g:I--->R^{d} defined as

g(t):=(t,0.5*(1-cos(Pi*m *t)),....,0.5*(1-cos(Pi*m^{d-1} *t)) ) for each t in [0,1]

and divide J into m^{d-1} "sub-rectangles" of side-length (1/m)x...x(1/m)x1. Then, from the properties of g, we have a "piece of the curve" in each sub-rectangle, which take all the values beetwen 0 and 1. Now given a point P:=(p_{1},....,p_{d}) in the hypercube J, the hyperplane of equation x_{d}=p_{d} cut the curve. As the point P belogs to some sub-rectangle, taking the solution (say, t) of the above equation such that the "piece of curve" and P are in the same sub-rectangle, we find

d(P,g(t)) <= sqrt(d-1)/m   (**)

and this completes the "proof". 

Therefore, I want use Maple to find a point t in [0,1] such that for a given P in J, the inequality (**) be satisfied. A think (although I may be wrong) that the proposed Maple's procedure can find such t, what do you think?

Thank you in advance for your comments or suggestions.


@tomleslie  You are right...The problem seems to be due to the values of r1 and r2. If these values are niot numeric, the proc returns an error. Also, i n your post I see "-1/2<=t,t<=-3/8" which does not appear because t must be always in [0,1].

Maybe we need to to evaluate them before to assing:

if `and`(type(evalf(lhs(S[2])), numeric), type(evalf(rhs(S[1])), numeric)) then r1 := min(evalf(lhs(S[2])), evalf(rhs(S[1]))); r2 := max(evalf(lhs(S[2])), evalf(rhs(S[1]))) end if; if `and`(type(evalf(lhs(S[1])), numeric), type(evalf(rhs(S[2])), numeric)) then r1 := min(evalf(lhs(S[1])), evalf(rhs(S[2]))); r2 := max(evalf(lhs(S[1])), evalf(rhs(S[2]))) end if


However, with

Cosenos(50, [.2534, .46534, .41241])

The last "fsolve" does not seem to work, so I think that the procedure is not correct to find a t such that the norm of x-g(t) (the curve) is less of equal than sqrt(d-1)/m    :(


S := fsolve(1/2*(1-cos(m^(d-1)*Pi*t)) = x[d], t = r1 .. r2)


Many thanks for your help.


It is seems that this procedure works

Cosenos := proc (m, x) local x0, y, j0, k, K0, K1, S, y1, y2, r1, r2, d; K0 := NULL; K1 := NULL; S := NULL; d := nops(x); for k to d-1 do if evalf(x[k]) = 1 then j0 := m else j0 := 1+floor(x[k]*m) end if; K0 := K0, [(j0-1)/m, j0/m] end do; K0 := [K0]; r1 := K0[1][1]; r2 := K0[1][2]; for k from 2 to nops(K0) do S := solve({K0[k][1] <= 1/2-(1/2)*cos(m^(k-1)*Pi*t) and 1/2-(1/2)*cos(m^(k-1)*Pi*t) <= K0[k][2], r1 <= t and t <= r2}, t); r1 := min(evalf(lhs(S[2])), evalf(rhs(S[1]))); r2 := max(evalf(lhs(S[2])), evalf(rhs(S[1]))) end do; S := fsolve(1/2-(1/2)*cos(m^(d-1)*Pi*t) = x[d], t = r1 .. r2); y := x[1]-S; x0 := x[1]; for k from 2 to d do x0 := x0, 1/2-(1/2)*cos(m^(k-1)*Pi*S); y := y, x[k]-1/2+(1/2)*cos(m^(k-1)*Pi*S) end do; y := `<,>`(y); return evalf([x0]), evalf(Norm(y)) end proc;


However, for x with miore than 3 components (say, x:=[0.23423,1,0.4534,0.5345,0.244,0.4534]) it is very very slow....Some suggestion??





@vv Many thanks for your answer! It is seems that the command floor works more fast.

@vv  Yeah!! This works, sorry ;) 

@Kitonum You are right: there are one or two solutions.

@vv Many thanks for your anwer. F(34234) returns -17117, but |34234-17117 | returns 17117 wich is not in [0,1].

@Carl Love  many thanks!! It is seem works!


The appendix of the attached PDF file shows how to associate to a rectangle a number....How can we implement this in Maple?


Again, thanks!!



@vv First at all, many thanks for your time and yoru patience....It is seem to return an error for n,m different from 2:

Cubes(3, 3, [a, b], h);
Error, (in Cubes) adding lists of different length


@vv Many thanks for your answer, 

Can we modify the procedure to divide an input cube?? That is, one of the argument of the procedure be the cube to divide.


Again, thanks.

1 2 3 4 5 6 Page 4 of 6