emendes

455 Reputation

6 Badges

8 years, 105 days

MaplePrimes Activity


These are replies submitted by emendes

@Carl Love Many thanks.   I don't have a large list right now but I will in a near future.   The last two procedures will be of a great help once I have large lists to analyze. 

@Carl Love Many thanks.   Your explanation was very clear.   

@Carl Love Many thanks.  Sorry but I still have some questions on how the procedures work. 

1) Nterms – it should return the number of terms (monomials) in a polynomial regardless of how the polynomial is presented, correct?

evalb(Nterms(F1)=Nterms(simplify(F1)))

returns false. 

2) How can I include (x4, x3, x2, x1) as an argument to be passed to Key? I work with all kinds of polynomial variables, as you probably remember.

@ecterrab Thanks.  I maybe completely mistaken but DifferentialAlgebra tools needs the definition of a differential ring using derivations and blocks which is not the case in my example.  Even using R:=DifferentialRing(derivations=[t],blocks=[x1,x2,x3,x4]) or R:=DifferentialRing(derivations=[t],blocks=[x]) (and x1=x[t],x2=x[t,t],...) does not result in the order in my example.  

@Carl Love Many thanks.  Yes, simply "degree in x4 (regardless of the presence of other variables)".  I knew it that you would come up a single line to solve the problem while I would spend several lines to do the same. 

One thing is missing: the number of terms in the polynomial. The polynomials in x3​ (F4, F5) have the same degree (2), but the number of terms is 6 and 5, respectively, in your answer. There are also two polynomials in x4 with degree 1, but fortunately, they are in the correct order. This means a check for the number of terms should be performed whenever two or more polynomials belong to the same class (like x3​, for example).

The final order is: [F2,F3,F1,F5,F4,F6]

Obs.: Could you explain why subs is necessary and how key selects the correct degree to consider?

@Carl Love It does once I removed all the aliases from the author's source code.  If I don't remove them, SaveMyProcs saves the procedure without the "d_" (Example: it saves dmcs and not d_cms).  No follow-up question and sorry for the confusion. 

@Carl Love Many thanks. I tried using "suffixed" (not together with "And") before asking the question to see which procedures would be saved. I noticed that procedures such as "dmcs" and "depend" (that do not start with "d_") were also listed. Is there a way to save only the procedures that start with "d_" (including the underscore)?

I found out what was going on.   The author used the command alias (dmcs = d_cms).

@Carl Love Many thanks.   How to add a condition?  I need to save all procedures that start with "d_". 

@dharr It seems that I'll go through all of them one by one.  

Command completion om mac - Settings - interface.   

Many thanks.  

@dharr Thank you very much. There are at least twenty such procedures, and I need to save them all to a single file. Is there a way to find all the user-created procedures and save them to one file?

I have checked the result of issuing the command save.  The output is:

d_remset := proc (ps, as, ord) local ind, i; if _npassed <> 3 then ERROR(
`wrong number of arguments`); elif nops(ps) < 1 or nops(as) < 1 then ERROR(
`no polynomials specified`); elif nops(ord) < 1 then ERROR(
`no indeterminates specified`); elif not type(ord,list) then ERROR(ord,
`must be a list`); end if; if member(false,map(type,ord,name)) then ERROR(
`bad variable list`); end if; ind := 0; for i to nops(as) do if d_class(as[i],
ord) <= ind then ERROR(`second argument must be a non-contradictory (weak-, qua\
si-) ascend            ing set`); else ind := d_class(as[i],ord); end if; end 
do; if type(ps,{list, set}) then if member(false,map(type,ps,polynom(polynom(
rational),ord))) or member(false,map(type,as,polynom(polynom(rational),ord))) 
then ERROR(`input must be polynomials over Q in`,ord); end if; d_remseta(ps,as,
ord); else if member(false,map(type,as,polynom(polynom(rational),ord))) then 
ERROR(`input must be polynomials over Q in`,ord); end if; d_premas(ps,as,ord);
end if; end proc;

Is there any way to get a properly indented output?

On a side note, is there a way to permanently turn off the Maple suggestions that appear when issuing a command (the small window with an example)?

@mmcdara Many thanks. Both options work for me. The second option will also be helpful for another problem.

@mmcdara Thanks a lot! That approach does mimic the original code, but it ends up breaking the other procedures. I really appreciate your help so far, and I’d be grateful if you could stick with me to sort this out too.

Here is an example

PS1 := {df(z,n=1)*df(y,n=1)*df(y,n=2)+3*df(x,n=2), df(z,n=1)*df(y,n=2)+6*x*y,x*df(y,n=1)-2*df(x,n=2)*y};

I need to extract only the base variables. When I use indets(PS1), I get {x, y, y', z', x", y"}, but I need only {x, y, z}. Is there an easy way to do that?

@nm Many thanks.   That result comes from a package written in 1996, so that expression was likely valid at the time. I am trying to update the functions with minimal effort, which means making as few changes as possible to the original code. Somehow, the author was able to use ' as a time derivative. Below is an excerpt from the help file that comes with the package.

with(dcharsets):
X := [t,x,y,z]; depend(X):

y*z*df(z^2+y)*df(y,2)+6*df(x,4)*y^2;    yields

y*z*(2*z*z'+y')*y''+6*y^2*x''''

To my understanding, z′, y′, y′′, and x′′′′ become new indeterminates in the polynomial elimination problem. depend and df are fucntions of the package.  df calls ddf shown above in the question.  

Since there are over 30 functions in the package and that notation is necessary for further calculations, I wonder if there is a way to make this notation valid in the new version of Maple, as it was back in 1996.

Here is one solution. 
 

saturbasis := proc(ps,js,ord)
 local qs,gb,zz,j,aux;
     print("ps = ",ps):
     print("js = ",js):
	 print("ord = ",ord):
     if js <> {} then
         #qs := [op(ps),'`@z`.j*js[j]-1' $ ('j' = 1 .. nops(js))];print("qs = ",%):
         #zz := ['`@z`.(nops(js)-j+1)' $ ('j' = 1 .. nops(js))];print("zz = ",%):
         #aux:= [op(zz),'ord[nops(ord)-j+1]' $ ('j' = 1 .. nops(ord))]:print("aux = ",aux):
	 qs := [op(ps),'cat(`@z`,j)*js[j]-1' $ ('j' = 1 .. nops(js))];print("qs = ",%):
         zz := ['cat(`@z`,(nops(js)-j+1))' $ ('j' = 1 .. nops(js))];print("zz = ",%):
         aux:= [op(zz),'ord[nops(ord)-j+1]' $ ('j' = 1 .. nops(ord))]:print("aux = ",aux):
         gb := grobner['gbasis'](qs,aux,'plex');
         qs := [];
         for j to nops(gb) do
             if {op(zz)} minus indets(gb[j]) = {op(zz)} then
                 qs := [gb[j],op(qs)]
             fi
         od
     else qs := ps
     fi;
     qs
end proc:

The error that comes out is deu to another problem.

 

@Rouben Rostamian  Many thanks. I followed your earlier instructions. At the end of the file, instead of guessing the variables, I included a SaveAll function (I believe @Carl Love is the author—the procedure follows after the text). After running make -f Makefile, a charsets.m file was created. In a Maple session, I executed read("charsets.m"); and then with(charsets); and this was the output:

with(charsets);
                 [cfactor, charser, charset, csolve, ecs, eics, ics, iniset, ivd, mcharset, mcs, mecs, pid, qics, remset, triser]

Although the source file contains many more defined procedures, how could the author determine which procedures are available and which are local? 

When I tried to use a function of the package with the given example but  I run into trouble.  Then I commented the last few lines (save, load help ...) and loaded the package again. 

read("charsets.txt");
with(charsets);
                 [cfactor, charser, charset, csolve, ecs, eics, ics, iniset, ivd, mcharset, mcs, mecs, pid, qics, remset, triser]
PS := [x1*x3-3*x2-1, -2*x4*x1-x3*x2*x4+2*x3, x2*x4^2-x4*x1+x3]:
charser(PS,[x1,x2,x3,x4]); 

But again it did not return the answer given by the author. 
 

Some questions:

  1. Why does the author use charsets/index := proc(...) ... end proc;? Wouldn't it be better to write a module with the functions instead?

  2. Some functions contain the statement options remember, system;. Would that cause any issues when converting to a module?

  3. The author defined several procedures with names that clash with standard Maple procedures. Sometimes he uses the standard functions, and other times he does not. Would this also be a problem?

  4. The author uses statements like "global charsets/@qs, charsets/@fact". What does this mean? Is there an alternative approach in newer releases?

  5. The help file as it is can not be loaded into Maple 2024, correct? 

 

1 2 3 4 5 6 7 Last Page 1 of 21