emendes

395 Reputation

6 Badges

7 years, 186 days

MaplePrimes Activity


These are replies submitted by emendes

@C_R  Thanks.  As I said to @acer landscape helps but it is not enough.   I will try to set a custom size to see if it works. 

@acer Many thanks. Landscape helps a bit but control of sizes and widths is necessary.  

I must be really dumb, but I could not figuire how to attach mw and m files to my answer.

@acer Many thanks. Clicking on the table and changing the "Page Break" property worked; however, as you can see above, all formatting has been lost. (I will try to second part of your answer when I get the format right).

@Thomas Richard Many thanks.  I hope he/she is willing to download and install Maple player, 1.5 Gb, just to see one file. 

@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).

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