emendes

520 Reputation

6 Badges

9 years, 283 days

MaplePrimes Activity


These are replies submitted by emendes

@C_R  This is what I have.  First figure shows the worksheet and second figure the pdf (@acer showed how to break the table but the result is pretty much what you see, that is, not good at all).

 

@acer Many thanks.  I am puzzled about where Tabulate came from.  

@Carl Love What I meant was I used the command Tabulate without issuing with(DocumentTools) first.  And yes, I am converting to a DataFrame

@Carl Love Thank you very much.  

@Carl Love  Many thanks. I run your code with a slight modification (dim and Model_3) but the outcome does not seem right.  What did I miss?

 

restart:
MakeMonoList:= proc(alpha::symbol, V::list(symbol), dim::nonnegint)
local i, k, T;
    coeffs(expand((1+add(V))^dim), V, T);
    unapply(
        sort([T], rcurry(Groebner:-TestOrder, 'tdeg'(V[])))
        *~ [seq](alpha[i,k], k= 0..binomial(nops(V)+dim, dim)-1),
        i::posint,
        'proc_options'= 'remember'
    )
end proc
:
M:= MakeMonoList(alpha, [z,y,x], 2);

buildAllPossibleModels:= (model::list, M::procedure)->
    [for local i,m in model do
        map(subs, m=~ m+~ subs({`if`}(m::`+`, op(m), m)=~ (), M(i)), model)[]
    od]
:
Models_3 := [[y*z*alpha[1, 8], x*z*alpha[2, 6], x*y*alpha[3, 5]], [y*z*alpha[1, 8], x*y*alpha[2, 5], y*z*alpha[3, 8]], [y*z*alpha[1, 8], x*y*alpha[2, 5], y^2*alpha[3, 7]], [y*z*alpha[1, 8], x*y*alpha[2, 5], x*y*alpha[3, 5]], [y*z*alpha[1, 8], x^2*alpha[2, 4], x*z*alpha[3, 6]], [y*z*alpha[1, 8], x^2*alpha[2, 4], x^2*alpha[3, 4]], [y*z*alpha[1, 8], z*alpha[2, 3], x*z*alpha[3, 6]], [y*z*alpha[1, 8], x*alpha[2, 1], x*z*alpha[3, 6]], [y*z*alpha[1, 8], x*alpha[2, 1], x*alpha[3, 1]], [y^2*alpha[1, 7], z^2*alpha[2, 9], x*z*alpha[3, 6]], [y^2*alpha[1, 7], y*z*alpha[2, 8], x*z*alpha[3, 6]], [y^2*alpha[1, 7], y*z*alpha[2, 8], x^2*alpha[3, 4]], [y^2*alpha[1, 7], y*z*alpha[2, 8], x*alpha[3, 1]], [y^2*alpha[1, 7], x*z*alpha[2, 6], x*z*alpha[3, 6]], [y^2*alpha[1, 7], x*z*alpha[2, 6], x*y*alpha[3, 5]], [y^2*alpha[1, 7], x*z*alpha[2, 6], y*alpha[3, 2]], [y^2*alpha[1, 7], z*alpha[2, 3], x*z*alpha[3, 6]], [y^2*alpha[1, 7], z*alpha[2, 3], x*y*alpha[3, 5]], [x*y*alpha[1, 5], z^2*alpha[2, 9], x*z*alpha[3, 6]], [x*y*alpha[1, 5], y*z*alpha[2, 8], x*z*alpha[3, 6]], [x*y*alpha[1, 5], y*z*alpha[2, 8], x*y*alpha[3, 5]], [x*y*alpha[1, 5], y*z*alpha[2, 8], x^2*alpha[3, 4]], [x*y*alpha[1, 5], y*z*alpha[2, 8], x*alpha[3, 1]], [x*y*alpha[1, 5], x*z*alpha[2, 6], y*z*alpha[3, 8]], [x*y*alpha[1, 5], x*z*alpha[2, 6], y^2*alpha[3, 7]], [x*y*alpha[1, 5], x*z*alpha[2, 6], x*z*alpha[3, 6]], [x*y*alpha[1, 5], x*z*alpha[2, 6], x*y*alpha[3, 5]], [x*y*alpha[1, 5], x*z*alpha[2, 6], x^2*alpha[3, 4]], [x*y*alpha[1, 5], x*z*alpha[2, 6], y*alpha[3, 2]], [x*y*alpha[1, 5], x*z*alpha[2, 6], x*alpha[3, 1]], [x*y*alpha[1, 5], z*alpha[2, 3], x*z*alpha[3, 6]], [x*y*alpha[1, 5], z*alpha[2, 3], x*y*alpha[3, 5]], [x*y*alpha[1, 5], z*alpha[2, 3], x^2*alpha[3, 4]], [x*y*alpha[1, 5], z*alpha[2, 3], x*alpha[3, 1]], [y*alpha[1, 2], z^2*alpha[2, 9], x*z*alpha[3, 6]], [y*alpha[1, 2], y*z*alpha[2, 8], x*z*alpha[3, 6]], [y*alpha[1, 2], y*z*alpha[2, 8], x*y*alpha[3, 5]], [y*alpha[1, 2], y*z*alpha[2, 8], x^2*alpha[3, 4]], [y*alpha[1, 2], y*z*alpha[2, 8], x*alpha[3, 1]], [y*alpha[1, 2], x*z*alpha[2, 6], y*z*alpha[3, 8]], [y*alpha[1, 2], x*z*alpha[2, 6], y^2*alpha[3, 7]], [y*alpha[1, 2], x*z*alpha[2, 6], x*z*alpha[3, 6]], [y*alpha[1, 2], x*z*alpha[2, 6], x*y*alpha[3, 5]], [y*alpha[1, 2], x*z*alpha[2, 6], x^2*alpha[3, 4]], [y*alpha[1, 2], x*z*alpha[2, 6], y*alpha[3, 2]], [y*alpha[1, 2], x*z*alpha[2, 6], x*alpha[3, 1]], [y*alpha[1, 2], z*alpha[2, 3], x*z*alpha[3, 6]], [y*alpha[1, 2], z*alpha[2, 3], x*y*alpha[3, 5]], [y*alpha[1, 2], z*alpha[2, 3], x^2*alpha[3, 4]]]:

Models_4:= CodeTools:-Usage(
    Threads:-Map(buildAllPossibleModels, Models_3, M)
):
M := proc (i::posint) option remember; [alpha[i, 0], x*alpha[i, 

   1], y*alpha[i, 2], z*alpha[i, 3], x^2*alpha[i, 4], 

   y*x*alpha[i, 5], z*x*alpha[i, 6], y^2*alpha[i, 7], 

   z*y*alpha[i, 8], z^2*alpha[i, 9]] end proc


memory used=0.92MiB, alloc change=19.69MiB, cpu time=16.00ms, real time=4.00ms, gc time=0ns

nops(convert(Models_4,set));
                               49

The number of models should be much higher than 49, more like 1170.  

How can I avoid the line where the result is converted to a set?  

 

@Carl Love You are absolutely right. dim changes and is the degree of nonlineariy.

@Carl Love Many thanks.   It does help a lot. 

@Carl Love Many thanks.   I was thinking of threadsafe at a higher level.  Something like

out:=CodeTools:-Usage({Threads:-Seq}(buildAllPossibleModels(newres4[j,1],terms,i),j=1..nops(newres4))):

where newres4 is a list of all models of 3 entries and 4 monomials. In total 12701 models.  

@Carl Love Many thanks. it works and I used the same idea on the procedure that creates M.  If I give values to i in other paclages of the worksheet, would that somehow interfere with the results in buildAllPossibleModels

Sorry for insisting on an explanation of how you built the function, but could you provide more details? 

@Carl Love Many thanks. I won't pretend I understand your solution, so if you could spend some time explaining to me what you did, I would appreciate it.

As I need to do the same for thousands of models like model, I have encapsulated your solution in a procedure and apply it to model again. 

buildAllPossibleModels := proc(model::list,M::set)
description "This function returns all models generated from a given model and set of monomials.":
local i,k,m,models:
models:= [
    for k,m in model do
        map(subs, m=~ m+~ (subs(i= k, M) minus {`if`}(m::`+`, op(m), m)), model)[]
    od
]:
return(models):
end proc:

However, this function returns 60 new models instead of 56. What did I do wrong?

Would it be threadsafe?  

@mmcdara Many thanks.   keep[1] returns 1D model and not a 3D model like model. Keep should return 56 models in the format as model (nops(model)=3).

@Carl Love Many thanks.  This new section helped me to understand what is going on.  Many thanks.

@Carl Love It seems that this last version took care of CM_IsStandard.   I wlll do some more test if there is still a problem, I'll let you know.   Thank you.  

@Carl Love Many thanks.  As usual I need help to understand why you have used identical. 

Below it is your code modified to what I need. 

restart:
SaveNames:= (excl::uneval, fname::{symbol, string})->
    subs(
        _V= remove(
            type, {anames}(user), 
            {procedure, identical(eval(excl, 2)[], eval(excl, 1))}
        )[],
        proc() save _V, fname; return end proc
    )()
:
(x,y):=(3,5):
Excl:={anames}(user) minus {anames}(procedure); # To avoid typing the variables - far too many variables in a typical example.
                         Excl := {x, y}

(z,w):=(7,9):

SaveNames(Excl, "/Users/eduardo/tmp/V.txt");
restart:
read "/Users/eduardo/tmp/V.txt";
                             w := 9

                             z := 7


I have noticed that if I define SaveNames after ExclCM_IsStandard will be saved.  How to avoid that?

 

Could you also tell me why my proc won't work unless I type Excl?  

 

@acer Many thanks.  I added style=line to plots:-odeplot in all instances in the worksheet.  It seems to do the trick.  I also use plots:-pointplot3d that shows the same problem.  I thought connect would solve the problem but I had to include style=line. I am not sure if it works in all situations.  I will have to run some tests.  

I will edit my reply to add the commenyts with Array later.

3 4 5 6 7 8 9 Last Page 5 of 22