emendes

400 Reputation

6 Badges

7 years, 278 days

MaplePrimes Activity


These are replies submitted by emendes

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

@sursumCorda  Here is part of the code (modified to fit here).

dsnmodel := {diff(x(t), t) = -10*x(t) + 10*y(t), diff(y(t), t) = -z(t)*x(t) + 28*x(t) - y(t), diff(z(t), t) = y(t)*x(t) - (8*z(t))/3, x(0) = 1/10, y(0) = 1/10, z(0) = 1/10};

tfinal:=200:
mf:=500000:
dt:=0.001:


dsol1 := dsolve(dsnmodel, numeric, method = rkf45, output = procedurelist,range=0..tfinal,maxfun=mf):

fig:=Array(1..2):
fig[1]:=plots:-odeplot(dsol1, [x(t), y(t), z(t)],refine=2,caption="Fig. 1 - Lorenz system",captionfont = ["ROMAN", 20]):
fig[2]:=plots:-odeplot(dsol1, [x(t), y(t), z(t)],refine=2,caption="Fig. 2 - Another system",captionfont = ["ROMAN", 20],color = "SteelBlue"):
plots:-display(fig);

@acer 

Yes, it does when I Print directly.   Yes for PDF export as well. When I choose Open in Preview Maple sends the doc to printer. 

Print Preview = Print layout Mode?   No, it does not. 

Where do I add style-line?  In plots:-odeplot?

@emendes Just an update.   I installed Maple 2023 over the weekend and the problem persists.   

@Carl Love That is weird! Maple 2002.2 on Mac M1 started freezing on Monday for no reason. Most of the time I had  to kill the process related to it.  Maple 2022.2 on Linux did not show the same problem though.  

@acer Many many thanks.   Please correct me if i am worng.  These new fancy ways open a door of  new possibilities.  Suppose I want to find the indices of a list that corresponds to elements less than 9.   Would the following command be efficient for long lists?

[for t,v in eval(T) do `if`(v<=9,t,NULL); end do];

@acer Thank you ever so much.   No problem to understand your solution.   The problem is: why I did not think of that?  If you have the time and patience, please post the fancy ways with comments.  

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