Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

 

Have you heard of Maple Scripting before? Do you want to extend your Maple Learn documents with your Maple knowledge? Scripting is the process of using Maple to create Maple Learn documents. If you’re already used to Maple, this may be a piece of cake for you, but we wanted to start from the basics for anyone who wants to extend their Maple Learn and Maple knowledge. This process can be used for many different types of documents, from quizzes to intensive 3D visualizations.

So, let’s get started! All Maple Learn document scripting needs the DocumentTools:-Canvas package. The canvas, as you know, is that white space in a Maple Learn document. Therefore, this package is the core content of a scripted document! Always put:

with(DocumentTools:-Canvas):

At the top of your code, or put

uses DocumentTools:-Canvas:

At the start of your procedures.

Now that we’ve told Maple to use the DocumentTools:-Canvas, we need to create a canvas.

Canvases are created as variables, using the command NewCanvas. Inside NewCanvas, you will add a square-bracket list of all the content you want to see inside. For now, just know that you can add text cells with Text(“YOUR TEXT”) and a math cell with Math(YOUR MATH). On the next line, make sure to put either ShareCanvas(YOUR CANVAS VARIABLE) or ShowCanvas(YOUR CANVAS VARIABLE).  ShareCanvas creates a Maple Learn sharelink, while ShowCanvas shows the canvas directly in Maple. Note that ShowCanvas does not have every Maple Learn feature, but makes quick work of fast error checking.

canvas := NewCanvas([Text(“My first canvas”), Math(3*x+2*y)]):

ShareCanvas(canvas);

There are two more things I want to show you in this post: How to make a group have multiple cells (instead of just the one), and how to position your items on the canvas. Let’s start with group making.

To create a group with multiple cells, use the Group() command within the NewCanvas command, and separate the cells with commas, in a list. You don’t need to specify Text() or Math() when using Group().

canvas := NewCanvas([Group([“This is the first cell…”, “The second….”, “and the third.”])]):

At the end of any command/canvas element, within the brackets, you can define position=[x,y] to specify where on the canvas the object should go. You can adjust the precision pixel by pixel until you are happy with the layout.

When we put all these together, we get code that looks like this:

with(DocumentTools:-Canvas):

canvas := NewCanvas([

Group(["This is the first cell…", "The second…", "and the third."], position=[200,200]),

Math(3*x+2, position=[100,100]),

Text("This is text!", position=[400,400])]):

ShareCanvas(canvas);

And in the end, your scripted document looks like this.

We hope this helps you get started with Maple Scripting. There will be another post on even more of what we can do with Maple Scripting, and how we can make these documents even more interactive. Let us know if there’s anything specific you want to see in that post!

 

Why is the Maple giving this error. See attched file. Further, how can we eq. of the form "A+B`*sqrt(C) = 0" by eliminating the common denominator.

CM_TW.mw

Hi, I have an rational polynomial:

r:=-36*u^3*v*(-1 + u + v)*(3*u^2 + u*v - 5*u - 2*v + 2)/(-1 + u)^2;

int(r, u=0..1-v, v=0..1);

Then I got:

I'm confused, why can't maple do this?

Any ideas about how to do this exact integration?

Hello!!
So I am brand new here and am here as somewhat of a last resort, I was in the hospital for a large portion of my semester (Junior Yr Computer Engineering/Electrical Engineering double major) and I am trying to get through the makeup work for my calculus class. The assignments are on maple, and I have been able to do all the actual solving parts with no issue but several of the problems require you to generate a graph as well and I have been working on it for literally 11  hours to no avail. I'm hoping maybe someone here can help me with what the input should be if I list what the graphs of the ones I am stuck on are (somehow managed to get 2 of them to work, but not the rest). No worries if not/if this is the wrong forum for this I am sorry, but I have cycled through every tutoring website I could find and the error I'm getting keeps linking to a page that says there is not a help page available for the error. So heres the problem I am stuck on (as I said I was able to do the solving for each section myself, I just cant get the graphs to work to save my soul):

2. Graph the following with maple:

a) the cardioid r = 8+8sin(theta) and find its area

b) the first octant portion of the surface z=25-x^2, 1<=y<=8 and find the volume of the solid over the xy plane under the surface

c) the solid common to the cylinders x^2+z^2=16 and y^2+x^2=16 and find the volume of the common region

d) the cylinder x^2+y^2=36 and the sphere x^2+y^2+z^2=100 together, then find the volume outside the cylinder and inside the  sphere

e) the region inside the one sheeted hyperboloid x62+y^2-z^2=36 between z=-8 and z=8 and find the volume of the region

f) the "ice cream cone" formed by the  upper half of the sphere x^2+y^2+z^2=400 and the cons z=sqrt(3x^2=3y^2), then find the z-coordinate of its center of mass written as a rounded decimal number with 3 places, assuming density is constant. 

Yeah, that is one of 11 problems on the project I know its a ton. Anyway like I said I am kind of posting this as a hail mary but if anyone can help me with what the input is supposed to be on any of these at all I would be eternally grateful, as I have 2 more of these projects to make up from while I was in the hospital and I have been on this one question all night. I will literally take ANYTHING. Thanks so much for reading and for anyone who takes the time to help out. 

hi. i want to improve my integration calculation speed, it takes me hours to calculate the results for even N=8. but i want for much more N's such as 20 30. can calculation speed improve? thanks in advance

Download M.mw

Problema with textplot

restart:with(plots):
  with(geometry):
  _EnvHorizontalName := 'x':
  _EnvVerticalName := 'y':
  a := 7:
  b := 3:
  ellipse(p, x^2/a^2 + y^2/b^2 - 1, [x, y]):
  Fig := proc(t)
              local M, l1,L1,L2,  q, m, c , tex;
              global a, b, p;
              point(M, a*cos(t), b*sin(t));
              if   VerticalCoord(M)=0
              then line(l1, x=HorizontalCoord(M));
              else m:=eval[recurse]( rhs
                                     ( isolate
                                       ( diff
                                         ( eval
                                           ( Equation(p),
                                             y=y(x)
                                           ),
                                           x
                                         ),
                                         diff(y(x),x)
                                       )
                                     ),
                                     [ y(x)=y,
                                       x=HorizontalCoord(M),
                                       y=VerticalCoord(M)
                                     ]
                                   );
                   c:=VerticalCoord(M)-m*HorizontalCoord(M);
                   line(l1, y=m*x+c);
              fi;
              reflection(q, p, l1);
              line(L1, [point(P1, evalf~(coordinates(foci(q)[1]))),
                            point(P2, evalf~(coordinates(foci(q)[2])))]):  
              line(L2, [point(P3, evalf~(coordinates(foci(p)[1]))),
                            point(P4, evalf~(coordinates(foci(p)[2])))]): 
              segment(P1P3,[P1,P3]): circle(cir1,[P3,2*a]):
              segment(P2P4,[P2,P4]): 
              circle(cir1,[P3,2*a]): circle(cir2,[P4,2*a]):
              textplot([[P2[], "F1"], [P4[], "F2"]], font = [times, 10], align = {below, left}):            
              draw( [ p(color = blue),P1P3(color=magenta,linestyle=3),
                      q(color = blue),P2P4(color=magenta,linestyle=3),
                      l1(color = black),L1(color = black),cir1(color=magenta,linestyle=3),
                      cir2(color=magenta,linestyle=3),
                      M(color = blue, symbol = solidcircle, symbolsize = 16),
                      P1(color = red, symbol = solidcircle, symbolsize = 16),
                      P2(color = red, symbol = solidcircle, symbolsize = 16),
                      P3(color = red, symbol = solidcircle, symbolsize = 16),
                      P4(color = red, symbol = solidcircle, symbolsize = 16)
                    ],
                    axes = none,
                    scaling = constrained);
          end proc:
#
# Change nFig to type float
#
   nFig := 180.0:
#
# Make sure loop index is a float, and change end point
# on loop to nFig-1.0
#
   Figs := seq(Fig(2*Pi*i/nFig), i = 0.0 .. nFig-1.0):
   plots:-display(Figs, insequence = true);
Error, (in plots:-textplot) improper op or subscript selector
Error, (in plots:-display) expecting plot structure but received: Figs

Hi maple users 

I am working with the PDE solver.

i am receiving a following error

"unable to compute solution for t>HFloat(0.0):" 

Kindly do the needful how to rectify this error.

dumm.mw

Consider the sequence of numbers 1, 2, 3, 4, ...

Can we plot these points on the real line?

That is, just a line with dots on the numbers 1, 2, 3, 4, ...

Hi Everyone,

I want to do some fourier analysis on a numeric ODE solution but first I wanted to understand all the commands and make sure it worked with a simple example. I created a Array of data which I attempted to take the DFT of but I got an error and I cannot seem to figure out why, I looked through the help pages and it looks like inputs use an Array of data but for some reason mine wont work. 

Worksheet attached, any help greatly appreciated. 

DFT_Test.mw

Dears

Can you give me advice on how to improve the calculation time for Binomial-Beta mcmc Metropolis-Hastings algorithm?

The calculation time for 50 000 samples for my laptop (Dell XPS 9710) takes approx 22 sec.
At the same time, in MathCAD Prime 8.0, the same amount of samples is calculated (using the same procedure) in approx 0.3 s.

======

======

I will be appreciated any help

wzelik

 

HHow do i correct "error, illegal use of an object as a name"

Given a planar graph G 

i) How to find the degrees of the regions of G

ii) The edges in each region as sets

iii) edges in the intersection of regions

dchange gives the error when I try to convert pde into ode. Why?

restarts

with(PDEtools)

pde1 := diff(u(x, t), t)-(diff(u(x, t), `$`(x, 2), t))+3*u(x, t)^2*(diff(u(x, t), x))-2*(diff(u(x, t), x))*(diff(u(x, t), `$`(x, 2)))-u(x, t)*(diff(u(x, t), `$`(x, 3))) = 0

diff(u(x, t), t)-(diff(diff(diff(u(x, t), t), x), x))+3*u(x, t)^2*(diff(u(x, t), x))-2*(diff(u(x, t), x))*(diff(diff(u(x, t), x), x))-u(x, t)*(diff(diff(diff(u(x, t), x), x), x)) = 0

(1)

trans1 := {seq(var[i] = tau[i], i = 2), FN = Y(zz), var[1] = (zz-(sum(lambda[i]*tau[i], i = 2)))/lambda[1]}

{FN = Y(zz), var[1] = (-lambda[2]*tau[2]+zz)/lambda[1], var[2] = tau[2]}

(2)

ode1 := dchange(trans1, pde, [Y(zz), zz, seq(tau[i], i = 2)])

Error, (in dchange/info) the number of new and old independent variables must be the same. Found {zz, tau[2]} as new, while {FN, var[1], var[2]} as old

 

op(lhs(pde1))

diff(u(x, t), t), -(diff(diff(diff(u(x, t), t), x), x)), 3*u(x, t)^2*(diff(u(x, t), x)), -2*(diff(u(x, t), x))*(diff(diff(u(x, t), x), x)), -u(x, t)*(diff(diff(diff(u(x, t), x), x), x))

(3)

 

Download P_O.mw

Hi Everyone,

surely my question has a simple answer, however, I am a bit stumped. I need to calculate field equations for which I need to take the covariant derivative of a tensor density. This yields additional "Christoffel-terms" in the usual manner.

For mathematical details see e.g. (https://math.stackexchange.com/questions/2267059/covariant-derivative-of-tensor-densities)

(I hope it's ok to link resources from another forum)

My problem is that I can't seem to find a command to define a tensor density in the Differential Geometry package. I can only obtain Metric densities through the "MetricDensity" command. However, this command does not create a tensor density in the usual manner.

One workaround might be to substitute the Metric Density from the command mentioned above into the covariant derivative after expanding in terms of the Christoffel-symbols. 

Any input would be appreciated.

I think I mentioned this before long time ago and never got any satisfactory answer. So I thought I will try again.

I never been able to figure why/how dsolve decides when to integrate the intermediate result vs. keeping the integral inert, even though it can integrate it.

It must use some rule internal to decide this, and this is what I am trying to find out.

Here is a very simple separable ode. So this is just really an integration problem.

restart;
ode:=diff(y(x),x)=(b*y(x)+sqrt(y(x)^2+b^2-1) )/(b^2-1);
dsolve(ode)

The first thing that comes to mind, is that Maple could not integrate it, that is why it gave inert integral. but it can integrate it but the result is a little long

int((b^2 - 1)/(b*y + sqrt(y^2 + b^2 - 1)),y)

So it could have generated the above implicit solution instead. Now notice what happens when I make very small change the ode.

restart;
ode:=diff(y(x),x)=(y(x)+sqrt(y(x)^2+b^2-1) )/(b^2-1);
dsolve(ode)

In the above I changed b*y to just y and guess what, now maple will integrate it and give an implicit solution instead of an inert integral

In both cases, Maple is able to do the integration. But in first case, it returned an inert integral and in the second it did not.

my question is why?  Does it have a rule where if the size of the integral is larger than some limit, it does not solve it? Did it say,

     "I think this result is too complicated to the user, so I will keep the integral inert instead"

If so, what are the rules it uses to decide when to do the integration and when to keep it inert? Is it based on leafcount? number of terms? something else?

infolevel does not give a hint on this, as all what it says is that it is separable.

Any one has an ideas on this?

2 3 4 5 6 7 8 Last Page 4 of 1962