nm

9934 Reputation

19 Badges

12 years, 89 days

MaplePrimes Activity


These are questions asked by nm

I can't figure how to use the showsource() command. There are no examples given.

kernelopts(version);
Maple 2017.0, X86 64 WINDOWS, May 17 2017, Build ID 1231047

If I use it on a local proc() it gives an error. Since it needs a file name

f := proc(x) if x <= 2 then print(x); print(x^2) end if; print(-x); x^3 end proc:
showsource(f);

Error, (in fopen) file or directory does not exist

From help:

The showsource command is similar to showstat, but displays the original 
source code corresponding to the requested statements, if that source 
code is available and, in the case of procedures retrieved from 
libraries, kernelopts(keepdebuginfo) is true. If source code is 
not available, showsource raises a warning and then produces 
the same output as showstat.

But there is not one single example of how to use this command. I tried it on a local file (.mpl) in the same folder, but it complained.

restart;
currentdirName :="C:\\bla\\bla";
currentdir(currentdirName);
showsource("maple_proc.mpl");

Error, invalid input: showsource expects its 1st argument, p, 
to be of type {`::`, name}, but received maple_proc.mpl


If I try

showsource(int);
Warning, no source information available; using showstat instead

Just looking for an example on how to use this command. (why help does not show an example?)

 

 

 

Sometimes when one write a proc(), and later make changes, some of the earlier local variables could no longer used after the new edits.

In a small proc, it is easy to spot visually which ones are no longer needed and to remove them. But for a large proc() with many local variables, it is harder.

Does maple have a tool  to help one find which are the unused local declarations are not used? For example

foo:=proc(x)
local y,z:
x^2;
end proc;

I'd like maple to tell me that `y` and `z` are unused when I asked it to. (may be by highlighting or warning)

Mathematica has such a tool (and more) in its workbench editor which is very useful. does one need an external tool in Maple to do this?

http://www.maplesoft.com/applications/view.aspx?SID=1526&view=html

near the middle, it says

I just tried in Maple 2016 and that is not what it did. It says this was in Maple 8. It seems this was "fixed" in Maple 2015.

My question: How could Maple 8 have simplified rand()/rand() to 1 before evaluating rand()?  i.e. why was not rand() evaluated first, before the simplification was made? it seems to have worked as if one typed x/x , but rand() would have been a function, and it should be evaluated before?

Just wondering why Maple 8 did the above, that is all.

 

 

newbie here. When I give Maple 2016.2  a boundary value ODE with an eigenvalue in it, it returns the trivial solution. I was wondering if Maple supports finding non-trivial solution and also give the eigenvalue values associated with the non-trivial solution?

restart;
ode:=diff(y(x),x$2)+lambda*y(x)=0;
bc:=y(0)=0,y(L)=0:
assume(L>0,L,'real'):
sol:=dsolve({ode,bc},y(x));

The outtput is `y(x)=0`

In Mathematica, it gives both trivial and non-trivial solution:

Clear[L0, lam, x, y, r]
ode = y''[x] + lam y[x] == 0;
bc = {y[0] == 0, y[L0] == 0};
sol = Assuming[Element[L0, Reals] && L0 > 0, 
  DSolveValue[{ode, bc}, y[x], x]]

And the answer is

If Maple does not currently support this, any one knows if this will added to Maple 2017?

 

Is it possible to capture and convert the output of dismantle to one (long) string?

For example, if I do

r:=dismantle(x+sin(x));

SUM(5)
   NAME(4): x
   INTPOS(2): 1
   FUNCTION(3)
      NAME(4): sin #[protected, _syslib]
      EXPSEQ(2)
         NAME(4): x
   INTPOS(2): 1

I'd like to first capture the output in "r", which now it does not, it just goes to screen and "r" is left empty, and then convert the result to long string. (using convert()) So the result of the above will becomes

r:="SUM(5) NAME(4): x INTPOS(2): 1 FUNCTION(3) NAME(4): sin #[protected, _syslib]..."

The reason I need to capture the output, is so I can more easily look for some specific name/content inside the expression. which is now in a string, using string tools later on, which I think will be easier. For example, if I want to look for "sin" I can now search the above string and see if "sin" is there. Context is not important, just need to see if a name happens to be in the string.  The problem I do not know how to convert output of dismantle to string.

Maple 2016.2 on windows

 

First 154 155 156 157 158 159 160 Last Page 156 of 185