Maple Questions and Posts

These are Posts and Questions associated with the product, Maple

Could you help me make this code work?

Maple Worksheet - Error

Failed to load the worksheet /maplenet/convert/Matrix.mw .
 

Download Matrix.mw

 

restart;
with(LinearAlgebra);
A := 8; B := 5;
q := .4; p := .2; r := 1-p-q;
dimP := A+B+1;
P := Matrix(dimP, dimP, [0$dimP*dimP]);
P[1, 1] := 1; P[1, 2] := 0;
P[dimP, dimP] := 1; P[dimP, dimP-1] := 0;
for i from 2 to dimP-1 do P[i, i-1] := q; P[i, i] := r; P[i, i+1] := p end do;
p0 := Matrix(dimP, 1, [0$dimP]);
p0[A+1, 1] := 1;
pV[0] := p0;
PT := Transpose(P);
for n to 200 do pV[n] := PT . pV[n-1] end do;
map(proc (x) options operator, arrow; evalf(x, 3) end proc, Transpose(pV[5]));

 

Could you help me fix this code?
Thanks in advance

with(Statistics)

Wpath := proc (steps, t) local walk, i, N, ww; N := nops(steps); walk[0] := 0; for i from 0 to N-1 do walk[i+1] := walk[i]+steps[i+1]*sqrt(t/N) end do; ww := seq(plot(walk[i], t*i/N .. t*(i+1)/N), i = 0 .. N-1); plots[display]([ww]) end proc

N := 400

numbers := [random[empirical[.5, .5]](N)]

st1 := map(proc (x) options operator, arrow; 2*x-3 end proc, numbers)

list_of_k := [40, 20, 10, 5, 2, 1]

for j to nops(list_of_k) do k := list_of_k[j]; st[k] := [seq((sum(st1[p], p = i*k-k+1 .. k*i))/sqrt(k), i = 1 .. N/k)] end do

Error, (in limit/mrv/limsimpl) too many levels of recursion

 

``


 

Download Wiener_process.mw

How to calculate potential function of Maxwell equations?

is there calculation examples of strong and weak force examples too?

which library can calculate intersection numbers of familes of potential function of Maxwell equations?

is there any examples?

I know if we want calculus derivative of function use of command diff in maple. now i want know if want calculus variation of functional what we should do? is there any special command?

hello. im new to maple when i want to plot i have this problem.

 

Hi everybody:

I have the code in Maple that when run it I see this error, how can I solve this error? 

tnx...

 

Hi

Im going to solve mixing layer boundary layer equation in maple but Its this error: "Error, (in Shoot:-shoot) invalid boundary conditions, must be given at one point"

please help me. thank you.

> restart;
> alias(U = u(x, y), V = v(x, y)); PDE := {diff(U, x)+diff(V, y) = 0, U*(diff(U, x))+V*(diff(U, y))-nu*(diff(U, `$`(y, 2))) = 0};
print(`output redirected...`); # input placeholder
    // d   \   / d   \        / d   \     / d   \      / d  / d   \\    \ 
   { |--- U| + |--- V| = 0, U |--- U| + V |--- U| - nu |--- |--- U|| = 0 }
    \\ dx  /   \ dy  /        \ dx  /     \ dy  /      \ dy \ dy  //    / 
> simsubs := eta(x, y) = y*sqrt((1/2)*u[0]/(nu*x));
print(`output redirected...`); # input placeholder
                                                  (1/2)
                                 1    (1/2) /u[0]\     
                     eta(x, y) = - y 2      |----|     
                                 2          \nu x/     
> stream := psi(x, y) = sqrt(2*nu*x*u[0])*f(eta(x, y));
print(`output redirected...`); # input placeholder
                           (1/2)            (1/2)             
              psi(x, y) = 2      (nu x u[0])      f(eta(x, y))
> Usubs := U = diff(rhs(stream), y);
print(`output redirected...`); # input placeholder
              (1/2)            (1/2)                 / d           \
         U = 2      (nu x u[0])      D(f)(eta(x, y)) |--- eta(x, y)|
                                                     \ dy          /
> Vsubs := V = -(diff(rhs(stream), x));
print(`output redirected...`); # input placeholder
               (1/2)                     
              2      f(eta(x, y)) nu u[0]
        V = - ---------------------------
                               (1/2)     
                  2 (nu x u[0])          

              (1/2)            (1/2)                 / d           \
           - 2      (nu x u[0])      D(f)(eta(x, y)) |--- eta(x, y)|
                                                     \ dx          /
> ODE := simplify(subs(Usubs, Vsubs, simsubs, PDE));
print(`output redirected...`); # input placeholder
 /                             /      /           /                 (1/2)\  /    
 |                  1          |    2 |           |1    (1/2) /u[0]\     |  |1   
 |0 = 0, - ------------------- |u[0]  |@@(D, 2)(f)|- y 2      |----|     | f|- y 
<                        (1/2) \      \           \2          \nu x/     /  \2   
 |               2 /u[0]\                                                        
 |         2 nu x  |----|                                                        
 \                 \nu x/                                                        

               (1/2)\          (1/2)  
   (1/2) /u[0]\     |    /u[0]\       
  2      |----|     | nu |----|      x
         \nu x/     /    \nu x/       

                                 /                 (1/2)\\\    \ 
                (1/2)            |1    (1/2) /u[0]\     |||    | 
   + (nu x u[0])      @@(D, 3)(f)|- y 2      |----|     ||| = 0| 
                                 \2          \nu x/     ///     >
                                                               | 
                                                               | 
                                                               / 
> simsubs2 := solve(subs(eta(x, y) = eta, simsubs), {y});
print(`output redirected...`); # input placeholder
                              /         (1/2) \ 
                              |    eta 2      | 
                              |y = -----------| 
                             <           (1/2) >
                              |    /u[0]\     | 
                              |    |----|     | 
                              \    \nu x/     / 
> ODE := simplify(subs(simsubs2, ODE), symbolic);
print(`output redirected...`); # input placeholder
      /             2                                                 \ 
      |         u[0]  (@@(D, 2)(f)(eta) f(eta) + @@(D, 3)(f)(eta))    | 
     < 0 = 0, - -------------------------------------------------- = 0 >
      |                                2 x                            | 
      \                                                               / 

> shootlib := "C:\\Users/abbas/Desktop/maple9/"; libname := shootlib, libname; with(Shoot);
print(`output redirected...`); # input placeholder
                                   [shoot]
> FNS := {f(eta), g(eta), h(eta)};
> ODE := {diff(f(eta), eta) = g(eta), diff(g(eta), eta) = h(eta), diff(h(eta), eta) = -f(eta)*h(eta)};
print(`output redirected...`); # input placeholder
 /  d                      d                      d                          \ 
{ ----- f(eta) = g(eta), ----- g(eta) = h(eta), ----- h(eta) = -f(eta) h(eta) }
 \ deta                   deta                   deta                        / 
> IC := {f(0) = 0, g(0) = 0, h(0) = beta};
print(`output redirected...`); # input placeholder
                      {f(0) = 0, g(0) = 0, h(0) = beta}
> BC := {g(-10.) = 0, g(10.) = 1, limit(eta-f(eta), eta = 10) = 0};
print(`output redirected...`); # input placeholder
                  {10 - f(10) = 0, g(-10.) = 0, g(10.) = 1}
> infolevel[shoot] := 1;
print(`output redirected...`); # input placeholder
                                      1
> S := shoot(ODE, IC, BC, FNS, beta = 0, abserr = 0.5e-6, output = listprocedure, method = taylorseries);
%;
Error, (in Shoot:-shoot) invalid boundary conditions, must be given at one point
 

Hi 

how can i solve this integral in term of x

int(d*e^(-b*x)/(((a*e^(-2*b*x)+c*e^(-4*x)))))

Need help solving this problem with a maple proc using the Crank–Nicolson method for the differential part and any other quadrature  for the integral part and thank you so much in advance any ideas or thoughts would be helpful

hello everyone,

please I need our help to find the eigenvalues (m) of this equation (eq)

thank you 

eq.mw
 

``

restart

with(LinearAlgebra):

NULL

Digits := 5:

``

``

eq := exp(-m*xi)*(exp((1/4)*sqrt(-m)*r*(r-1))*(1+(7/20)*sqrt(m)*r+((49/800)*m-(1/4)*sqrt(m))*r^2)*r^I+exp((1/4)*sqrt(-m)*r*(r-1))*(1+(7/20)*sqrt(m)*r+((49/800)*m-(1/4)*sqrt(m))*r^2)*r^I*cos(theta)+r^I*sin(5*theta))

exp(-m*xi)*(exp((1/4)*(-m)^(1/2)*r*(r-1))*(1+(7/20)*m^(1/2)*r+((49/800)*m-(1/4)*m^(1/2))*r^2)*r^I+exp((1/4)*(-m)^(1/2)*r*(r-1))*(1+(7/20)*m^(1/2)*r+((49/800)*m-(1/4)*m^(1/2))*r^2)*r^I*cos(theta)+r^I*sin(5*theta))

(1)

``


 

Download eq.mw

 

I just used Maple for the first time to find the roots of an equation, the problem they give me imaginary solutions every time I put a (ln); even for ln (1) it proposes me -265.745524189222 + 0.785398163397448 * I as a solution. Could you help me to solve this problem?

Could you help me converting this old version code to modern version code(Maple 2017)?
 

restart

N := 2; A := -N; B := N

q := .3; p := .5; sa := .9; sb := .1; r := 1-p-q

dimP := 2*N+1

P := Matrix(dimP, dimP)

P[1, 1] := sa; P[1, 2] := 1-sa; P[dimP, dimP] := sb; P[dimP, dimP-1] := 1-sb

for i from 2 to dimP-1 do P[i, i-1] := q; P[i, i] := r; P[i, i+1] := p end do

P

Matrix(%id = 18446745940352174910)

(1)

# change this part code to the modernversion with(linalg)

J := diag(`$`(1, dimP))

d := matrix(dimP, 1, [`$`(1, dimP)])

b := matrix(dimP+1, 1, [`$`(0, dimP), 1])

A := transpose(augment(P-J, d))

linsolve(A, b)

linsolve(transpose(augment(Matrix(%id = 18446745940387027294), d)), b)

(2)

``


 

Download mdernVersion.mw

how can i define this  operation of diff in matrix

 

 

Hello;

 I am trying to verify the analytic solution of a electric and magnetic fields created by a small dipole antenna (also called "Hertzian dipole"). The study of a small dipole is ground zero of anyone learning about antennas as calculations are "relatively" easy if a mathematical software is used. As the title suggests, the fieldplot3d returns an empty box.

Here is some introduction for the problem in question:

 The procedure is relatively straightforward, first, current density vector is defined, from there, magnetic vector potential (named "vector A") is calculated. The curl of vector A gives the magnetic field (named "B-field") produced by the antenna. From B-field, H field is deduced as it is only a multiplication of the B-field by a constant.

 At this point, I try to plot the H-field, and it works like a charm. No problem at all.

The electric field (named "E-field") then, may be calculated by taking the curl of the H-field and multiplying by a constant.

 At this second point, I try to plot the E-field, however, Maple returns an empty box. 

First, I thaught, maybe it was a problem of division by 0, however, after redefining the axis ranges, the problem still persists. I am attaching the code and the images. Any help will be greatly appreciated.

PS: This is my first post and I am very new to maple, please indulgde me if I make some formatting and/or post mistakes

 

KB

First step: Verify calculations for Hertzian dipole

 

restart;

with(plots):

with(LinearAlgebra):

with(VectorCalculus):

#IMPORTANT: R is constant for the calculation of A

 

 

 

J:=Vector[column]([ 0 ,
                 0 ,
                 I_0/s ]);

J := I_0*e[z]/s

(1)

 

A := VectorCalculus:-`*`(VectorCalculus:-`*`(mu_0, 1/VectorCalculus:-`*`(4, Pi)), int(VectorCalculus:-`*`(VectorCalculus:-`*`(VectorCalculus:-`*`(J, exp(VectorCalculus:-`-`(VectorCalculus:-`*`(VectorCalculus:-`*`(I, k), R)))), s), 1/R), z = VectorCalculus:-`-`(VectorCalculus:-`*`(l, 1/2)) .. VectorCalculus:-`*`(l, 1/2)))

A := (1/4)*mu_0*exp(-I*k*R)*I_0*l*e[z]/(Pi*R)

(2)

A[1];

0

(3)

A[2];

0

(4)

A[3];

(1/4)*mu_0*exp(-I*k*R)*I_0*l/(Pi*R)

(5)

#Taking the curl of A:

#IMPORTANT: R is a function of x,y,z:

R:=sqrt(x^2+y^2+z^2);

(x^2+y^2+z^2)^(1/2)

(6)

 

 

 

#Defining B by taking the curl

B[1] := VectorCalculus:-`+`(diff(A[3], y), VectorCalculus:-`-`(diff(A[2], z))):

 

 

B[2] := VectorCalculus:-`-`(VectorCalculus:-`+`(diff(A[3], x), VectorCalculus:-`-`(diff(A[1], z)))):

 

 

B[3] := VectorCalculus:-`+`(diff(A[2], x), VectorCalculus:-`-`(diff(A[1], y))):

B:=Vector[column]([ B[1] ,
                 B[2] ,
                 B[3] ]):

 

 

mu_0:=4*Pi*10^(-7):

I_0:=2400:

f:=2500:

omega:=2*Pi*f:

c:=3*10^8:

k:=omega/c:

l:=3*10^(-2):

epsilon_0:=1/(mu_0*c^2):

 

 

 

B_plot:=fieldplot3d([B[1],B[2],B[3]], x=-1..1,y=-1..1,z=-1..1,fieldstrength=log,arrows=SLIM):

 

 

H:=(1/mu_0)*B:

 

H_plot:=fieldplot3d([H[1],H[2],H[3]], x=-1..1,y=-1..1,z=-1..1,fieldstrength=log,arrows=SLIM):

 

# Taking curl of H to find the E field:

 

E[1] := VectorCalculus:-`*`(1/VectorCalculus:-`*`(VectorCalculus:-`*`(I, omega), epsilon_0), VectorCalculus:-`+`(diff(H[3], y), VectorCalculus:-`-`(diff(H[2], z)))):

E[2] := VectorCalculus:-`*`(1/VectorCalculus:-`*`(VectorCalculus:-`*`(I, omega), epsilon_0), VectorCalculus:-`-`(VectorCalculus:-`+`(diff(H[3], x), VectorCalculus:-`-`(diff(H[1], z))))):

E[3] := VectorCalculus:-`*`(1/VectorCalculus:-`*`(VectorCalculus:-`*`(I, omega), epsilon_0), VectorCalculus:-`+`(diff(H[2], x), VectorCalculus:-`-`(diff(H[1], y)))):

E:=Vector[column]([ E[1] ,
                 E[2] ,
                 E[3] ]):

E_plot:=fieldplot3d([E[1],E[2],E[3]], x=1..500,y=1..500,z=1..500,fieldstrength=log,arrows=SLIM):

 

 

subs(x=1,y=1,z=1,H):

 

H_plot;

 

 

 

E_plot;

 

 

``


 

Download short_dipole_matrix_way_old_school.mw 

 

First 542 543 544 545 546 547 548 Last Page 544 of 2097