MaplePrimes Questions

For last 4 hrs, I've been chasing this problem.

Inside a module, there is a proc with a name say foo().

It is local to the module. When creating an .mla file that contains this module which was read from .mpl file, and running a test against it, Maple does not see this specific proc foo() as a proc, but only sees it as a symbol.

So the call to foo() never happens (error is generated).

I have a print statement inside foo() also which never prints. In the debugger, when I try to step into foo(), it fails also. Maple simply does not see it as a proc.

I also added my_module:-foo() in call, but this made no difference, even though it is not needed to prefix the module name, since foo is a local proc.

Now, instead of making an .mla, I now just read the .mpl file directly which make up the module. And now run the same test, and now maple see foo() as proc and the test runs with no error.

No change in the code at all. Nothing changed, exacept the test is called one time when package is inside the .mla vs. just using plain .mpl files.  The module has option package on it.

It seems something goes wrong with symbol table when inside mla file.

When I do 

libname := currentdir(), libname;
LibraryTools:-Browse()

And browse the content inside my mla file, I see no problems, it lists all 24 procs inside the package, and I can see foo listed there as type PROC.

But in the code, what printing whattype(foo)  it says it is symbol when using mla file, but it says it is a procedure when not using mla, but just by reading the .mpl file which went into the .mla

I will try to make an example to reproduce this if I can. But has any one seen something like this before? What could cause this?  I've restarted Maple ofcourse, and this made no difference.

The way I build the mla is

FileTools:-Remove(cat(currentdir(),"/my.mla"));
LibraryTools:-Create(cat(currentdir(),"/my.mla"));

read cat(currentdir(),"/my_module.mpl");
LibraryTools:-Save('my_module',"my.mla");

For now, I will stop using .mla and just read the .mpl file each time to use the code, as this seems safer and this always worked and never gave any problems.

The code is large. I also use database. So I am not sure I can make a small example but will try.  

I am using 2020.1 on windows 10.

I am not able to use Maple's map() to do the following. Given 2 lists of things (of equal length), map a function that take 2 arguments, from these 2 lists, in order.  Here is an example to illustrate. In Mathematica

a = {1, 2, 3}; b = {7, 8, 9};
MapThread[f, {a, b}]

           {f[1, 7], f[2, 8], f[3, 9]}

In Maple, I tried map and map2, map[n] etc.. not able to get the result I want. I want to use map, and not ~

A:=[1,2,3];
B:=[7,8,9];
map((x,y)->f(x,y),A,B)

          [f(1, [7, 8, 9]), f(2, [7, 8, 9]), f(3, [7, 8, 9])]

 

map[2]((x,y)->f(x,y),A,B)

           [f([1, 2, 3], 7), f([1, 2, 3], 8), f([1, 2, 3], 9)]

and other things.

How to get same result as MapThread, using map?

In your answer, please include the calculation of the lamina's area and the location of its centre of mass.

Lamina.mw

Why doesn't this do the symbolic summation? Is there a way to get Maple to do it?

sum((-1)^n / n * x^n, n=1..infinity);

I have an expression  

product(q^(n -2)- q^i, i = 0 .. r )/product(q^(n-2) - q^(i+1), i = 0 .. r)

 

Obviously, it can be further simplified.

But in maple I can't do that, I use simplify and expand , all failed.

simplify(expand(%))

What should I do to get the simplified result I want?

 

Dear All,
I want to learn to work with Thread[Task] packages in Maple.However, I am confused when I studied the Help of Maple about. I can’t find out the Start and Continue command in the package. I can’t execute any simple program by Threads [Task]. The help of Maple has an example of the following:
with(Threads[Task]);
cont := proc( a, b )
   return a + b;
end proc;      
task := proc( i, j )
   local k;
   if ( j-i < 1000 ) then
       return add( k, k=i..j );
   else
       k := floor( (j-i)/2 )+i;
       Continue( cont, Task=[ task, i, k ], Task=[ task, k+1, j ] );
   end if;
end proc;
Start(task, 1, 10^7);

I want to remove if-clause in task procedure as the following. In the other words, I want to use multi-threads for any values of i and j. However, the program doesn’t work correctly. What hint is something I don’t correctly understand?

Besides, I may don’t find deeply out the meaning and deference of parent, leaf, child, and continuation tasks. would you explain to me those tasks easily? The help of Maple doesn't convey a unified explanation for them.
 
Please guide me to overcome the problem.
Best wishes,
 
with(Threads[Task]);
cont := proc( a, b )
   return a + b;
end proc;      
task := proc( i, j )
   local k;
        k := floor( (j-i)/2 )+i;
       Continue( cont, Task=[ task, i, k ], Task=[ task, k+1, j ] );
end proc;
Start(task, 1, 10^7);

We tryto  find a solution to the differential equation f'(x)=f^(-1)(x).

I just noticed that Maple 2020.1 (but not plain 2020) has an issue with print to PDF if you have a plot3d on a page.

Anything after the plot3d output on the same page of the PDF file is simply not shown.

The issue seems to be with both Windows and Mac which makes me suspect its a Maple problem.

Any info on this? Any workarounds? We have students with written exams in a week so its a bit annoying.

Tried several things to get a neat grey box with Maple text in it 
What to do for making this ? 

Hi everyone...

How can anyone help me in the attached file? I want to know how the equation of the system turned into a dimensionless

dynamical system?

 

 

I did not know about these before. Was looking at 

https://fr.maplesoft.com/support/help/Maple/view.aspx?path=repository/management

And wanted to display the actual values of $MAPLE,$TOOLBOX, $VERSION,$HOME gives about. 

But everything I tried does not work. 

anames('environment');
getenv("$MAPLE");
print("$MAPLE/toolbox/$VERSION/$TOOLBOX/lib")

Where are these things defined and how to display them from inside Maple to see where they point to?

 

Maple 2020.1 on windows 10

 

dAlembert ode has the form

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

Which also agrees with textbooks and Wikipedia

 

https://en.wikipedia.org/wiki/D%27Alembert%27s_equation

 

 

So the ODE should have   x  in there (the independent variable).  

Then why  in the following, when I give Maple ode of form   y=f(p)+g(p)  it says it is d'Alembert? notice that there is no x in there

restart;
ode:=y(x)=ln(cos(diff(y(x),x)))+diff(y(x),x)*tan(diff(y(x),x))

DEtools:-odeadvisor(ode)

I am not saying Maple is wrong, as I am not sure, but I am just trying to understand what is going on. All references I've seen so far say x should be there.  Otherwise, how did Maple determine it is dAlembert if not using the orginal form to check against?

The strange thing is calling dsolve on the ode, with no option gives different answer if calling dsolve telling it is is dAlembert:

dsolve(ode,[dAlembert]);

but

dsolve(ode)

Why it did not give the same result? 

 

I'd like to convert  every row of matrix to list, but failed.  I want to use batch operations map(~) not for-loop.

data:=Matrix(3, 5, [[2, -6, 3, 0, 0], [5, -2, 4, 1, 2], [17, -4, 10, 20, 99]])

Matrix(3, 5, {(1, 1) = 2, (1, 2) = -6, (1, 3) = 3, (1, 4) = 0, (1, 5) = 0, (2, 1) = 5, (2, 2) = -2, (2, 3) = 4, (2, 4) = 1, (2, 5) = 2, (3, 1) = 17, (3, 2) = -4, (3, 3) = 10, (3, 4) = 20, (3, 5) = 99})

(2)

convert~(data,list)

Matrix(3, 5, {(1, 1) = [2], (1, 2) = [-6], (1, 3) = [3], (1, 4) = [0], (1, 5) = [0], (2, 1) = [5], (2, 2) = [-2], (2, 3) = [4], (2, 4) = [1], (2, 5) = [2], (3, 1) = [17], (3, 2) = [-4], (3, 3) = [10], (3, 4) = [20], (3, 5) = [99]})

(3)

convert(data,list)

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

(4)

The expected output is the following:

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

 

 

 

Download ss.mw

I noticed the following. I have 2 worksheets. A.mw and B.mw.  From A.mw, it does something as follows

libname := currentdir(), libname
foo();

Where foo() is entry inside my say TMP.mla in currentdir(). This works fine with no problems and foo() executes and complete OK.

Now I make changes to the code foo.mpl, and need to update TMP.mla. currently I use LibraryTools. But i'd like to delete TMP.mla each time and create new one so I am sure there is no problem. So from B.mw I run this code

libname:= currentdir(),libname;
FileTools:-Remove("TMP.mla");
LibraryTools:-Create("TMP.mla");
read "foo.mpl";
LibraryTools:-Save('foo',"TMP.mla");

This all works well, except it fails at the Remove line, since "TMP.mla" could not be removed, since it was open before when running the A workseet, and it seems to be still open and Maple could not delete the file.

So each time this happens, I close all worksheets, close Maple, open Maple again, and now I can run the above code OK to update the mla.

Is there a better way to do all of this?

I worry if I do not delete the mla each time, I could end up with old code there I do not want, if I rename things in my code. That is why I like to start with fresh mla file each time.  But I always have to restart Maple now to update the mla.

 

does maple provide a way to programatically get the name of the "current" worksheet file?

I'm looking for something analogous to
interface(worksheetdir);

which gives the directory the worksheet file is in.

thanks.

 

First 518 519 520 521 522 523 524 Last Page 520 of 2428