Maple 2015 Questions and Posts

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

I want to apply rk-2 for the following system of odes. I want to know what is process of rk-2 method maple used? Is it possible that we can see the complete process maple used?

Download Question.mw

 

Hello Sir
Hope you are fine. I am facing issues in integration evaluations. I have attched code and pic as well. Kindly guide me. I am waiting for your kind response.
Thanks

question.mw

restart; printlevel := 4; kernelopts(version)

{--> enter Terminate, args =

<-- exit Terminate (now at top level) = }
{--> enter ModuleUnload, args =
<-- exit ModuleUnload (now at top level) = }
{--> enter OnUnload, args =
<-- exit OnUnload (now at top level) = }

 

`Maple 2015.0, X86 64 WINDOWS, Feb 17 2015, Build ID 1022128`

(1)

with(LinearAlgebra):

L[time] := 1:

ff11 := cos(1.0*k*(p+q+x+t)):

NULL

JJx11 := QQ*(int(int(p*ff11/`&gamma;&gamma;Exact`, p), q))/m;

175631174533.479692645444566411*(int(int(0.273299999999999999999999999999e-21*p*cos(.50*p+.50*q+.50*x+.50*t)/(p^2+q^2+0.746928900000000000000000000000e-43)^(1/2), p), q))

(2)

evalf(IntegrationTools:-Expand(%));

Warning,  computation interrupted

 

``

``

int(int(p*ff11/`&gamma;&gamma;Exact`, p = 0 .. 1), q = 0 .. 1); evalf(IntegrationTools:-Expand(%))

int(int(0.273299999999999999999999999999e-21*p*cos(.50*p+.50*q+.50*x+.50*t)/(p^2+q^2+0.746928900000000000000000000000e-43)^(1/2), p = 0 .. 1), q = 0 .. 1)

 

0.273299999999999999999999999999e-21*(Int(Int(p*cos(.50*p)*cos(.50*q)*cos(.50*x)*cos(.50*t)/(p^2+q^2+0.746928900000000000000000000000e-43)^(1/2)-1.*p*cos(.50*p)*cos(.50*q)*sin(.50*x)*sin(.50*t)/(p^2+q^2+0.746928900000000000000000000000e-43)^(1/2)-1.*p*cos(.50*p)*sin(.50*q)*sin(.50*x)*cos(.50*t)/(p^2+q^2+0.746928900000000000000000000000e-43)^(1/2)-1.*p*cos(.50*p)*sin(.50*q)*cos(.50*x)*sin(.50*t)/(p^2+q^2+0.746928900000000000000000000000e-43)^(1/2)-1.*p*sin(.50*p)*sin(.50*q)*cos(.50*x)*cos(.50*t)/(p^2+q^2+0.746928900000000000000000000000e-43)^(1/2)+p*sin(.50*p)*sin(.50*q)*sin(.50*x)*sin(.50*t)/(p^2+q^2+0.746928900000000000000000000000e-43)^(1/2)-1.*p*sin(.50*p)*cos(.50*q)*sin(.50*x)*cos(.50*t)/(p^2+q^2+0.746928900000000000000000000000e-43)^(1/2)-1.*p*sin(.50*p)*cos(.50*q)*cos(.50*x)*sin(.50*t)/(p^2+q^2+0.746928900000000000000000000000e-43)^(1/2), p = 0. .. 1.), q = 0. .. 1.))

(3)

``

Download question.mw

Maple (2015) fails to instanciate a Matrix with a list of elements of type string
(for instance Matrix(2, 2, ["A", "B", "C", "D"]) )

Matrix(2$2, [1$4]):    # ok
Matrix(2$2, [A$4]):    # ok

Matrix(2$2, ["A"$4]);  # not correctly understood by Maple (2015) 
Error, (in Matrix) initializer defines more columns (4) than column dimension parameter specifies (2)

Is this a bug?
Maybe something corrected in earlier versions?

I solve numerically a DAE system whose independent variable is named t and the dependent variables are d[1](t), ..., d[n](t).
I would like to to 2D or 3D plots of the solutions and color the resulting curve using a function f(...) of the remaining dependent variables.

Here is a simple example.

restart

with(plots):

0

(1)

sys := {
   diff(x(t), t) = v(t)
  ,diff(v(t), t) = cos(t)
  ,x(0) = -1
  ,v(0) = 0

  ,px(t) = piecewise(x(t) >=0, 1, -1)
  ,pv(t) = piecewise(v(t) >=0, 1, -1)
}:

sol := dsolve(sys, numeric):

 

odeplot(sol, [t, x(t), v(t)], t=0..4*Pi)
 

 

# I would like to color this space curve depending on the signs of x(t) and y(t)
#
# for instance, f being a "color function"
f := proc(s)
  local a, b:
  if s::numeric then
    a := round(eval(px(t), sol(s))):
    b := round(eval(pv(t), sol(s))):
    return piecewise(a+b = 2, "Green", a = 1, "Red", b = 1, "Blue", "Gold")
  end if:
end proc:

SOL := proc(s)
  if s::numeric then
    eval([t, x(t), v(t)], sol(s))
  end if:
end proc:


# I would like to make something like this to work

plot3d(SOL(s), s=0..4*Pi, colorfunc=f(s)):  #... which generates a void plot


 

# In some sense a continuous version of this

opts := symbol=solidbox, symbolsize=20:
display( seq(pointplot3d({SOL(s)}, opts, color=f(s)), s in [seq](0..6, 0.1)) );

 

 

Download coloring.mw

How can I fix (if possible) the syntax in the command 

plot3d(SOL(s), s=0..4*Pi, colorfunc=f(s)):

???

Thanks in advance

Hello;

I am facing "Error, too many levels of recursion" in loops. kindly guide me. Thanks

 

1D1P.mw


 

restart; printlevel := 3

restart; with(LinearAlgebra); with(linalg); with(CodeGeneration); with(plots); Digits := 30; `&epsilon;` := 0.1e-1; k := .5; m := 1; c := 1; q := 1

L[time] := 1:

.200000000000000000000000000000

 

.200000000000000000000000000000

 

.200000000000000000000000000000

(1)

``

ICff := 1.0*exp(-p^2/(2.0))*(1.0+epsilon*cos(1.0*k*x))/sqrt(2.0*Pi):

for i from 0 while i <= N[x] do for j from 0 while j <= N[p] do f[0, i, j] := eval(ICff, [x = i*`&Delta;x`, p = j*`&Delta;p`]) end do end do:

for n from 0 while n <= T do for j from 0 while j <= N[p] do f[n, 0, j] := 0; f[n, N[x], j] := 0 end do end do:

for n from 0 while n <= T do for i from 0 while i <= N[x] do f[n, i, 0] := 0; f[n, i, N[p]] := 0 end do end do:

``

for n1 from 0 while n1 <= T-1 do for i1 while i1 <= N[x] do for j1 while j1 <= N[p] do f[n1+1, i1, j1] := f[n1, i1, j1]-`&Delta;t`*j1*`&Delta;p`*(f[n1+1, i1+1, j1]-f[n1+1, i1-1, j1]+f[n1, i1+1, j1]-f[n1, i1-1, j1])/((4*`&Delta;x`)*(1.0)) end do end do end do

Error, too many levels of recursion

 


 

(Maple 2015)

Why is m1(t) not evaluated correctly when I use a compound condition?

restart:
m2(t) = piecewise(x1(t) < c and v1(t) < 0, 1,  0);
       m2(t) = piecewise(x1(t) < e2 and v1(t) < 0, 1, 0)

m1(t) = piecewise(x1(t) = c and v1(t) > 0, 0,  1);
                           m1(t) = 1

This doesn't happen for simple conditions
 

m2(t) = piecewise(x1(t) < c, 1,  0);
m1(t) = piecewise(x1(t) = c, 0,  1);
               m2(t) = piecewise(x1(t) < c, 1, 0)
               m1(t) = piecewise(x1(t) = c, 0, 1)

TIA

Dear Users!

Hope everyone is fine here. Let me explain my problem first for this consider
diff(Y(xi), xi) = mu*(1-Y(xi)^2)
Then the derivative of a function U=u(Y(xi)) using chain rule (and expression menstiones as red) is given as,
diff(U, xi) = (diff(diff(Y, xi), Y))*U and (diff(diff(Y, xi), Y))*U = mu*(1-Y(xi)^2)*(diff(U, Y))
Similarly the second-order derivaitve of U=u(Y(xi)) using chain rule (and expression menstiones as red) is given as,
((&DifferentialD;)^(2))/(&DifferentialD; xi^(2))U=(&DifferentialD;)/(&DifferentialD; xi)(mu (1-Y^(2)(xi))*(&DifferentialD;)/(&DifferentialD; Y)U)=((&DifferentialD;)/(&DifferentialD; Y)*(&DifferentialD;)/(&DifferentialD; xi)Y)(mu (1-Y^(2)(xi))*(&DifferentialD;)/(&DifferentialD; Y)U)=(&DifferentialD;)/(&DifferentialD; Y)(mu^(2) (1-Y^(2)(xi))^(2)*(&DifferentialD;)/(&DifferentialD; Y)U)=-2 Y(xi) mu^(2) (1-Y^(2)(xi))*(&DifferentialD;)/(&DifferentialD; Y)U+ mu^(2) (1-Y^(2)(xi))^(2)*((&DifferentialD;)^(2))/(&DifferentialD; Y^(2))U;
In the similar way I want to compute the higher-order (like 5th order) derivaitve of U w.r.t. xi using the chain rule  (and expression menstiones as red) explained in above. Kindly help me soolve my problem

I am waiting for positive response.

Dear Users!

Hope you are doing well. I have a funtion give bellow:
beta[1]*exp(x*alpha[1]+y*beta[1]-z*sqrt(-alpha[1]^2-beta[1]^2))/(1+exp(x*alpha[1]+y*beta[1]-z*sqrt(-alpha[1]^2-beta[1]^2)));
For any value of alpha[1] and beta[1] the term highlighted red becomes the imaginary form. I want to separate the real and imaginary parts of this function. Kindly help me in this matter, thanks

I want to compute the series expansion of i3_r wrt (x, y, z) at point (x=y=z=0):

i2   := (x,y) -> -(1/2)*I*(exp(I*x)*(sin(x)/x)-exp(I*y)*(sin(y)/y))/(x-y):
i3_r := -(1/2)*I*(i2(y,z)-i2(y,x))/(z-x);

My first attempt was to compute this mulltiple series expansion this way:

ordre := 3:
sx := convert( series(i3_r, x, ordre), polynom);
sy := convert( series(sx  , y, ordre), polynom);
sz := convert( series(sy  , z, ordre), polynom);

But this gives me sy=sz=0 whatever the expansion order.

I then do this:

sx :=              convert(series(i3_r , x, ordre), polynom):
sy := add(map(u -> convert(series(u    , y, ordre), polynom), [op(expand(sx))])):
sz := add(map(u -> convert(series(u    , z, ordre), polynom), [op(expand(sy))]));

and obtained non zero results for both sy and sz (but are they are correct ?).

Could you explain me what happens and tell me how to find the series expansion of i3_r wrt (x, y, z) ?

TIA

I am trying to adapt the code with Direct Search 2 for my needs but do not quite understand the syntaxis :( . I have system with 8 first order but nonlinear odes and 20 parameters but for starters I fix most of them (to estimate time consumption for full calculations etc). The part of the code where it ``breaks'' looks as follows:

#argument
X0:=Vector([24, 36, 48, 60, 72, 84], datatype = float):
#value
Y0:=Vector([13.8e+9, 12.13333333e+9, 10.7e+9, 10.5e+9, 9.8e+9, 10.1e+9], datatype = float):

#so this is the data - time in X0 and corresponding observables (at that time instances) at Y0


par_sol:=dsolve(dsys, numeric, range=0..85,  parameters=[eta_L, L0]);

#parametric numerical solution with eta_L parameter of the model and L0 initial condition to fit

ffit2 := proc(etaLValue, L0Value, tValue) global old_eta, old_L0; local res;
if not [etaLValue, L0Value,tValue]::list(numeric) then
      return 'procname'(args); end if;
if old_eta<>etaLValue and old_L0<>L0Value then
      (old_eta,old_L0) := etaLValue,L0Value;
      par_sol('parameters'=[eta_L=etaLValue,L0=L0Value]);
   end if;
   res:=rhs(par_sol(tValue)[4]); end proc;


# this is just adapted copy of your function

 

par_sol(parameters=[eta_L=0.004, L0=1.1e10]);

par_sol(84)[4];ffit2(0.004, 1.1e10, 84);

#their output coincide OK; same for another trio of parameters

DS2:=CodeTools:-Usage(
        DirectSearch:-DataFit(ffit2,X0,Y0,t,
                              [ eta_L=0.001 .. 0.1, L0=1.5e10 .. 1.7e10
 #                               
                              ] )
);

#and here it breaks:

Warning, initial point [L0Value = .9, tValue = .9] does not satisfy the inequality constraints; trying to find a feasible initial point
Error, (in DirectSearch:-Search) cannot find feasible initial point; specify a new one


But tValue is a time variable - I integrate over it, it is not a parameter to fit - I evaluate ffit2 at it. So basically ffit2 return exactly the model value which need to be fited with data in Y0 at times specified in X0. I thought it is easier than the other problems I saw in examples with Direct Search 2 and still I can't get through syntax neither with it not with NonlinearFit of core Maple...

I would appreciate if you could point me what I am doing wrong. Just in case I also attach full version of the file.01test.mw

Thank you in advance!

Hey everyone!

I am trying to merge two vectors into a matrix. Let us say that both of the vectors has only one line and 4 columns:
A:=[a1,a2,a3];B:=[b1,b2,b3,b4];
Therefore, the matrix that I am trying to get should have this form:
M=Matrix([[a1,b1,0,0,0,0,0,0],[0,0,a2,b2,0,0,0,0],[0,0,0,0,a3,b3,0,0],[0,0,0,0,0,0,a4,b4]]);
Thanks in advance!

restart; N := 100; dx := evalf(2*Pi/N)

100

 

0.6283185308e-1

(1)

f1 := proc (x) options operator, arrow; sin(x) end proc;

proc (x) options operator, arrow; sin(x) end proc

(2)

DiscX := proc (N, dx) local i, xv; xv := Vector(N); for i to N do xv[i] := evalf((i-(1/2)*N-1)*dx) end do; return xv end proc:

Xfun := proc (f1) local i, xa1, xa2; xa1 := Vector(N); xa2 := Vector(N); for i to N do xa1[i] := evalf(subs(x = a[i], f1(x))) end do; return xa1 end proc:

IntNum := proc (N, a, c) local i, xv1; xv1 := Vector(N); for i from 2 to N-1 do xv1[i] := evalf((1/2)*(a[i]-a[i+1])*(c[i]+c[i+1])) end do; return xv1 end proc:

a := DiscX(N, dx); a[1]; a[100]

a := Vector(4, {(1) = ` 1 .. 100 `*Vector[column], (2) = `Data Type: `*anything, (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order})

 

-3.141592654

 

3.078760801

(3)

c := Xfun(f1); c[1]

c := Vector(4, {(1) = ` 1 .. 100 `*Vector[column], (2) = `Data Type: `*anything, (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order})

 

0.4102067615e-9

(4)

k := IntNum(N, a, c)

k := Vector(4, {(1) = ` 1 .. 100 `*Vector[column], (2) = `Data Type: `*anything, (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order})

(5)

plot([seq([a[i], k[i]], i = 2 .. N)], style = line, title = typeset("Integ_of_sin(x)"), titlefont = [times, bold, 30]);

 

``

Download test.mw

Hey everyone!

I would like to plot the integral of a discrete function. For simplicity, I choose the function sin(x) between –Pi and Pi, which has as an integral -cos(x). I tried to implement that in Maple using the Trapezoidal rule, but the result is simply wrong. Any help would be much appreciated!

I need to declare a whole set of variables as local. The variable names are generates algorithmically using assign. Like so:

seq(seq(assign(cat(S,i,j)=Vector(datatype=float)),i=1..9),j=1..9);

Stand-alone, this works and creates all these Vectors for later use. But this:

local seq(seq(assign(cat(S,i,j)=Vector(datatype=float)),i=1..9),j=1..9);

does not work; I get an "error; '(' unexpected".

I really do not want to type all these by hand... on the other hand, if I do not declare these as local I get 99 warnings about implicit local declaration; not nice.

Is there a way to do this?

Thanks,

M.D.

PS: I do not upload as the one line really is all that is needed. At the lowest level one does not get the implicit-declaration warning, but with "local" it still fails.

hello,my friends.I got a problem in using maple.

I want project a cuboid on a plane, and integrate function on that area.

for example, a cuboid which have a spatial diagonal between (0,0,0) and (1,2,1).
Then it was projected to a plane defined by three points (-1,0,0), (0,-1,0) and (0,0,-1).
Finally, a function x^2+y^2 was integrated on that projected area.

I found the cuboid can be defined with plottools:-cuboid and projected with plottools:-project in maple.
but how to integration next?
I can't find any commands in maple can do the integration with that irregular area.

I need some help.Thank you very much in advance.

Dear Useres!

Hope everyone is fine here! I want to compare the coeficient of exp(k*eta[3]+m*eta[1]+n*eta[2]) for k=0,1,2,3,...,N,n=0,1,2,3,...,N and m=0,1,2,3,...,N for N=10 in the following attached file. But I got some error, please have a look and try to fix it as early as possible. Please take care and thanks

Compare_coeff.mw

4 5 6 7 8 9 10 Last Page 6 of 72