Maple 2018 Questions and Posts

These are Posts and Questions associated with the product, Maple 2018

Hello,

      I've noticed a strange phenomenon involving simplify: given the exact same input, its output varies between two different results depending on memory usage patterns.

      I've attached a sample code. There, I have an equation which should simplify to 0=0. If I run the code with garbage collection gc uncommented, it will correctly give 0=0. However, with gc commented out, it gives the unsimplified result result ~80% of the time (with 0=0 the remaining 20%):

1/2*A1*k*epsilon*p*(-I*exp(I*psi__p)*(2-2*cos(2*psi__p))^(1/2)+exp(2*I*psi__p)-1)*exp(-I*psi__p-1/2*2^(1/2)*k^(1/2)*(-k*p*cos(psi__p)+(k^2*p^2+2*k*p*
cos(psi__p)+1)^(1/2)-1)^(1/2)*t)*(-exp(-I*k*x-1/2*I*2^(1/2)*k^(1/2)*(k*p*cos(psi__p)+(k^2*p^2+2*k*p*cos(psi__p)+1)^(1/2)+1)^(1/2)*t)+exp(I*k*x+1/2*I*
2^(1/2)*k^(1/2)*(k*p*cos(psi__p)+(k^2*p^2+2*k*p*cos(psi__p)+1)^(1/2)+1)^(1/2)*t)) = 0

For my particular machine, it seems that when the memory usage is <98.4MB, it gives 0=0, and the unsimplied case otherwise.

      Any idea why this is? It seems odd that simplify would return different results depending on garbage collection, especially since use of gc is now discouraged.

example.txt

A few notes:

  • It seems replacing gc with a simple call to kernelopts(memusage) also produces the correct output
  • This is a snippet of a larger body of code I wrote: there, even without gc, it will sporadically (with the exact same input) produce the correct answer ~50% of the time
  • Only the last 4 lines are relevant; the beginning of the attached code is simply to generate appropriate memory usage and doesn't affect the relevant, final 4 lines

 

Hi all.

Is there a kind soul who can enligthen me on the where abouts of the "print preview" feature in maple 2018?

It does not appear under the "file" -> "print" nor under "file" -> "page setup"

Macbook pro 2018

How do I create a timing diagram simular to

Image result for timing diagram

I do the following:-

1. 

2. TTdf := TruthTable(logic, form = MOD2)

I have tried the statistics package and the timing package. The problem is I get something like

Convert to matrix and add first column to indicate time, e.g 

Where we get an angle rise instead of a vertical rise.

I have also tried it in statistics. The best graph I can get is 

Also tried with no fill and with boarder around the columns, but still cannot get it to look right.

Help much appreciated. Really the Timing Graph should really be available in the Logic Package

Really I want to be able to split the Dataframe into seperate line graphs with a vertical rise and not a angle rise.

Any help would be much appreciated.

P.S I am still learning Maple. I have Maple 2018

Hello

The problem is translate Mathematica code to Maple to find  numerical solution using int(numeric).

I have a more complicated example and here I gives a very simplified version.

I use  successive approximations to solve integral-equation with symbolic int it's easy to do,but with numeric int  I'm failed

MMA code:

func[x_, 0] := x
ifunc[0][x_] := x
func[x_?NumericQ, n_Integer] := x + NIntegrate[(x - y)*ifunc[n - 1][y], {y, 0, x}]
ifunc[j_Integer] := ifunc[j] = Interpolation[Table[{x, func[x, j]}, {x, -3, 3, 0.2}]]

Plot[{Sinh[x], ifunc[n][x] /. n -> 4}, {x, -3, 3}]


My first attempt to translate:

ifunc := proc (n, x) options operator, arrow; x end proc;

ifunc(0, x) := x;

func(x, 0) := x;

func := proc (x, n) x+int((x-t)*ifunc(n-1, t), t = 0 .. x, numeric) end proc;

T := proc (j) option remember;

Interpolation:-Interpolate([seq(x, x = -2 .. 2, .1)], [seq(func(x, j), x = -2 .. 2, .1)], method = cubic)

end proc;

plot([sinh(x), (T(4))(x)], x = -2 .. 2);

See attached file for more info.

Thanks.

test_numeric_volterra.mw

EDITED :----------------------------------------------------------

Third attempt:

func(x, 0) := x;

(ifunc(0))(x) := x:

func := proc (x, n) option remember; x+int((x-t)*(ifunc(n-1))(t), t = 0 .. x, numeric) end proc;

ifunc := proc (j) local f; option remember;

ifunc(0) := proc (t) options operator, arrow; t end proc;

f := proc (t) options operator, arrow;

CurveFitting:-Spline([seq(x, x = -3 .. 3, .1)], [seq(func(x, j), x = -3 .. 3, .1)], x, degree = 1) end proc end proc;

n := 4; plot([sinh(x), (ifunc(n))(x)], x = -3 .. 3)# for n=4 diverge !!!

when using slideshow tool (F11), it just show the first page and arrows for going to other pages does not work. is it a bug?

I'm working with some sum values, but for some reason that I can't figure out, this sum always returns 1.
Have I made some mistake in the way it's supposed to be typed in or why does it return 1? Below the sum I've filled out the spots manually to show how I want them to be.


 

``

x := 2; y := 2; sum(binomial(y, i)*(1/3)^i*(2/3)^(y-i)*(sum(binomial(x, j)*(1/3)^j*(2/3)^(x-j), j = i+1 .. x)), i = 0 .. y)

1

(1)

binomial(y, 0)*(1/3)^0*(2/3)^(y+0)*(sum(binomial(x, j)*(1/3)^j*(2/3)^(x-j), j = 1 .. x))+(1/3)*binomial(y, 1)*(2/3)^(y-1)*(sum(binomial(x, j)*(1/3)^j*(2/3)^(x-j), j = 2 .. x))+binomial(y, 2)*(1/3)^2*(2/3)^(y-2)*(sum(binomial(x, j)*(1/3)^j*(2/3)^(x-j), j = 3 .. x))

8/27

(2)

``


 

Download Sum_fejl.mw

The issue concerns calculation of 2nd derivative of the numerical solution of 2nd order BVP for an ordinal DE.

Lets consider a test problem:

-y’’(t)+y(t)=t*sin(5*t)

y(0)=0.2, y(1)=1

 Numerical solution was obtained by

dsolve([-diff(F(x), x$2)+F(x)= x*sin(5*x), F(0)=0.2, F(1)=1], [F(x)], type = numeric, 'output' = Array([seq(k/5, k=0..5)]));

 

dsolve returns the values of the solution and its 1st derivative (for the test example, a solution can be obtained analytically, but for general case I require numerical solution)..

It is needed to calculate the 2nd derivative of the solution.

I tried to use the Bessel method, when the solution’s 2nd derivative is calculated as the 2nd derivative of 5th degree polynomial having in consequent points t1, t2, t3 the values y(t1), y(t2), y(t3) and 1st derivatives y’(t1), y’(t2), y’(t3), all obtained from the numerical solution. Later I use Hermit piecewise-polynomial interpolation, based on values of the solution and its 1st and 2nd derivatives (polynomial of 5th degree).

Unfortunately, 2nd derivative of such interpolation has a large non-smoothness.

Here, we see the solution. It is smooth.

Here, 1st derivative. Still smooth enough.

Here, 2nd derivative. Typical view with large and sharp teeth.

 

 

Maybe, there exists a simple method for calculation of more smooth 2nd derivative?

Also. it is desirable that it would be embedded in Maple.

How I can solve these time delay  differential equations?

please see attatched files.

Best

Doc191.pdf

ny.mw

 


 

restart; d[1] := 1; d[2] := 4; d[3] := 1; r[1] := 1; r[2] := 1; r[3] := 1; r[4] := .5; a[11] := .5; a[12] := 3; a[21] := 2; a[22] := .8; a[23] := 1; a[32] := .5; a[33] := .9; tau := .3

diff(u(t, x), t) = d[1]*(diff(u(t, x), x, x))+u(t, x)*{r[1]-a[11]*u(t, x)-a[12]*v(t, x)}

diff(u(t, x), t) = diff(diff(u(t, x), x), x)+u(t, x)*{1-.5*u(t, x)-3*v(t, x)}

(1)

diff(v(t, x), t) = d[2]*(diff(v(t, x), x, x))+v(t, x)*{r[2]+a[21]*u(t-tau, x)-a[22]*v(t, x)-a[23]*w(t-tau, x)}

diff(v(t, x), t) = 4*(diff(diff(v(t, x), x), x))+v(t, x)*{1+2*u(t-.3, x)-.8*v(t, x)-w(t-.3, x)}

(2)

diff(w(t, x), t) = d[3]*(diff(w(t, x), x, x))+w(t, x)*{r[3]+a[32]*v(t, x)-a[33]*w(t, x)}

diff(w(t, x), t) = diff(diff(w(t, x), x), x)+w(t, x)*{1+.5*v(t, x)-.9*w(t, x)}

(3)

0 < x and x < Pi, t > 0

0 < x and x < Pi, 0 < t

(4)

diff(u(t, x), x) = 0, diff(v(t, x), x) = 0, diff(w(t, x), x) = 0, x = 0, x = Pi, t >= 0

diff(u(t, x), x) = 0, diff(v(t, x), x) = 0, diff(w(t, x), x) = 0, x = 0, x = Pi, 0 <= t

(5)

u(t, x) > 0, v(t, x) > 0, w(t, x) > 0, `in`(t, x, `&x`([-tau, 0], [0, Pi]))

0 < u(t, x), 0 < v(t, x), 0 < w(t, x), `in`(t, x, [-.3, 0]*[0, Pi])

(6)

``

``


 

Download ny.mw

Hi guys and girls, 

 

The new Maple 2018 have a feature in the buttom called editable. If you remove that mark in the buttom of the screen, then maple doc can't be edited. I teach students who have english as a second language and some remove the mark in the editable box by mistake. Such that they can't do there hand-ins etc. 

 

So is there anyway to disable the editable box in the buttom of the screen? 

 

thanks in advance.

Fred

For some unknown reason, the code below does not work in Maple 2018.1, but works in Maple 2015 and Maple 2017 (the idea is taken from here

restart; 
with(plottools): with(plots):
V1,V2,V3,V4,V5,V6,V7,V8:=[0,-1,0],[0,0,0],[1,0,0],[1,-1,0],[0,-1,1],[0,0,1],[1,0,1],[1,-1,1]:  # The vertices of the cube
Faces:=[[V1,V4,V8,V5],[V5,V6,V7,V8],[V2,V3,V7,V6],[V1,V2,V3,V4],[V3,V4,V8,V7],[V1,V2,V6,V5]]: # The list of the faces
Colors:=[green, red,RGB(1, 0, 4),blue,grey,gold]: # The list of the colors
Cube[0]:=display([seq(polygon(Faces[i],color=Colors[i]),i=1..6)]):

for n from 1 to 7 do
F[n]:=t->rotate(Cube[n-1],t, [[0,n-1,0],[1,n-1,0]]):
Cube[n]:=rotate(Cube[n-1],-Pi/2, [[0,n-1,0],[1,n-1,0]]):
A[n]:=animate(display,[F[n](t)], t=0..-Pi/2,paraminfo=false);
od:

for m from 6 to 0 by -1 do
G[m]:=t->rotate(Cube[m+1],t, [[0,m,0],[1,m,0]]):
B[m]:=animate(display,[G[m](t)], t=0..Pi/2,paraminfo=false);
od:

C1:=display([seq(A[k], k=1..7)], insequence):
C2:=display([seq(B[k], k=6..0, -1)], insequence):
display([C1,C2], insequence, scaling=constrained, axes=normal);

 

I currently have a procedure that runs a fairly complicated formula involving non-commutative variables. The procedure is Vu(a, b, c) where a, b, and c are any integers. I have to run this formula whenever vacub appears in my expression. I'm currently replacing each variable of this type with the procedure Vu(a, b, c). I'm wanted to automate that process if possible. One thought I had was to assign the value of Vu(a, b, c) to the variable vacub for any value of a, b, and c from 1 to 5. Then use the eval command to replace the variables with the proper values. Is there any way to automate this process? Let me give you an example:

v0u0 = u0v0 + 2w0

So u0v0u0 = u0(u0v0+2w0) = u02v0+2u0w0

I have a procedure to truncate algebraic equations. Found the basic answer hrere. I would like to make it handle equations and functions i.e f:=a x^2 +b y... and f(x,y):=c x y^2.... I can make it handle the first type but not the second.

restart

``

NULL

NULL

Trunc := proc (eq, odr := 2, v::list := [x, y, z]) local a, b, q; description " Truncates an algebraic equation to required degree"; a := eq; b := v; map(select, proc (q) options operator, arrow; evalb(degree(q, b) <= odr) end proc, a) end proc

proc (eq, odr := 2, v::list := [x, y, z]) local a, b, q; description " Truncates an algebraic equation to required degree"; a := eq; b := v; map(select, proc (q) options operator, arrow; evalb(degree(q, b) <= odr) end proc, a) end proc

(1)

"E1(x,y,z):=2+3 x-y+5 x^(2)y+4 x y+x y^(3)+3 a^(2)+z+z^(2)"

proc (x, y, z) options operator, arrow, function_assign; 2+3*x-y+5*x^2*y+4*y*x+x*y^3+3*a^2+z+z^2 end proc

(2)

Trunc(E1, 2, [x, y, z])

E1

(3)

``

E2 := E1(x, y, z)

x*y^3+5*x^2*y+3*a^2+4*x*y+z^2+3*x-y+z+2

(4)

Trunc(E2, 1, [x, y])

3*a^2+z^2+3*x-y+z+2

(5)

Trunc(E2, 1, [x, y, z])

3*a^2+3*x-y+z+2

(6)

``whattype(E1(x, y, z))

`+`

(7)

whattype(E2)

`+`

(8)

``


 

Download Truncate.mw

Could anyone tell me why Maple changes the sign of some expressions? For example...

I would like the outputs to be that way.

sqrt(r/(r-b))

How to prevent this changes?

Thanks in advance,

 

Denis

Hello

I want to compute integral with Maple,but returns unevaluated for me.

int((-5*ln(x)^4*Pi^4-20*ln(x)^2*Pi^4-8*Pi^4+120*MeijerG([[0, 0], [1, 1, 1]], [[0, 0, 0, 0, 0], []], x^Pi))/(120*Pi^4*(-1+x)^2), x = 4/10 .. 6/10, numeric);

# ???

Thanks.

First 29 30 31 32 33 34 35 Last Page 31 of 45