Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

I read the article "ONEOptimal: A Maple Package for Generating One-Dimensional Optimal System of Finite Dimensional Lie Algebra", and also searched out in Maplesoft website, but couldn't found. Does anyone have the package?

As I am playing with Maple object to understand it better, I found strange thing.

I have simple object with 2 methods. Both are exported so they could be called from outside.

One method is called set_name and this one is called OK (I have print inside to print it is called). The next exported method is called process and when calling this method, the print never shows up. Which means it is not called. Using the same exact call.

When changing the name from process to something else, say processX now the print show, meaning the method is now called.

Is there restriction on what one can call their object method? And why would there be ?

Here is an example

restart;
module car_class()
      option object;
      local name::string:=""; 

      export process::static := proc(o::car_class)
             print("process method");             
      end proc:   

      export set_name::static := proc(o::car_class,_name::string)
             print("inside set name"); 
             o:-name := _name:
      end proc:     
end module:

my_car:=Object(car_class):  #make object

set_name(my_car,"toyota"):
process(my_car):
set_name(my_car,"toyota"):

On the screen, it only shows 

Now I changed it to 

restart;
module car_class()
      option object;
      local name::string:=""; 

      export processX::static := proc(o::car_class)
             print("process method");             
      end proc:   

      export set_name::static := proc(o::car_class,_name::string)
             print("inside set name"); 
             o:-name := _name:
      end proc:     
end module:

my_car:=Object(car_class):
set_name(my_car,"toyota"):
processX(my_car):
set_name(my_car,"toyota"):

And now on the screen it shows OK

Is there a way a way to be able to freely choose what method names to give to the object method? clearly the name "process"  is something special for Maple here for some reason.

When I do ?process, I see that Maple has some commands that have this name. But this is a name of a method inside Object class, so it should not have anything to do with any Maple own command. 

This was never an issue with module() for an example.  If one has to worry about what name to give to their methods for an object, then this will be very awkward. For example, what if one calls their method FOO and future version of Maple introduce a new command called FOO now the code will no longer work.

 

 

I wanted to create an Array() to store only objects of specific type in it.  

Array() supports the datatype=value  telling it the type of elements to store. But when I try to create an Array() using datatype of the class, it fails. I must be doing something wrong. Here is an example

restart;
module solution_class()
      option object;
      local sol::anything;
end module;
sol:=Object(solution_class); #create an object

Now the following works:

A:=Array();
A(1):=sol;

But I wanted to do

A:=Array(datatype=solution_class);
A(1) := sol;

 Error, unable to store '0' when datatype=module solution_class () local sol::anything; option object; end module
 

Help says 

And this is the case here, because type(sol,solution_class)  gives true

So 'solution_class' is valid type name.

Where is my error?

 

 

Dear maple users,

Greetings.

Q1.How to plot a figure for different values of M?

      like M=1,2,3,4:

Code:Mplot.mw

Q2. How to assign all the expressions are "remember table assignment"

Hi:

what is the value of this expression(eq) in Maple:

eq:=(x+I*y)^2-4*exp(I*x*y)

tnx...

 

Hello,

I try import a big Excel file with the first row as column labels for performing statistical etc.

I use this command :

data := Import(FileTools:-JoinPath(["d:", "directory", "subset2.xlsx"], platform = "windows"))

i need a dataframe for performing statistical with column label as first row, but i have this error :

Error, (in Import) invalid input: MatrixToDataFrame uses a 3rd argument, columns, which is missing

I can not understand what is this error...so, what i can do ?

Thanks, regards

Trying to use Curl tutorial when doing vector calculus

when I enter F:=VectorField(⟨y,-x,0⟩); it tells me unknown operator.

Regards

 

 

with(VectorCalculus);
SetCoordinates('cartesian'[x, y, z]);
                       cartesian[x, y, z]

F:=VectorField(⟨y,-x,0⟩);

Error, unknown operator
Typesetting:-mambiguous(FAssignVectorFieldApplyFunction(acirc

  Typesetting:-mambiguous(?, 

  Typesetting:-merror("unknown operator"))umlycommauminus0xcomma0

  acirc?copy))


 

I am having problems with VectorCalculus[Norm] with argument passing.

In certain cases I get the error message:

     "Error, (in VectorCalculus:-GetCoordinates) the first argument, when present, must be a Vector"

In all cases, the first argument IS a vector.

Here is the case I need to succeed:

VectorCalculus[Norm](DeleteRow(Vector[column](5, [x, y, z, w, 1]), RowDimension(Vector[column](5, [x, y, z, w, 1]))))

or more completely:

here is the test Document with several cases of the problem explored:

Failure_on_Calculus_Verctor_Norm.mw

Background.  Calculus Vector Norm doesn't know about Homogenous systems so it inculdes an unwanted term in its norm.  Trimming off the last row of the vector fixes this problem.

(Note: as I am new, so if there is an existing cononical notation that will take care of that without further ado, then I could leave CalculusVector[Norm] to its own devices and move on.

Also, if I knew how to peek at the underside of such gotchas, I might have been able to sort it out myself.  Any leads in this direction would be taken to heart.  Thanks)

 I want to find AutomorphismGroup  of star S4 (ie, K1,3).

with(GraphTheory):
with(GroupTheory):
with(SpecialGraphs):
S4:=CompleteGraph(1,3);
G1 := AutomorphismGroup(S4); # out is GroupTheory:-PermutationGroup({module() ... end module,module() ... end module},degree=4)

 

 

the S_4 has six automorphisms: (1, 2, 3), (1, 3, 2), (2, 1, 3), (2, 3, 1), (3, 1, 2,), (3, 2, 1):

GraphAutomorphismStar

For the output of maple ,I cannot understand.

Maybe I don’t understand the group enough. May somebody explain in detail,  Thanks!

There is a whole chapter in programming guide on OO in Maple.

How much is OO actually used by Maple programmers? Is OO used much internally at Maplesoft itself in implementing internal code? I do not see questions about OO in Maple in the forum. May be it has not taken off? 

Any one knows of packages in Maple written in OO style, using the Object module? I think OO was added in Maple 16, which is 2012?

p.s. I myself like OO programming. Done alot of it in Java. I think it can be useful for large applications.

 

 

Hi I have product of function Q along with its derivative.  

Q'j(x)*Qi(x) for j=0,1 and i=0,...n.

how can i make loop  to collect all coefficeints for this function for j=0,1 and i=0,1,..n.

i hope some one will help me.

Thanks

Hello, i'm a newbie in maple. I need to simulate the movement of the conical pendulum.

The equations of motion  https://www.cyberforum.ru/cgi-bin/latex.cgi?\ddot{\theta }=cos\theta sin\theta {\dot{\varphi }}^2-\frac{gsin\theta}{l} and https://www.cyberforum.ru/cgi-bin/latex.cgi?\ddot{\varphi }=-\frac{2cos\theta \dot{\varphi }\dot{\theta }}{sin\theta }

I include a link to a description of the conical pendulum.http://olewitthansen.dk/Physics/Conical_pendulum.pdf

Thanks in advance! 

Hi. My name is Eugenio and I’m a Professor at the Departamento de Didáctica de las Ciencias Experimentales, Sociales y Matemáticas at the Facultad de Educación of the Universidad Complutense de Madrid (UCM) and a member of the Instituto de Matemática Interdisciplinar (IMI) of the UCM.

I have a 14-year-old son. In the beginning of the pandemic, a confinement was ordered in Spain. It is not easy to make a kid understand that we shouldn't meet our friends and relatives for some time and that we should all stay at home in the first stage. So, I developed a simplified explanation of virus propagation for kids, firstly in Scratch and later in Maple, the latter using an implementation of turtle geometry that we developed long ago and has a much better graphic resolution (E. Roanes-Lozano and E. Roanes-Macías. An Implementation of “Turtle Graphics” in Maple V. MapleTech. Special Issue, 1994, 82-85). A video (in Spanish) of the Scratch version is available from the Instituto de Matemática Interdisciplinar (IMI) web page: https://www.ucm.es/imi/other-activities

Introduction

Surely you are uncomfortable being locked up at home, so I will try to justify that, although we are all looking forward going out, it is good not to meet your friends and family with whom you do not live.

I firstly need to mention a fractal is. A fractal is a geometric object whose structure is repeated at any scale. An example in nature is Romanesco broccoli, that you perhaps have eaten (you can search for images on the Internet). You can find a simple fractal in the following image (drawn with Maple):

Notice that each branch is divided into two branches, always forming the same angle and decreasing in size in the same proportion.

We can say that the tree in the previous image is of “depth 7” because there are 7 levels of branches.

It is quite easy to create this kind of drawing with the so called “turtle geometry” (with a recursive procedure, that is, a procedure that calls itself). Perhaps you have used Scratch programming language at school (or Logo, if you are older), which graphics are based in turtle geometry.

All drawings along these pages have been created with Maple. We can easily reform the code that generated the previous tree so that it has three, four, five,… branches at each level, instead of two.

But let’s begin with a tale that explains in a much simplified way how the spread of a disease works.

- o O o -

Let's suppose that a cat returns sick to Catland suffering from a very contagious disease and he meets his friends and family, since he has missed them so much.

We do not know very well how many cats each sick cat infects in average (before the order to STAY AT HOME arrives, as cats in Catland are very obedient and obey right away). Therefore, we’ll analyze different scenarios:

  1. Each sick cat infects two other cats.
  2. Each sick cat infects three other cats.
  3. Each sick cat infects five other cats

 

1. Each Sick Cat Infects Two Cats

In all the figures that follow, the cat initially sick is in the center of the image. The infected cats are represented by a red square.

· Before everyone gets confined at home, it only takes time for that first sick cat to see his friends, but then confinement is ordered (depth 1)

As you can see, with the cat meeting his friends and family, we already have 3 sick cats.

· Before all cats confine themselves at home, the first cat meets his friends, and these in turn have time to meet their friends (depth 2)

In this case, the number of sick cats is 7.

· Before every cat is confined at home, there is time for the initially sick cat to meet his friends, for these to meet their friends, and for the latter (friends of the friends of the first sick cat) to meet their friends (depth 3).

There are already 15 sick cats...

· Depth 4: 31 sick cats.

· Depth 5: 63 sick cats.

Next we’ll see what would happen if each sick cat infected three cats, instead of two.

 

2. Every Sick Cat Infects Three Cats

· Now we speed up, as you’ve got the idea.

The first sick cat has infected three friends or family before confining himself at home. So there are 4 infected cats.

· If each of the recently infected cats in the previous figure have in turn contact with their friends and family, we move on to the following situation, with 13 sick cats:

· And if each of these 13 infected cats lives a normal life, the disease spreads even more, and we already have 40!

· At the next step we have 121 sick cats:

· And, if they keep seeing friends and family, there will be 364 sick cats (the image reminds of what is called a Sierpinski triangle):

 

4. Every Sick Cat Infects Five Cats

· In this case already at depth 2 we already have 31 sick cats.

 

5. Conclusion

This is an example of exponential growth. And the higher the number of cats infected by each sick cat, the worse the situation is.

Therefore, avoiding meeting friends and relatives that do not live with you is hard, but good for stopping the infection. So, it is hard, but I stay at home at the first stage too!

Hi,

How can I find the RMS of a function like x(t) in maple? the help is not clear

x(t) := -3.703703704*10^(-7)*(0.000111668023*cos(1000/33*sqrt(1122)*t) - 0.0001214712007*sin(1000/33*sqrt(1122)*t) - 0.0002325581396*sqrt(561)*sqrt(2)*(-0.0004467462845*sqrt(1122)*sin(1000/33*sqrt(1122)*t) + 0.0004467462845*sqrt(1122)*cos(1000/33*sqrt(1122)*t)))/((2.074226433*10^14*cos(1000/33*sqrt(1122)*t) + 2.074226433*10^14*sin(1000/33*sqrt(1122)*t))*(4.895037587*10^(-11) + 0.01685634229*(0.00001474262739*cos(1000/33*sqrt(1122)*t) + 0.00001474262739*sin(1000/33*sqrt(1122)*t))^2)^2);

Thanks,

Baharm31

 

Sorry, I have not used Maple for a long time...

I would like to know the derivative of Jy w.r.t. py1 in the following. I expect the answer to be 2 Wy6 py1-2 Wy6 py10 but I get 0. Am I not using the subscripts properly that Maple is not understanding me?


 

J__y := (1/2)[W__y1(a[c]^y-(diff(S[1](t), t, t))^y)^2+W__y2((diff(S[1](t), t))^y)^2+W__y3(S[1]^y)^2+W__y4(`#mscripts(mi("φ",fontstyle = "normal"),mi("c"),none(),none(),mo("."),none(),none())`-`#mscripts(mi("φ",fontstyle = "normal"),mi("S"),none(),none(),mo("."),none(),none())`)^2+W__y5(`φ__S`)^2+W__y6(p__y1-p__y10)^2+W__y7(p__y2-p__y20)^2+W__y8(p__y3-p__y30)^2+W__y9(p__y4-p__y40)^2]

(1/2)[W__y1(a[c]^y-(diff(diff(S[1](t), t), t))^y)^2+W__y2((diff(S[1](t), t))^y)^2+W__y3(S[1]^y)^2+W__y4(`#mscripts(mi("φ",fontstyle = "normal"),mi("c"),none(),none(),mo("."),none(),none())`-`#mscripts(mi("φ",fontstyle = "normal"),mi("S"),none(),none(),mo("."),none(),none())`)^2+W__y5(phi__S)^2+W__y6(p__y1-p__y10)^2+W__y7(p__y2-p__y20)^2+W__y8(p__y3-p__y30)^2+W__y9(p__y4-p__y40)^2]

(1)

diff(p[y*i](t), t) := K[yp*i](p[y*i]-p[y0*i])-K[py*i]*(diff(Jy, p[y*i]))

K[yp*i](p[y*i]-p[y0*i])-K[py*i]*(diff(Jy, p[y*i]))

(2)

Diff(J__y, p__y1)

Diff((1/2)[W__y1(a[c]^y-(diff(diff(S[1](t), t), t))^y)^2+W__y2((diff(S[1](t), t))^y)^2+W__y3(S[1]^y)^2+W__y4(`#mscripts(mi("φ",fontstyle = "normal"),mi("c"),none(),none(),mo("."),none(),none())`-`#mscripts(mi("φ",fontstyle = "normal"),mi("S"),none(),none(),mo("."),none(),none())`)^2+W__y5(phi__S)^2+W__y6(p__y1-p__y10)^2+W__y7(p__y2-p__y20)^2+W__y8(p__y3-p__y30)^2+W__y9(p__y4-p__y40)^2], p__y1)

(3)

NULL

``


 

Download cost_function_partial_derivative.mw

First 540 541 542 543 544 545 546 Last Page 542 of 2224