nm

11353 Reputation

20 Badges

13 years, 13 days

MaplePrimes Activity


These are replies submitted by nm

@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

 

@Joe Riel 

Thanks, but I do not see how this would work. From help it says 

When declaring an object the members must be declared as either local to the object, using a local declaration or exported, using an export declaration.  A member that is declared local can only be accessed from the object's methods, or other object's methods of the same class.  A member that is exported can be accessed anywhere.

which I understood it to mean that local variables for object are private. And when I tried it, it confirms the above

restart;
module my_class()
  option object;

  local name::string;
 
  export set_name::static:=proc(o::my_class,name::string)
     o:-name := name;
  end proc;

end module;

And now

o:=Object(my_class);
o:-name;

gives an error

Error, module `my_class` does not export `name`
 

May be I am missing something from what you are saying. I do not understand.

@Carl Love 

fyi, In the .mw posted, it says

     Now I am trying to achieve a general expression by substituting j for 6

so OP was trying to replace number by a symbol j, that is why they were getting an error,  They had it working for an integer, but were trying to use symbol for j.

At least this is what I understood by looking at their code.

If you look at help for combinat:-numbcomb(n,m) it says first argument must be a set or a list or a non-negative integer.

Therefore, what would you expect the output of 

restart:
i:=4;
combinat:-numbcomb(j+i,i+1)

to give?  Since now the first argument which is j+4  is none of the allowed first arguments.

It is not a list, and not a set and not a non-negative integer.

@acer 

Thanks, it worked. 

   "And inside your procedure the local ode gets only 1-level evaluation."

This explains why

               ode := :-parse("diff(y(x),x$2)=0"): 

works, but inside a proc, one must do 

               ode := eval(:-parse("diff(y(x),x$2)=0")):

I had no idea that semantics of assignment to local variable is different than assignment to the variable when in global context before.

I thought the LHS name gets assigned whatever the value of the RHS, regadless if variable is inside a proc or not. But it seems this is not the case. Maple evaluation rules seems more complicated than I first thought. I need to look more into this.

@ecterrab 

Thanks. I knew about your papers and I've just started studying the first one. But I have a small question if I may.

In the Maple help,

https://fr.maplesoft.com/support/help/Maple/view.aspx?path=odeadvisor/Abel 

It says if Abel ODE has f2=0, and the Abel invariant do not depend on , then the ODE can be solved directly.

But how directly? Since it is still Abel ODE. For example, Kamke #38 has f2=0 and constant invariant:

ODE:=-a*y(x)^3-b/x^(3/2)+diff(y(x),x)=0; #kamke 38


Which has, by comparing the above to y'=f0+f1*y+f2*y^2+f3*y^3 the following

f0:=b/x^(3/2);
f1:=0;
f2:=0;
f3:=a;
DEtools:-odeadvisor(ODE);

[[_homogeneous, `class G`], _rational, _Abel]

And so the Abel invariant is 

f0:=b/x^(3/2); 
f1:=0; 
f2:=0; 
f3:=a; 
inv:=-(-diff(f0, x)*f3 + f0*diff(f3, x) + 3*f0*f3*f1)^3/(27*f3^4*f0^5)

So we see the invariant does not depend on x. But now what? How to solve the ODE "directly". This is the part I am missing. Since it is the same ODE, i.e. Abel. Nothing changed.  

Is there some additional transformation needed? The transformation mentioned in the help, is when f2<>0, in order to eliminate f2. But this is not the case here.

What is it I am missing here? 

thanks

@Joe Riel 

Ok, So what is the internal representation of 1/z ? would that not be z^(-1)? If so, then why subs(z=t,1/z); worked, since there is no term in the expression, there is only z^(-1)?

What would you recommend then to replace (x*y) in the expression 1/(x*y) with some other value such as which would also work if (x*y) was in the numerator or in the denominator?

 

@Joe Riel 

"Something I'd like to see is object inheritance."

Maplesoft seems to have limited resources and is a small company compared to the competition.

Therefore It would be much better if it uses these resources on things that are much more useful  and practical than adding inheritance and multiple inheritance, which might end up being used by very few people to do CAS programming. 

Improving the debugger for example, will be much much more useful to many more people as well as improving the Latex export. These things are used by many people all the time.

Maplesoft should also concentrate its resources more on core Mathematics and less of fancy features trying to follow the competition.

I'd rather see Maplesoft use its limited and important resources to make Maple solve more PDE's, ODE's, equations and integrals for example. (in addition to improving the debugger and Latex). 

I have not even mentioned the robustness of the software. Maple hangs on me each day may be 2-3 times whenever I run a long computational script, and at random locations, due to memory issues it seems in mserver.exe.

It seems to me that doing stress tests on Maple to fix such problems is much more important use of your resources.

 

 

First 53 54 55 56 57 58 59 Last Page 55 of 91