3728 Reputation

17 Badges

6 years, 67 days

MaplePrimes Activity

These are replies submitted by mmcdara


You're very right, but in some situations it can be a tricky way to proceed.

An example : you randomly sample a few points in the unit square  and you want tomark the one which is the closest of a curve drawn in this same square.Of course this can be done programmatically but it's sometimes faster (even if it may introduce errors) to mark this point manually.
The probe can be very useful in this case, but unfortunately it is not that easy and quick to use (always with my traditional proviso I use Maple 2015 at home and that improvements may have been made in earlier versions)



I suspect that @vserturk got no solutions at all (in my case I didn't get any with Maple 2015 after 10 minutes) or that the solution ranges over pages and pages.
Maybe the "it is not what I need" means "Maple doesn't return any (or any tractable) solution" (?)

If you think you are going to invest yourself on this subject, I have made a brief analysis of the complexity of the system (which probably explains the difficulties of solve faces).
For readibility (IMO) I have recoded some variables.
The system contains quadratic terms and "interactions" between the 5 unknowns; the final matrix indicates which combinations of unknowns belong to which equation.


I couldn't wait to try it suits me perfectly well.

I just read diagonally your last answer, please wait a while before I come back.
A few remarks:

  • the name  Bez comes from the original startup code I loaded... I was too lazzy to modify its name
  • more seriously, this same "original" Bez (updates, Maple 17, Mathapps, "Bézier Curves") contains this procedure to find the closest match:
    GetNum := proc(x, y)
       local d, dnew, i;
       if type(pt,table)
         and type([entries(pt,'nolist')],listlist(numeric)) then
          dnew := infinity;
          for i from 1 to _N do
             d := (x-pt[i][1])^2+(y-pt[i][2])^2;
             if d < dnew then
                dnew := d;
                if dnew < 5 then
                   return i;
                end if;
             end if;
          end do;
       end if;
       return 0;

    I didn't understand theis early stopping if dnew < 5 then  return i end if: : where does this "5" come from?
    The deep reason why a table, instead of a list (seemed more natural?), was used to represent pt is not very clear to me either.
    This is why I used a list and a sort.
    As the lists of points will remain small in the applications I have in mind I didn't focused on computational efficiency.




It is a big thanks in advance because I will not have the time to examine in detail all your answers right away... but I do not doubt for a moment that I will be satisfied with them.
I will lkeep you informed within a day and a half

PS: I had thought of using radio buttons, but they were a bit confusing compared to the Maplets

@dharr  ;-)

@Carl Love @dharr

The problem is that this policy does not prevent deliberate misuse.
For instance an ill-intentioned person might think to modify an answer to discredit its author.
(I point out that I didn't modifed a question but a reply)

Point-by-point replies:

  • @dharr  Even if I take your comment about me correcting @acer's grammar as a tease, I did it because I thought it was the most innocuous correction I could make. Funny to think that I was stricto sensu outlawed.
    On the link there is no mention of a moderator's right to edit another person's response. Maybe the general policy means that " Anything that is not forbidden is allowed", but I still think it opens the door to unfair attitudes.
    (Maybe I'm a little bit paranoid?)
  • @Carl Love
  1. I think a better attitude of the moderator should be to ask the OP to edit itself it's own reply. Thiscould serve as a "lesson" (probably not the best term to use here) for its next intervention.
  2. idem previous point.
  3. I agree on this point, mainly because it doesn'treally concern the core of the question.
  4. idem point 3... and I'm all the most concerned by this one because we had both of us a dicussion about it months ago.



About Mapleprime's policy:
Another disturbing fact is the removal of questions: this may seem, and I have no doubt that the persons affected felt it so, as an arbitrary or unjustified act. Why the moderator who does that doesn't have the oblifgation to say that the question has been deleted, or deplaced somewhere else and for whar reason? 
As a rule people send another question like "Why did my question disappear?" in order to get an explanation for the disappearance.

What p....s me off the most is that, according to a moderator's definition of "Edited another user's question or post", I probably did myself what I am complaining about here!
I hope it was just me, from account A, changing an answer I made with account B.
I would be ashamed if this were not the case.


Thank you.
I'm going to look to Advanced Find and Replace more seriously.

@Carl Love 

Thanks for quick reply.

You wrote " If you put it inside the piecewise for...": good point my simplifications no longer works

"Preben's Answer addresses the specific example that you gave"
I do understand that you have given a more general answer than that of Preben.
Without denying the importance of having such a general answer, I simply remind you of my answer to acer's first question, which was that I was only interested in a very specific situation.
From this last point of view alone I would say, without meaning to offend you, that Prenen has given me a necessary and sufficient answer.
Of course, your solution could be useful to me (or others)  if I happen to meet more complex situations.


I don't know what Advanced Find and Replace is, but I guess the worksheets must be saved as plain text files or mpl files, am I right?

More of this a quick look to advanced-find-amp-replace (I use a Mac) says that there exist alternatives to Advanced Find and Replace for Mac, the first of them being ... the Linux command grep !!!

For years (and I agree that it is not easy to have a strict enough discipline for this to be effective), I use plain text savings and grep, at least for the main worksheets I write (plus of course a meaningful name).
Maybe not very far from what @acer does?

@Carl Love 

Thanks for your first reply about the mechanism behind satisfies.
Concerning your last reply:

  • Is there a particular reason to write  indets(e, typefunc(anything, And(name, Not(mathfunc)))) instead of 
    indets(e, typefunc(And(anything, name, Not(mathfunc))))?
  • About your remark concerning Maple 2015, these two commands work the same (anything is also implicit in Maple 2015):
    indets(e, typefunc(anything, And(name, Not(mathfunc)))) ,
     indets(e, typefunc(And(name, Not(mathfunc)))) .
  • What situation does indets(e, typefunc(anything, And(name, Not(mathfunc)))) avoid that 
    indets(e, Not(mathfunc)) doesn't?
  • Is it necessary to discard the "case of a constant" in indets(expr, And(name, Not(constant))) ?
    For instance it seems that these simplifications of v still give the correct result
    expr := piecewise(x(t)<0, -1, x(t)<1, 0, 1) + f(t) + 
            piecewise(t<0, 0, t<1, 1, 0) + 
            x(t)*piecewise(t<0, 1, t<1, 0, 1) +
            a*piecewise(t<0, 3, t<1, -1, 2) +
            Pi*piecewise(t<0, 1, t<1, 2, 2)+
            3*piecewise(t<-2, 1, t<1, 2, 0):
    v:= indets(expr, name)
        op~(0, indets(expr, typefunc(Not(mathfunc))));
    select(hastype, [op](expr), specfunc(freeof(v minus {t}), piecewise))

    But I guess you had something in mind that I didn't figure out?


Maybe a little less concise than Preben's but I still vote up


Thanks for your adjustement.
(I vote up).


An idea:
This makes me think of something: there is a bunch of procedures/functions to manipulate expressions and manipulating expressions is often at the center of using Maple.
On the other hand, unless you are a specialist, it is quite difficult to have an exhaustive view of what Maple allows to do: wouldn't it be possible that a specific entry in the glossary (or maybe better, something at the Start level) would present all these tools in a problem-oriented way?
For example "How to extract all functions of such or such variables?", and then several solutions



Okay, I hadn't understood that since Maple 2020, the continued fraction appeared in an unusual way.


Thanks for this additional information

 interface(typesetting=extended) works perfectly well.


Bu the way, why do you advice me to use an inert operator?
(n Maple 2015 I think I must write the things this way g := x -> 1/  `%` (1, x), which is not very easy to use)



This is indeed an interesting way to approach the problem, but it doesn't quite do the job: in my initial question I said that I wanted all the bold terms to be returned

expr := piecewise(x(t)<0, -1, x(t)<1, 0, 1) + f(t) + piecewise(t<0, 0, t<1, 1, 0) + x(t)*piecewise(t<0, 1, t<1, 0, 1) + a*piecewise(t<0, 3, t<1, -1, 2)

but by using

satisfies(pw->not depends(pw,[x]));

this is not 

x(t)*piecewise(t<0, 1, t<1, 0, 1)

which is returned but

piecewise(t<0, 1, t<1, 0, 1)


First 14 15 16 17 18 19 20 Last Page 16 of 86