## Exporting maple plot into MATLAB...

Hi every one

I'm having some plots in maple, but the layout is not pretty enough, I want export in to MATLAB. Does some one please have an idea on how I can go about it?.

I'm using Maple 16

Thank you in anticipation

## finding a Recurrence relation and solve system of ...

Hi everyone.

I have a 2D function and I wanna after Differentiating from it with respect to tau (at any amount of sigma value) and equaling this derivative to zero solve the infinite system of equations.

P[n](tau)==LegendreP(n - 1/2, cosh(tau)) , Q[n](tau)==LegendreQ(n - 1/2, cosh(tau))

are Legendre function.

FUNCTION_f.mw

 >
 (1)
 >
 >
 (2)
 >

## Psi(rational) ...

During the computation of a series, I needed the value Psi(1/12)  of the digamma function at a rational point.

simplify, convert/elementary or other usual convertions do not help.

But Maple knows the formula for Psi(r) when r is rational:

 > FunctionAdvisor(special_values, Psi)[24][1]: convert(%,global);
 (1)
 > (simplify@value)(eval(%, [n=0, p=1, q=12]));
 (2)
 > evalf(%);
 (3)

The question is: why does not Maple use this formula when asked? Or, is there a convertion which I was missing?

## How do I correct the exact solution in this code?...

I have written the following attached code to use Euler explicit method to solve the following IVP

diff(y(x), x) = 2*(1+x)-y(x), y(2) = 5
With Exact solution  y(x) = 2*x+exp(-x)/exp(-2)


However, I found out that my exact results are not correct while the numerical results are okay. What have I done wrong in the code? Can someone modify the code?

Thank you and kind regards.

## Does Maple 2020 support parallelisation using the ...

I recently tried using Maple 2020 to run example code for the Grid package provided in Section 15.8 of the Maple Programming Guide. Unfortunately, none of the sample code appears to work as advertised.

Firstly, when I try to run the first sequential Mandelbrot example provided, I get the following error:

Error, (in Mandelbrot:-MandelLoop) break outside of loop

This was easily fixed by replacing the break statement in the while with a boolean value flag, while k < iter and flag do (see attached image). With this minor change to the example provided in the manual, I was able to get the code sequential code to run in 45.743 seconds on a quad core laptop. The modifications to the sample code are highlighted in red below.

 MandelLoop := proc( X, Y, imageArray, i_low, i_high, j_low, j_high, iter, bailout )
local flag, i, j, Xc, Yc, Xtemp, Ytemp, Xold, Yold, k, t;
option hfloat;

for i from i_low to i_high do
for j from j_low to j_high do
Xtemp := X[i];
Ytemp := Y[j];
Xc := Xtemp;
Yc := Ytemp;
k := 0;
flag := true:
while k < iter and flag do
Xold := Xtemp;
Yold := Ytemp;
Xtemp := Xold^2-Yold^2+Xc;
Ytemp := 2*Xold*Yold+Yc;
t := Xtemp^2+Ytemp^2;
if Xtemp^2+Ytemp^2 >= bailout then
imageArray[i, j, 1] := k - ln( ln( t ) )/ln(2.);
imageArray[i, j, 2] := imageArray[i, j, 1];
imageArray[i, j, 3] := imageArray[i, j, 1];
#break;
flag := false:
end if;
k := k+1;
end do
end do;
end do;
end proc:

The second, and seemingly more serious problem occurred when I tried to run the code in the last example that uses the Client/Server model to parallelise the Mandelbrot calculation. The code provided in the Programming Guide once again gives the break outside of loop error. However, after replacing the break statement in the Computeline procedure with a boolean flag as above, I found the code runs but does not enter either the Server procedure or the Computeline procedure that is actually supposed to do the work. This can be verified by including print statements in the Computeline or Server procedures. The parallelised code ran in less than one second, compared to 45 seconds for the sequential code. Unfortunately this was not due to a 45-fold speed up on my quad core laptop, but the fact that the code using the code parallelised using Grid Package did nothing whatsoever.

I have sent a number of e-mail requests to Maple Support asking them to explain these apparent errors and so far have received no response.

Any solutions to these problems from the Maple user community would be much appreciated.

Thanks.

John

## which sample points are correct and how to general...

P1 := x^2+y^2-4:
P2 := y^2-2*x+2:

Original question is find CAD of (some y)[P1 <0 and P2 <0]

how to use maple 12 and maple 2015 to find Q1,Q2,Q3 which are projection of P1 and P2

my book show sample points are [-4,-1-sqrt(7),-3,-2,0,1,3/2,-1+sqrt(7),9/5,2,3]
but FindSamples result is not the same with my book, is it my book wrong or FindSamples function wrong?
I find result of my script is the same as book's quantifier position at 7,8,9 though sample points has little different

how to generalize my following script to multiple variables x, y, z, and more ?

and

I compare with maple 2015 result are different from my book solution, is maple 2015 more advanced version CAD?

with(ListTools):

P1 := x^2+y^2-4:
P2 := y^2-2*x+2:

Q1 := x^2 + 2*x - 6;
Q2 := x^2 - 4;
Q3 := x - 1;

sourcesamples := sort(evalf([solve(Q1), solve(Q2), solve(Q3)]),<);

FindSamples:=proc(sourcesamples)
local N, P;
N:=nops(sourcesamples);
P:=proc(a,b)
local a1, b1, m1, n, m;
if a=b then error "Should be a<>b" fi;
a1,b1:=op(convert(sort([a,b],(x,y)->evalf(x)<evalf(y)),rational));
count := 0:
for n from 1 do
m1:=a1*n;
m:=if(type(m1,integer),m1+1,ceil(m1));
count := count + 1:
if is(m/n>a1) and is(m/n<b1) then return m/n fi;
od;
print("count=",count);
end proc:
[ceil(sourcesamples[1])-1, seq(op([sourcesamples[i],P(sourcesamples[i],sourcesamples[i+1])]), i=1..N-1),sourcesamples[N],floor(sourcesamples[N])+1];
end proc:

RemoveComplex := proc(yy)
local result, k:
result := []:
for k in yy do
if Im(k) = 0 then
result := [op(result), k]:
end if:
od:
if result = [] then
result := []:
end if:
return result:
end proc:

Joinsolution := proc(param1, param2group)
local result, k:
result := []:
for k in param2group do
result := [op(result), [param1, k]]:
od:
return result:
end proc:

#print(mm):
if MakeUnique(RemoveComplex([solve(subs(x=mm, P1)), solve(subs(x=mm, P2))])) = [] then
else
CADresult1 := [op(CADresult1), op(Joinsolution(mm,FindSamples(sort(evalf(MakeUnique(RemoveComplex([solve(subs(x=mm, P1)), solve(subs(x=mm, P2))]))),<))))];
end if:
od:

if subs(x=mm[1],subs(y=mm[2], P1)) < 0 and subs(x=mm[1],subs(y=mm[2], P2)) < 0 then
end if:
od:

Compare with

with(RegularChains):
with(ChainTools):
with(MatrixTools):
with(ConstructibleSetTools):
with(ParametricSystemTools):
with(SemiAlgebraicSetTools):
with(FastArithmeticTools):
R := PolynomialRing([x,y]):
sys := [x^2+y^2-4,y^2-2*x+2]:
N := []:
P := []:
H := [x]:
dec := RealTriangularize(sys,N,P,H,R):
proj := Projection(sys, N, P, H, 1, R);
Display(dec, R);

P := SamplePoints(sys, R);
Display(P, R);

## how to prevent Maple from doing pole/zero cancella...

The following transfer function has zero/pole cancelation. I am trying to create a transfer function object, but Maple automatically simplifies the transfer function before it gets to the DynamicSystem call, which result in different output than what I expected.

I do set the cancellation=false option, even though this is the default. The problem is Maple does pole/zero cancelation before the call.

I tried to add '' around it to delay evaluation, but it did not work.

restart;
alias(DS=DynamicSystems):
DS:-SystemOptions(cancellation=false,complexfreqvar=s):
tf:=DS:-TransferFunction('-(s - 1)/((-2 + s)*(s - 1))'):
DS:-PrintSystem(tf)


You can see it did pole/zero cancelation.

In Matlab and Mathematica, this does not happen. For example

Clear["Global*"];
sys = TransferFunctionModel[-(s - 1)/((-2 + s) (s - 1)), s]

Same with Matlab:

>> s=tf('s');
>> sys_tf =-(s - 1)/((-2 + s)*(s - 1))

sys_tf =

-s + 1
-------------
s^2 - 3 s + 2

Continuous-time transfer function.


What do I need to do in Maple to keep the transfer function without pole/zero cancelation (this affects the state space realization later on when this cancelation happens)

I am using Maple 2019 at this moment as Maple 2020 is busy.

## small issue in Physics:-Latex, translation of comp...

As I was going over latest build using Physics:-Latex I noticed this.

The complex number I should be translated to lower case in latex.

This is what the original latex() does (and also what Mathematica TeXForm does).

It does not look good at all to have complex number I be translated to I and remain UPPER case I

Here is an example

expr:=[solve(x^2+2*x+2=0,x)];
Physics:-Latex(expr)

gives

[-1+I, -1-I]

While  latex(expr) gives the much better and more mathematical output:

[-1+i,-1-i]

 > interface(version);

 > Physics:-Version();

 > expr:=[solve(x^2+2*x+2=0,x)]; Physics:-Latex(expr)

[-1+I, -1-I]

 > latex(expr)

[-1+i,-1-i]

 >

Is it possible to have Physics:-Latex translate complex numbers like latex() did?

## On using textit in Latex generated by Physics...

I'd like to suggest Physics:-Latex change its use of \textit{} and replace it with \mathit{}

\mathit is the better Latex command to use, since the Latex generated goes into math mode and \mathit is designed to be used in math mode and hence has a better spacing for this. Making the final Latex look a little better.

Here is an example showing the difference.

restart;
ode:=diff(y(x),x) = y(x)/(x^2+1);
sol:=dsolve(ode);
Physics:-Latex(sol)

Gives

y \left(x \right) = \textit{\_C1} {\rm e}^{\arctan \left(x \right)}

It will be better to generate

y \left(x \right) = \mathit{\_C1} {\rm e}^{\arctan \left(x \right)}

Here is the difference when both are compiled using latest texlive

Since all the Latex generated is meant to be used in math mode, \mathit would be better choice. It is considered wrong to use \textit in math mode actually, even though it does compile.

Here is the latex file used to generate the above pdf

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{maplestd2e}

\begin{document}

$y \left(x \right) = \textit{\_C1} {\rm e}^{\arctan \left(x \right)}$

$y \left(x \right) = \mathit{\_C1} {\rm e}^{\arctan \left(x \right)}$

\end{document}

 > interface(version);

 > Physics:-Version();

 > ode:=diff(y(x),x) = y(x)/(x^2+1); sol:=dsolve(ode); Physics:-Latex(sol)

y \left(x \right) = \textit{\_C1} {\rm e}^{\arctan \left(x \right)}

 >

thank you

## why "plotsetup" parameter plotoutput= dose't work...

I use WINDOW 10

for j from 1 to 3 do
pout := cat("C:/Users/Eli/Documents/Animation/", "file", j, ".bmp"):
print(pout):
plotsetup(bmp, plotoutput = pout):
# plot (...)
od:

## sqrt(x^2) = +x or -x ?...

Hi, I have a problem related to the cancellation of the square root with a square in its argument, see the image below.

Santiago

## how do i solve this type of differential equation ...

i have a task who is like this:

let

and the function f meets the following criteria

and f '(-1)=2

what is h'(-1)

how to i solve this, i am thinking of ordinary differential equations (ODEs)

and dsolve funktion in maple. but how do i do this.

or is there another way to solve it

## plot discrete point...

Hello , I need to plot the following on the same axes of implicit plot where discrete wavenumbers k1, k2, k3 on the same set of axes (the wavenumbers are points [k1,0], [k2,0], [k3,0], ...) , where k_{n}=2*n*Pi/L and the domain [0,L]

restart;
with(plots, implicitplot);
alpha := 0.1;
beta := 0.1;
mu := 0.5;
u := 0.5;
v := 1;
gamma = 0.1;
alpha := 0.1

beta := 0.1

mu := 0.5

u := 0.5

v := 1

gamma = 0.1

Eq := -2*sigma*alpha*beta*mu*u - sigma*alpha*beta^2*u*v - 2.0*mu*alpha*beta^2*u*v - gamma^2*k^2*alpha*beta*u + beta*sigma^2*v + sigma^3 + 2*mu*sigma^2 - alpha*beta*sigma^2*u + sigma*beta^2*u*v + gamma^2*k^2*sigma + 2.0*mu*beta*sigma*v + 2.0*mu*beta^2*u*v;
2  2              2
Eq := 0.0995 sigma + 0.004500 - 0.005 gamma  k  + 1.095 sigma

3        2  2
+ sigma  + gamma  k  sigma

implicitplot(Eq, k = 0 .. 10, sigma = -0.1 .. 0.1);

## How can i differentiate with dotted lines on my gr...

Please can someone help me out, have been trying for a very long time now on how to differentiate the lines on the graph.......please find attachment below and correct..................................................................

restart;
with(plots):
#
# Define the ODE system
#
odeSys:= { (diff(F(eta), eta, eta, eta))*(1+epsilon-alpha((diff(F(eta), eta, eta))^2))+F(eta)*(diff(F(eta), eta, eta))+S*(diff(F(eta), eta))-(1/2)*S*eta*(diff(F(eta), eta, eta))-(diff(F(eta), eta))^2-M*(diff(F(eta), eta)), (diff(theta(eta), eta, eta))*(1+R)-delta*(diff(F(eta), eta))^2-Pr((3/2)*S*theta(eta)+(1/2)*S*eta*(diff(theta(eta), eta))-2*(diff(F(eta), eta))*theta(eta)+F*(diff(theta(eta), eta)))};
#
# Define the first set of boundary conditions
#
bcs1:= { F(0) = 0, (D(F))(0) = 1, (D(F))(inf) = 0, theta(0) = 1, theta(inf) = 0
}:

RVals:=[0.1, 0.5, 1]:
for k from 1 by 1 to numelems(RVals) do
pList:=[ epsilon = 0.18, M = 0.5, S = 1.5, delta = 0.3, Pr = 1.5, alpha = 0.4, R = RVals[k],inf=1
]:
sol1[k]:= dsolve( eval
( union`( odeSys, bcs1),
pList
),
numeric
);
od:
display
( [ seq
( odeplot
( sol1[i],
[eta, theta(eta)],
eta=0..2
),
i=1..numelems(RVals)
)
],
color = [red, green, blue],
title = typeset( theta(eta), " versus ", eta),
titlefont = [times, bold, 20]
);

 First 10 11 12 13 14 15 16 Last Page 12 of 1731
﻿