nm

12253 Reputation

20 Badges

13 years, 270 days

MaplePrimes Activity


These are replies submitted by nm

@Joe Riel 

Yes, I thought that at first, but I put the mla files in same folder where my code is, and no other place, then set up libname.

I also now used 

LibraryTools:-FindLibrary('dsolver_test')

And it printed the correct folder and path. No problems.

I can reproduce this problem all the time. It is only when it tries to call that specific proc() that it fails. I have no idea why it works with straight .mpl files and not when they are inside .mla.

I will try to debug this more today.

I really think something went wrong with the symbol table in the mla. it thinks the proc name is a symbol and not a procedure.

 

 

thanks for both answer. Both useful.

 

@Joe Riel 

So on Linux, Maple do not keep the mla file being used open? Does your makefile also delete the .mla file each time before making new one?

I thought keeping the .mla file open was on control of Maple and not the windows OS itself.

What prevents Maple from reading the mla file first time, and then closing it after the code is in memory? Or may be Maple keeps it open for some other reason.

@Carl Love 

yes, thanks. restart from all worksheets that use the mla is all what is needed.

But this is still annoying. As I could have 3-4 worksheets open at same time, all have used the .mla. So now I have to go find each worksheet, and click restart inside it, so I can update the mla.

It is easier just to close Maple and restart it, and then do the update. Not a big deal, just a little annoying that mla file is locked open when a process uses it. I thought Maple reads the code to memory and closes the mla file.

 

@Carl Love 

I know I can do that. But there must be some search path that Maple uses to locate .mla files. And that is what that webpage was saying. But since those environments variables are fake, I do not know what search path Maple uses.

I could use kernelopts(':-homedir')  for $HOME replacement for now.

But there should be some official search path that Maple searches to find .mla files other than libname. At least that what that page seems to say. May be I misunderstood that web page.

 

@Joe Riel 

I was trying to find out where to put my personal .mla file so Maple can automatically find it, without having to explicitly update libname each time. And that is what that web page says. 

If I do kernelopts('toolboxdir');  it returns [""]

 

 

@janhardo 

"y = g(y')   ( p = dy/dx)  is this still a d'Alembert ( Maple say yes ..no quadrature) "

restart;
ode:=y(x)=g(diff(y(x),x));
DEtools:-odeadvisor(ode)

 

"For x= 1 you get  y = 1. f(p)+g(p)  d'Alembert"

restart;
ode:=y(x)=f(diff(y(x),x))+g(diff(y(x),x));
DEtools:-odeadvisor(ode)

 

restart;
ode:=y(x)=x*f(diff(y(x),x))+g(diff(y(x),x));
DEtools:-odeadvisor(ode)

@acer 

thanks. These display no values

getenv("MAPLE");
getenv("VERSION");
getenv("TOOLBOX");
getenv("HOME");

But Nothing is returned.

Are these environment variables defined by Maple when installed or something the user needs to define themselves?

 

@vv 

I am sorry, I do not see this. If f(p)=0 it is the same as x is missing. Otherwise all the following willl become d'Alembert, since they have f(p)=0

ode:=y(x)=3*diff(y(x),x)^2;
ode:=y(x)=3*tan(diff(y(x),x));
ode:=y(x)=3*ln(diff(y(x),x)^2);
ode:=y(x)=3*(diff(y(x),x)^2+sin(diff(y(x),x)));

But these are all _quadrature

Now it is possible for g(p) to be zero and the ODE be d'Alembert, but in this case f(p) has to be nonlinear. For example

ode:=y(x)=x/diff(y(x),x)^2;
ode:=y(x)=x*sin(diff(y(x),x));

Are all d'Alembert.

But my main point, is that I think d'Alembert form can not be missing and you seem to be saying it can.  I have not found one reference or example on the net so far. This is is only ODE I found so far with missing x that Maple says it is d'Alembert, and now I am confused because of this.

@lcz 

Maple does matrix conversion to list column wise. so if you do not transpose the matrix, you will not get correct answer.

could not find one. But this gives you list of all .mw files in same folder as the open you have open (assuming it is allready saved).

possible_names:=FileTools:-ListDirectory(interface(worksheetdir),'all','returnonly'="*.mw")

if the list returned has length of 1, then you know the name.

If the list has more than one, then the name worksheet could be any one of them.

In Mathematica, this is easy to find, there is a command for it, called https://reference.wolfram.com/language/ref/NotebookFileName.html

Maple should really have one like this also.

 

 

@BennyMopps 

I am sorry, I am not sure what you mean. The code simply replaces a,h,b,f,g with numerical values from the file, as you asked.

If you want to add `c` also, here is the new code

restart;
data := Import("c:/tmp/data.csv"):
data := convert(data,Matrix):
nRows,nCols := LinearAlgebra:-Dimension(data);
for n from 1 to nRows do
    unassign('a,h,b,f,g,c'):
    assign~([a,h,b,f,g,c],convert(data[n],list)):
    Conic:=a*x^2+2*h*x*y+b*y^2+2*f*x+2*g*y+c:
    print(Conic);
od:

And the new file is (must be .csv extension) is

2,-6,3,0,0,4
2,-3,3,0,0,4
5,-2,4,1,2,5
17,-4,10,20,99,6

When you run the above, it gives

What values you put in the file and which variables you want to change is up to you. Any changes to Conic after that, is also something you are free to do.

 

@Joe Riel 

So one need additional   

protect('bar');  # latest change

At the very end as well? WHy is that, as it was working OK without this? Is this needed for may be when making a copy of the object?  OK. I will edit my version also add these at end as well so it is in sync with your version.

 

@Joe Riel 

Yes, good point, I see that now. I'll keep the ModuleCopy  there in my code then.

I thought you had it there for one wants to make copy of the object.

 

@Joe Riel 

thanks. This works. So the idea is to export it, but add protection on it to prevent it being changed.  Here is following your example using 2 fields. I removed the ModuleCopy function for now

restart;
person_class := module()
   option object;

    export name;
    export age;

    export ModuleCopy::static := proc(self:: person_class, proto::person_class) 
        protect('self:-name');
        protect('self:-age');
    end proc;

   export set_name::static:=proc(self::person_class, val);
      unprotect('self:-name');
      self:-name := val;
      protect('self:-name');
      val;
   end proc;

   export set_age::static:=proc(self::person_class, val);
      unprotect('self:-age');
      self:-age := val;
      protect('self:-age');
      val;
   end proc;

   export foo::static:=proc(self::person_class)
       self:-name:="new name";
   end proc;

   #add these also at end of class
   protect('name');
   protect('age');

end module:

And now

p:=Object(person_class);
p:-set_name(p,"me"):
p:-name:="new name";  #gives error since protected. Good.
p:-name;  #reads name OK
p:-set_age(p,100):
p:-age;  #reads age OK

 

First 56 57 58 59 60 61 62 Last Page 58 of 94