## 271 Reputation

17 years, 124 days

## How do I add a title to a plot quickly...

Maple

I frequently title my plots to identify what is being plotted. Very often that means specifying a parameter. For example, I might want the title to read;  Exponential when the power is c.

In the above I want to replace c with a real number. For example, my command might read

> for c from 1 to 10 do
p||c := plot( x^c, x= -1..1, title= the power is c )
end do:

I can then display the sequence of plots nicely labelled.

That does not work.

I cannot find adequate  info about what follows title =  in the help pages or the manual so I end up creating a worksheet and experimenting for quite a while until I find something that works.
(The Help page says: “The value t can be an arbitrary expression.” That’s it. One can go to the typesetting page to get more info about captions which is probably relevant but it begins to feel like learning about sex by looking up words in the dictionary.

BTW, I have been using Maple for 18+ years so I should have a cheat sheet somewhere to remind me of the correct syntax but I am suggesting that Maple would be much more user friendly if this info was in the help pages.

It would be very nice to have a fuller explanation with more examples.

Here is what works:

c:=3;  # special case

plot(x^c, x=-1..1,title=`power is `|| c);  Why back quotes?

or

cc:=convert(c,string);
plot(x^c,x=-1..1,title=[`power is `||cc]);   why barckets?

or not as nice
plot(x^c,x=-1..1,title=power.is.cc);  why dots?

or if you get rid of the is
plot(x^c,x=-1..1,title=[power = c]);  why noy use is?

not as nice
plot(x^c,x=-1..1,title=[power = cc]);  ugly quote marks

Here is a list of failures in this very simple case:

c:=3;

plot(x^c,x=-1..1,title="power is c");

plot(x^c,x=-1..1,title=power is c);

cc:="c";plot(x^c,x=-1..1,title="power is cc");
or

plot(x^c,x=-1..1,title=power is cc);

plot(x^c,x=-1..1,title=power.is.cc);

cc:=convert(c,string);plot(x^c,x=-1..1,title="power is cc");

cc:=convert(c,string);plot(x^c,x=-1..1,title="power is cc");

plot(x^c,x=-1..1,title='power is cc');

plot(x^c,x=-1..1,title=[power, is, cc]);

plot(x^c,x=-1..1,title='power = cc');

plot(x^c,x=-1..1,title=power = cc); but plot(x^2,x=-1..1,title=[power = cc]);is acceptable

another couple of failures:

plot(x^c,x=-1..1,title=[`power is c`]);

plot(x^c,x=-1..1,title=[`power is cc`]);

## How do I get Maple to understand a prime...

Maple

I am trying to enter an ODE into Maple and I remember that Dr. Lopez showed how to use a prime to denote differentiation. When I try I get conflicting results: if I type

>  y''+y'+3*y=0;;

Error, unexpected single forward quote
But if I copy that command from the Help page Maple understands what I want. What is going on?

BTW, there is no entry for Differential Equations on the Help page.

## how do I open an xml file ona mac?...

Maple

The Help pages says:

Import a Worksheet from XML
Open an existing XML document as a worksheet to modify the content or to change its appearance.
1. From the File menu, select Open. The Open dialog appears.
Select the Maple Worksheet as XML file type.

Those instructions do NOT apply to Maple 2018 on a Mac (although I have verified they DO apply on a Windows machine.) No dialog appears.

My .mw file is 90% format information and thenbits and pieces of Maple code. Is there some way to just extract the maple stuff? The file is pretty long and cutting out the xml stuff is very time consuming.

Thanks,

## why is a procedure changing the input?...

Maple 2018

I have a procedure that changes the value of an input variable quite unexpectdly. Can anyone explain why? I have a very simplified example of this below.

restart;
with(LinearAlgebra):
switch := proc (V::Vector)
description "This procedure is supposed to take a Vector V and switch entries 1 and 2";
local W,a,b;
W:= V;
a:= W;
b:= W;
W[1 ] := b;
W :=a;
W
end proc;

V1:=Vector([1,3,5]);
V2:=switch(V1);
I have omitted the output for brevity's sake but all works well as expected.
However,
V1;

returns V2 not V1. Why is the procedure changing V1?

The problem occurs with matrices but not with lists.

Thanks.

## 2D weirdness (Maple 2018.2 OSX)...

Maple 2018

Here is a simple procedure that works fine if entered using 1D Maple input
> Q:=proc(x)
sin(x)
end proc;
but if you use 2D math input
> q:=proc(x)
sin(x);

end proc;

Error, unterminated procedure
Typesetting:-mambiguous(qAssignTypesetting:-mambiguous(

procApplyFunction(x) sinApplyFunction(x),

Typesetting:-merror("unterminated procedure")))
Error, unable to parse
Typesetting:-mambiguous(  Typesetting:-mambiguous(end,

Typesetting:-merror("unable to parse")) procsemi)

Ouch! But to confuse things further the following procedures may be entered using 2D math and work fine:
>H := proc (x) x^2*sin(x) end proc;
>K := proc (x) sin(x^2) end proc;
Doesn't make any sense to me. Perhaps 2D math is not ready for prime time?

﻿