## Why are the errors in odd positions not consistent...

Dear esteem Colleagues,

Please how do I modify the following two files (though similar) to get consistent errors? I am not sure where I made the mistake.

Any modifications would be appreciated.

Thank you all for your time and mentorship. Best regard

Biratu_Mapleprimes.mw

DDE_2_Mapleprime.mw

## Shade region between two vertical lines in plot...

I would like to emphasize a particular region of my plot by shading the whole strip between x=0 and x=1. I learned of the command shadebetween, but the functions it takes as arguments for the boundaries of the region to shade must be functions of x.

Does someone know how to shade between two vertical lines?

## How to combine matrices?...

I am a new user to Maple, but have used PTC's Mathcad and Prime.

I have several matrices that I need to combine both vertically and horizontally.  The command augment will combine the matrices horizontally.  I was unable to find a command to combine the matrices vertically.  I tried the stack command (Prime command).  The Maple stack command appears to have a different functionality.  Could you suggest which command would do the job?  The matrices are large and I would like to limit the number of rows and columns shown in the document.

The next step will be sorting the data. I am researching this at this time.

Thank you for the support,

David Tietje

## How to get written out some terms of a sum?...

Alternating serie

 (1)

 > sum((-1)^(n + 1)/(2*n - 1), n = 1 .. infinity):

 (2)
 > expand(sum((-1)^(n + 1)/(2*n - 1), n = 1 .. 4),symbolic);
 (3)
 > ?expand
 > series(sum((-1)^(n + 1)/(2*n - 1), n = 1 .. infinity),n=0,5);
 (4)
 >
 Info series

How to get for n= 4

## Why are symbols and indexed names handled differen...

Input:

a := x^2;
whattype(x);
b := x[1]^2;
whattype(x[1]);
CodeGeneration[C](a);
CodeGeneration[C](b);

Output:

Do you know why cg0 =/= x[0]*x[0]?

## How to use GRID in PLOT3D?...

Hello people in MaplePrimes,

I can't understand a code with PLOT3D using GRID in it.
I hope you will give me explanation about it.

```restart;
k:=[[1,2,10],[1,1,8],[0,1,5],[0,0,6]];
PLOT3D(GRID(1..2,1..3,k),
AXESLABELS(x,y,z));
```

I cannot understand the correspondence between points in the graph and lists in the code such as [1,2,10], [1,1,8].

As two ranges in GRID augments in the code are 1..2 and 1..3, x takes value from 1 to 2, and
y from 1 to 3 in the picture.
And, as k is k:=[[1,2,10],[1,1,8],[0,1,5],[0,0,6]], which means this list of lists are 4 X 3, so in the picture
as for x the interval of 1 to 2 is divided to three sections with the points of value of 0, 1/3, 2/3 and 3/3, which total number is 4.
And, as for y the interval of 1 to 3 is devided to two sections with the points of value of 1, 2 and 3, which total number is 3.

And, I cannot understand why from the grid of [1,1,8] in the code, which I think is the coodinate of (1, 1) on x-y plane, does not mean that the value of z on that point on the graph is not 8, but 1.

graph.mw

## what is the error of second order of pde...

restart:

sys:={-diff(v(x,t),t)+0.5*p*diff(u(x,t),x,x)+q*u(x,t)*(u(x,t)^2+v(x,t)^2)=0,diff(u(x,t),t)+0.5*p*diff(v(x,t),x,x)+q*v(x,t)*(u(x,t)^2+v(x,t)^2)=0};
/                      /  2         \
|/ d         \         | d          |
sys := < |--- u(x, t)| + 0.5 p |---- v(x, t)|
|\ dt        /         |   2        |
\                      \ dx         /

/       2          2\       / d         \
+ q v(x, t) \u(x, t)  + v(x, t) / = 0, -|--- v(x, t)|
\ dt        /

/  2         \                                      \
| d          |             /       2          2\    |
+ 0.5 p |---- u(x, t)| + q u(x, t) \u(x, t)  + v(x, t) / = 0 >
|   2        |                                      |
\ dx         /                                      /
eq1 := diff(u(x,t),t) = u__t(x,t):
eq2 := diff(v(x,t),t) = v__t(x,t):

sys_tmp := subs(eq1, eq2, sys):

sys_new := sys_tmp union {eq1, eq2}:

Boundary conditions:
bc :=
u(0,t) = 2,
v(0,t) = 0;
bc := u(0, t) = 2, v(0, t) = 0
Initial conditions:
ic :=
u(x,0) = tanh(2*Pi),
v(x,0) = tanh(2*Pi),
u__t(x,0) = 0,
v__t(x,0) = 0;

ic := u(x, 0) = tanh(2 Pi), v(x, 0) = tanh(2 Pi), u__t(x, 0) = 0,

v__t(x, 0) = 0
Solve the system:
pdsol := pdsolve(subs(p=1, q=0.5, sys_new), {ic, bc}, numeric);

## How do I change variables...

I want to change my variables. The coding below shows the influence of the Nb and Nt on the local Nusselt number (-theta') against the convection Bi.

But now I want it to be  the influence of the Bi on the local Nusselt number (-theta') against the Nb and Nt.

Can anyone help me?

 >
 >
 >
 (1)
 >
 (2)
 >
 (3)
 >
 (4)
 >
 (5)
 >
 (6)
 >
 > getRes:= proc(a, x);                 local sol;                 if   type(x, numeric)                 then sol:= dsolve                            ( eval                              ( {BC1, BC2, BC3, DE1, DE2, DE3},                                [Nt = a, Nb = a, Pr = 2, Le = 5, Bi = x]                              ),                              numeric,                              output = listprocedure,                              abserr = 0.0001,                              maxmesh = 1024,                              initmesh = 512                            );                 else return 'procname(a,x)';                 fi;                 return -eval(diff(theta(eta), eta), sol)(0)            end proc:   cl:=[red, green, blue, yellow, black]:   L:=[0.2, 0.4, 0.6,0.8,1.0]:   display   ( [ seq       ( plot         ( getRes( L[k], x),           x=0..5,color = colorList[k], legend = ["Nb=Nt" = L[k]], legendstyle = [location = top],           color=cl[k]         ),         k=1..5       )     ]   )
 >
 >

## How calculating this contour integral...

 Contour integration notation   The limits of integration are intented to indicate a path of integration which begins at + ∞, moves to th e left down the positive real axis, circles the orign once in positive ( counterclockwise) direction, and returns up to the positive real axis to  +∞ -How does this contour look like  in a  graph ? - the  notation  ? - calculating this complexe contour integral? Seems that the concept of the contour integration is similar wit a line integral in real calculus ? Some more information needed about singularities ( first en second order ..more?) Nieuwe pagina 1 (hhofstede.nl)

## Maple doesn't seem to compute correctly this expre...

I have just come across this curious but really boring problem.
In the code snippet below, expr1 and expr2 are identical.

```restart:
data := [a=1, b=2]:
convert(
piecewise(And(x(t) > a, x(t) < b), 1, 0),
Heaviside
):
expr1 := eval(eval(%, data),  x(t)=z):
plot(expr1, z=0..3);

convert(
piecewise(And(z > a, z< b), 1, 0),
Heaviside
):
expr2 := eval(%, data),:
plot(expr2, z=0..3);```

But if I change the parameterization of the problem, expr2 is still correct but expr1 is not

```restart:
data := [d=1.5, a=0.5]:
convert(
piecewise(And(x(t) > d-a, x(t) < d+a), 1, 0),
Heaviside
):
expr1 := eval(eval(%, data),  x(t)=z):
plot(expr1, z=0..3);

convert(
piecewise(And(z > d-a, z< d+a), 1, 0),
Heaviside
):
expr2 := eval(%, data),:
plot(expr2, z=0..3);
```

Where does this come from?

## Output CodeGeneration Matlab to a file...

Hello,

I would like to write to a file the output of the command CodeGeneration[Matlab]. I couldn't find a way to write the output.

What I am trying to do is to generate complex symbolic equations and expressions and write them as either a function or variables in matlab.

As an example:

exp := [sin(theta(1)), cos(theta(1))];

func := unapply(exp,[theta]);

CodeGeneration:-Matlab(func)

If i can write the output of the above command in a matlab file, it will generate a matlab function file.

I was using the command 'writeto' but this one basically outputs every line a command written to a file instead of the terminal, which is not what I want (it will output even the warnings, I know I can silent them!).

## plot two depending equation in maple...

Hello guys,

I want to plot two functions such as x(t) and y(t) in a unique diagram as a function of each other. In a routine way, one needs to solve one of these functions as t and then input its results in others. for example, solving x(t) to find t and then input this t(x) into y(t) to have y(x). but here problem is that I cannot solve x(t) to find t and so this routine solution is not accelssible.

x(t):=1 + (3*n*(v - 1)^2*A*(t^v)^2*(1 + alpha*(v - 1)^2*A^2*(t^v)^2*ln(m^2*t^2/((v - 1)^2*A^2*(t^v)^2))/(3*n^2*m^2*t^2) + A^2*beta*(v - 1)^2*(t^v)^2/(3*n^2*m^2*t^2))*((4*A^2*alpha*t^v*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2)) + 6*t^(-v + 2)*m^2*n^2 + 4*t^v*(beta - alpha/2)*A^2*(v - 1)^2)*sqrt(n^2*(v - 1)^2*A^2*t^(2*v)/v^2) - 3*n*A*(A^2*alpha*t^(2*v)*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2)) + A^2*beta*(v - 1)^2*t^(2*v) + 3*n^2*m^2*t^2))*(1 + ((4*A^2*alpha*t^v*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2)) + 6*t^(-v + 2)*m^2*n^2 + 4*t^v*(beta - alpha/2)*A^2*(v - 1)^2)*sqrt(n^2*(v - 1)^2*A^2*t^(2*v)/v^2) - 3*n*A*(A^2*alpha*t^(2*v)*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2)) + A^2*beta*(v - 1)^2*t^(2*v) + 3*n^2*m^2*t^2))/(3*n*A*(A^2*alpha*t^(2*v)*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2)) + A^2*beta*(v - 1)^2*t^(2*v) + 3*n^2*m^2*t^2))))/(2*v^2*(A^2*alpha*t^(2*v)*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2)) + A^2*beta*(v - 1)^2*t^(2*v) + 3*n^2*m^2*t^2)) - (3*n^2*(v - 1)^2*A^2*(t^v)^2*(1 + alpha*(v - 1)^2*A^2*(t^v)^2*ln(m^2*t^2/((v - 1)^2*A^2*(t^v)^2))/(3*n^2*m^2*t^2) + A^2*beta*(v - 1)^2*(t^v)^2/(3*n^2*m^2*t^2))*(((4*A^2*alpha*t^v*v*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2))/t + 4*A^2*alpha*t^v*(v - 1)^2*(2 - 2*v)/t + 6*t^(-v + 2)*(-v + 2)*m^2*n^2/t + 4*t^v*v*(beta - alpha/2)*A^2*(v - 1)^2/t)*sqrt(n^2*(v - 1)^2*A^2*t^(2*v)/v^2) + (4*A^2*alpha*t^v*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2)) + 6*t^(-v + 2)*m^2*n^2 + 4*t^v*(beta - alpha/2)*A^2*(v - 1)^2)*n^2*(v - 1)^2*A^2*t^(2*v)/(sqrt(n^2*(v - 1)^2*A^2*t^(2*v)/v^2)*v*t) - 3*n*A*(2*A^2*alpha*t^(2*v)*v*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2))/t + A^2*alpha*t^(2*v)*(v - 1)^2*(2 - 2*v)/t + 2*A^2*beta*(v - 1)^2*t^(2*v)*v/t + 6*n^2*m^2*t))/(3*n*A*(A^2*alpha*t^(2*v)*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2)) + A^2*beta*(v - 1)^2*t^(2*v) + 3*n^2*m^2*t^2)) - (((4*A^2*alpha*t^v*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2)) + 6*t^(-v + 2)*m^2*n^2 + 4*t^v*(beta - alpha/2)*A^2*(v - 1)^2)*sqrt(n^2*(v - 1)^2*A^2*t^(2*v)/v^2) - 3*n*A*(A^2*alpha*t^(2*v)*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2)) + A^2*beta*(v - 1)^2*t^(2*v) + 3*n^2*m^2*t^2))*(2*A^2*alpha*t^(2*v)*v*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2))/t + A^2*alpha*t^(2*v)*(v - 1)^2*(2 - 2*v)/t + 2*A^2*beta*(v - 1)^2*t^(2*v)*v/t + 6*n^2*m^2*t))/(3*n*A*(A^2*alpha*t^(2*v)*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2)) + A^2*beta*(v - 1)^2*t^(2*v) + 3*n^2*m^2*t^2)^2)))/(2*v^2):

y(t):=1 + ((4*A^2*alpha*t^v*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2)) + 6*t^(-v + 2)*m^2*n^2 + 4*t^v*(beta - alpha/2)*A^2*(v - 1)^2)*sqrt(n^2*(v - 1)^2*A^2*t^(2*v)/v^2) - 3*n*A*(A^2*alpha*t^(2*v)*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2)) + A^2*beta*(v - 1)^2*t^(2*v) + 3*n^2*m^2*t^2))/(3*n*A*(A^2*alpha*t^(2*v)*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2)) + A^2*beta*(v - 1)^2*t^(2*v) + 3*n^2*m^2*t^2)) - (((4*A^2*alpha*t^v*v*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2))/t + 4*A^2*alpha*t^v*(v - 1)^2*(2 - 2*v)/t + 6*t^(-v + 2)*(-v + 2)*m^2*n^2/t + 4*t^v*v*(beta - alpha/2)*A^2*(v - 1)^2/t)*sqrt(n^2*(v - 1)^2*A^2*t^(2*v)/v^2) + (4*A^2*alpha*t^v*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2)) + 6*t^(-v + 2)*m^2*n^2 + 4*t^v*(beta - alpha/2)*A^2*(v - 1)^2)*n^2*(v - 1)^2*A^2*t^(2*v)/(sqrt(n^2*(v - 1)^2*A^2*t^(2*v)/v^2)*v*t) - 3*n*A*(2*A^2*alpha*t^(2*v)*v*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2))/t + A^2*alpha*t^(2*v)*(v - 1)^2*(2 - 2*v)/t + 2*A^2*beta*(v - 1)^2*t^(2*v)*v/t + 6*n^2*m^2*t))/(3*n*A*(A^2*alpha*t^(2*v)*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2)) + A^2*beta*(v - 1)^2*t^(2*v) + 3*n^2*m^2*t^2)) - (((4*A^2*alpha*t^v*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2)) + 6*t^(-v + 2)*m^2*n^2 + 4*t^v*(beta - alpha/2)*A^2*(v - 1)^2)*sqrt(n^2*(v - 1)^2*A^2*t^(2*v)/v^2) - 3*n*A*(A^2*alpha*t^(2*v)*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2)) + A^2*beta*(v - 1)^2*t^(2*v) + 3*n^2*m^2*t^2))*(2*A^2*alpha*t^(2*v)*v*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2))/t + A^2*alpha*t^(2*v)*(v - 1)^2*(2 - 2*v)/t + 2*A^2*beta*(v - 1)^2*t^(2*v)*v/t + 6*n^2*m^2*t))/(3*n*A*(A^2*alpha*t^(2*v)*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2)) + A^2*beta*(v - 1)^2*t^(2*v) + 3*n^2*m^2*t^2)^2))*n*A*(A^2*alpha*t^(2*v)*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2)) + A^2*beta*(v - 1)^2*t^(2*v) + 3*n^2*m^2*t^2)/((4*A^2*alpha*t^v*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2)) + 6*t^(-v + 2)*m^2*n^2 + 4*t^v*(beta - alpha/2)*A^2*(v - 1)^2)*sqrt(n^2*(v - 1)^2*A^2*t^(2*v)/v^2) - 3*n*A*(A^2*alpha*t^(2*v)*(v - 1)^2*ln(m^2*t^(2 - 2*v)/((v - 1)^2*A^2)) + A^2*beta*(v - 1)^2*t^(2*v) + 3*n^2*m^2*t^2)):

there are x(t) and y(t). I want to plot y as x, not t. so please help me.

with best

## procedure in ribbonplot...

Hello people in Mapleprimes,
I haven't written in this site for a long time.

I have a question in the below program, which is to write ribbons.
For the implementation of this program,
I wrote this.
ribbonplot5([cos, sin, cos + sin], -Pi .. Pi,numpoints=20);

In the part of pattern matching, as -Pi .. Pi above is a range, so it is OK.
But, when I changed this part to x=-Pi..Pi, an error message appears.

ribbonplot5([cos, sin, cos + sin],x=-Pi .. Pi,numpoints=20);

brings error messages:
"Warning, unable to evaluate the function to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct"

In the code of ribbonplot5,  x=-Pi..Pi which is the type of name=range shoud satisfy the pattern matching, as I wrote in the first part of the program as
ribbonplot5 := proc(Flist, r1::{range,name=range})

I cannot know why the part of the program:

" else
newFlist := map(unapply, Flist, lhs(r1));
opts := ['labels'=[lhs(r1), " "," "],
args[3 .. nargs]];
ribbonplot5(newFlist,rhs(r1),op(opts)):
"

wouldn't work well.

I wish I could get an answer to this.

This is a program in maple9 Advanced Programming Gude p. 253

graphic_ribbonplot.mw

```restart;
extend := proc(f)
local x, y;
unapply(f(x), x, y);
end proc:
p:=x->cos(2*x):
q:=extend(p);

ribbonplot5 := proc(Flist, r1::{range,name=range})
local i, m, p, n, opts,newFlist;
opts := [args[3 .. nargs]];
if type(r1, range) then
if not hasoption(opts, 'numpoints', 'n', 'opts')
then n := 25
end if;
m := nops(Flist);
p := seq(plot3d(extend(Flist[i]), r1, (i-1) .. i,
grid=[n, 2], op(opts)),
i = 1 .. m):
plots[display](p):
else
newFlist := map(unapply, Flist, lhs(r1));
opts := ['labels'=[lhs(r1), " "," "],
args[3 .. nargs]];
ribbonplot5(newFlist,rhs(r1),op(opts)):
end if:
end proc:
ribbonplot5([cos, sin, cos + sin], -Pi .. Pi,numpoints=20);
```

## Simplification with complex values...

I'd like to get the simplest possible expression when using simplify. The problem is that this is all done in a program, without having the benifit of looking at the expression on the screen and trying things. So I need a method that works for large set of input all the time.

I noticed in this example that simplify did not do what I think it should have.

Given the expression -2*(x^3 + 2)/(x*(x + 1)*(sqrt(3)*I + 2*x - 1)*(sqrt(3)*I - 2*x + 1)) it can be simplified to (x^3 + 2)/(2*x^4 + 2*x) but  I had to go into many tries in order to get this final result.

Is there a better way to do this? I end up now   doing simplify(expand(numer(expr))/expand(denom(expr))) in the hope to get better simplification.  Here is an example

 > interface(version);

 > restart;
 > w:=-2*(x^3+2)/x/(x+1)/(I*3^(1/2)+2*x-1)/(I*3^(1/2)-2*x+1);

 > simplify(w)

 > simplify(evalc(w))

 > simplify(w) assuming x::real

 > simplify(w,size)

 > simplify(w,symbolic)

 > simplify(w,sqrt)

 > simplify(expand(numer(w))/expand(denom(w)))

It would be nice if Maple simplify would just do it directly as follows in Mathematica. May be there is a an  option I am overlooking

## How can I get 2 and 3-fold symmetry axis for metha...

I drew a methane molecula and display three times because I wanted to get two-fold and three-fold symmetry axis. ,I would is that I would like to get a more exact output and doing it without clicking, it's say, using code. Can someone help me?tareaclase6.mw

University of Costa Rica

Course: SP-1493

Student: Lic. Marcus Vinicio Mora Salas

Instructor: Dr. Erick Castellón Elizondo

5

 Description In this assigment exercises e2.113,  e2.114, e2.115 and e2.117 was solved.
 ***e2.113