mmcdara

7891 Reputation

22 Badges

9 years, 62 days

MaplePrimes Activity


These are replies submitted by mmcdara

@acer 

I couldn't wait to try sketch_ac.mw: 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;
    end:

    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.

 

 

@acer 

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  https://www.mapleprimes.com/help/moderation 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.

@rlopez 

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.
 

@rlopez 

Hi, 
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)
            union 
        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

@acer 

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

 

@vv 

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

@acer 

Thanks for this additional information
 

@vv 
 interface(typesetting=extended) works perfectly well.

Thanks

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)

 

@acer 

Hi,
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)

 

@acer 

I don't think I'll have more complex piecewise structures.

Explanation: I work on differential systems with an independent variable t and dependent variables x1(t), ...xN(t). These systems contain terms which depends only on t (think to accelerations for instance) which represent the "loadings" the system is submited to. These loadings are piecewise reconstructions of experimental records that I want to "extract" in order to modify them.

Nevertheless your remark was pertinent, better to strike while the iron is hot.
 

@Preben Alsholm 

Thank you,
It takes a lot of mental gymnastics to understand how satisfies works, but it seems indeed very powerfull

First 82 83 84 85 86 87 88 Last Page 84 of 154