nm

11413 Reputation

20 Badges

13 years, 72 days

MaplePrimes Activity


These are replies submitted by nm

is every one really supposed to know what HPM is? According to wiki

HPM may refer to:

Which one of the above are you looking for Maple code for?

@acer 

Thanks. But your solution seems to drop the "y".  If I understand, I will check the removed stuff, and see if it is empty or not. If the removed stuff is empty, then the original input was valid. Correct?  But for example, when I do this

restart;
expr:=y(x)+y;
candidates:=indets(expr, 'specfunc'(y));
reject:=remove(u->[op(u)]=[x], candidates);
if nops(reject)<>0 then
   print("Not ok input");
else
   print("Ok input");
fi;

It prints "Ok input", this is becuase candidates has only y(x) in it. So it missed the "y" there without (x), which is not valid input.

 

But replacing 

     candidates:=indets(expr, 'specfunc'(y));

by

candidates:=indets(expr);
candidates:=select(has,candidates,y);

fixed things:

restart;
expr:=y(x)+y;
candidates:=indets(expr);
candidates:=select(has,candidates,y);
reject:=remove(u->[op(u)]=[x], candidates);
if nops(reject)<>0 then
   print("Not ok input");
else
   print("Ok input");
fi;



 

@vv 

But e.g. dsolve cannot solve the simple:

 

That is not the point actually. This is just a parsing phase. I needed to make sure the input is valid syntax. Not that it can be solved or not.

@vv 

ODE, y(x) under Int should be (probably) also rejected.

 

actually, dsolve does not reject it. So I want to be just like doslve:

dsolve(diff(y(x),x)+int(sin(y(x)),x)=x,y(x));

Same when using Int instead of int. 

It will reject it if I wrote

dsolve(diff(y(x),x)+Int(sin(y(z)),z)=x,y(x));

Error, (in dsolve) found the indeterminate function y with different arguments {y(x), y(z)}
 

@Joe Riel 

Wow., I had not idea one could do this. Much better.

But this brings up the question: Why does not Maple help pages uses this way for the examples since this will protect the names and values of these options?

Should maple help pages be changed to use forward-quotes to protect the options then?  

@acer 

Thanks. But since it seems one then needs to declare every name used in the procedure, including names of options to Maple own commands, do you really expect someone to write this

foo:= proc()	

    local p,x,y,axes,projection,orientation,scaling,none,unconstrained;

    p:=plot3d(sin(x)*cos(y),x=0..Pi,y=0..Pi,
              axes = none, projection=0.9, 
              orientation=[-30,55,0], scaling=unconstrained
              ):
    p:
end proc:

 

And now mint(foo, toggle=[13]); does indeed give no messages.

But having to now declare even Maple own options names and option values as local variable each time is not practical.

In Mathematica, all these build-in options and their values are reserved, so a user could not modify them any way (at least not explicilty).  So in Mathematica, when one writes something like

foo[]:=Module[{p},
   p=Plot3D[Sin[x]Cos[y],{x,0,Pi},{y,0,Pi},
           Axes->False,
           ViewPoint->{1, -2, 0},
           BoxRatios->{1,1,1/2}];
  p
];

The above "names" Axes, ViewPoint, BoxRatios, etc.... similar to what I used in Maple's  axes=none, etc.... all these are symbols in system context. So a user does not have to worry about them having some value before as in Maple. 

This means in Maple, if I add a new option to my plot3, or remove an option to change it. I have to remember to go edit my local declaration line and make sure it now contains the correct names each time. (add or remove from it as needed).

Is this really practical?

Mathematica does not have a mint like tool that comes with Mathematica itself, I wish it did. It can be useful.

Thanks for the mint() proc. It is useful.

 

@vv 

"When a variable is implicitely declared local, a warning message appears."

But that is my question. Why did it not appear in this

restart;
foo := proc()     
    plot(sin(x),x=-Pi..Pi)   
end proc:

 

@Carl Love 

thanks,. But the above does not really work. Compare

restart;
T0:= (x,y,m)-> 20/Pi*sum((-1)^(n+1)/n*exp( n*Pi/10*y)*sin(n*Pi/10*x), n=1..m):
plot3d(
     T0(x,y,10), x= 0..10, y= 0..10,
     scaling= unconstrained
);

With

restart;
T0:= (x,y,m)-> 20/Pi*sum((-1)^(n+1)/n*exp( n*Pi/10*y)*sin(n*Pi/10*x), n=1..m):
plot3d(
     .4*T0(x,y,10), x= 0..10, y= 0..10,
     scaling= constrained, axis[3]= [tickmarks= [2=5, 4=10]]
);

 

In Mathematica, I could simply do

 

T0[x_,y_,m_]:=20/Pi Sum[(-1)^(n+1)/n Exp[-(n Pi/10) y] Sin[(n Pi/10) x],{n,1,m}]
Plot3D[T0[x,y,10],{x,0,10},{y,0,10},PlotRange->All,
           AxesLabel->{x,y,z},
           BoxRatios->{1, 1, 0.4}]

 

 

Mathematica does all the scaling and setting of ticks, etc... unaffected.

There is no excuse that Maple plot3d after 30 years, still does not support boxRatios. A very basic requirment for 3D plotting. This is like aspect ratio but for 3D.

This is one of the main reasons I do not use Maple for 3D actually.

this seems to have been answered an explained in a different question just now by Acer:

https://www.mapleprimes.com/questions/224730-Does-Maple-Have-Immediate-Vs-Delayed

One is delayed evaluation, and one is immediate evaluation. When you do g := unapply(PDF(X, t), t);  then it is evaluated and the result of evaluation becomes the result of the function.

compare

foo:=n->int(sin(n*x),x=0..Pi);

to

foo:=unapply(int(sin(n*x),x=0..Pi),n);

I have not run your code to verify, but you can check yourself and see if same thing happens for your definitions. One should be simpler than the other.

is this Maple code? I never seen code that looks like this

 

T/(k[t]*`&ell;`) = theta

this is very hard to read code.

 

@Joe Riel 

"I haven't used latex so don't know how t pass it an expression sequence"

I do not think it is possible. Only way seems to be to make it a list or set, as in

 

restart;
expr:=alpha,beta;
latex({expr});

which gives

\left\{ \alpha,\beta \right\} 

 

@Kitonum 

This is strange. Why is Maple definition of LegenreQ different from Mathematica definition? And which is correct one? in Mathematica 

Table[LegendreQ[1/2 (-1+Sqrt[5]),x],{x,-0.9,0.9,.1}]

Gives

{-1.14911, -1.22789, -1.24773, -1.24077, -1.21708, -1.18105, 
-1.13481, -1.0794, -1.01521, -0.942108, -0.859547, -0.766484, 
-0.661245, -0.541228, -0.402302, -0.237519, -0.0339568, 0.23695, 
0.664454}

No complex numbers here. 

Mathematica definition is here Maple definition is here

Quick scan shows they refer to same function. But I am no expert in special functions.

Any one knows why Maple LegenredQ gives complex values? Which is the correct result? Mathematica or Maple? Or are these using different definitions for same name of the function?

Also notice that the solution to this ODE should be real in |x|<1. So I do not undestand getting a complex solution.

 

@ecterrab 

"Regarding the name: I understand linux handles blank spaces in filenames out-of-the-box. It is more readable in general. So unless there is a more concrete problem that you could mention, I prefer it this way."

You can ofcourse do anything you like. But the issue with spaces in file and folder names, and why it is not a good idea to use spaces in the name, is old and well known. There are many articles written about it. I just googled "spaces in filenames" and got almost half million hits. 

For example, please see what-technical-reasons-exist-for-not-using-space-characters-in-file-names  if you browse through many of the articles on this, you'll see the majority recommend against using white spaces in file names.

For readability, "Physics_Updates.maple" is just as readable, if not more, than "Physics updates.maple" and avoids all the problems.

Again, it was a suggestion.  I myself avoid spaces in file and folder names all the time. They are simply not needed and can cause problems.

 

@ecterrab 

Thanks,. You are correct, PackageTools:-ListInstalledPackages() does Not show the Physics package. This explains the error.

 

That is a good command to know about. WIll wait to try it again after next Maple update.

 

 

@ecterrab 

I must be doing something wrong. I copied your command as is, but it is saying that 

     Error, (in PackageTools:-GetProperty) package Physics Updates.maple not found

Here is screen shot


  

But I know I have installed this package. Here is screen shot

 

What did I do wrong? 

 

First 69 70 71 72 73 74 75 Last Page 71 of 91