MaplePrimes Questions

Hi everybody,

Why f generates the error "... orthopoly is not a module or member"

f := proc(n)
   uses orthopoly;
   H(n,z);
end proc;

as g works correctly ?

g := proc(n)
   orthopoly:-H(n,z);
end proc;


Thanks in advance

I want to animate the functions approximate_f and f in the worksheet where 0<=t<=1.

 

Please find the following code.

code.mw

 

Thank you very much.

 

Does anybody mind clarifying what the three argument signum means?

I have the expression

signum(0,R-sqrt(R^2+z^2),1)

in which z>0, R>0. I guess I know what signum means, however in this case according to the help it is considering signum of 0 and then in the help it is talking about some environment variable. I just dont quite understand...

Does it mean Maple has issues to clarify the sign of R-sqrt(R^2+z^2) ??

Thanks

Rayleigh's identity is listed below:


              infinity                                           
               -----                                             
                \                                                
                 )             2      /      2        1      1  \
                /        |f(k)|  = int||f(t)| , t = - - T .. - T|
               -----                  \               2      2  /
            k = -infinity                                        

 

sum(abs(f(k))^2, k = -infinity .. infinity) = int(abs(f(t))^2, t = -(1/2)*T .. (1/2)*T);

This identity is an extension from Parseval's theorem for the case where the function of interest is periodic.  The link below provides a worksheet that confirms for a finite series that Rayleigh's identity is valid to within so many significant figures as the frequency parameter, k, increases for CASE 1.  However, for CASE 2 concurrence between the integral and the finite series is not that great.  I suspect I have an error somewhere that is causing the discrepancy.  I thought it might be useful if I get other sets of eyes on this to help isolate the discrepancy.  How I came up with Ck for CASE 2 I can create another worksheet with that derivation if requested.

Rayleighs_identity.mw

Appreciate any useful feedback

 

I found that when changing constant of integration from _C1 to C1, Maple now fails to verify solution.

Is one supposed to only use constant with _ in it for this? I prefer to use C1 instead of _C1. Why does Maple odetest fail in this case? Is there a way around this?

Here is an example

restart;
ode:=diff(y(x),x)=x*ln(y(x)):
implicit_sol := -Ei(1, -ln(y(x)))+C1=(1/2)*x^2;
explicit_sol := solve(implicit_sol,y(x)):
odetest(y(x)=explicit_sol,ode);

Now changing C1 to _C1 and nothing else, odetest verifies the solution

implicit_sol:= subs(C1=_C1,implicit_sol);
explicit_sol := solve(implicit_sol,y(x)):
odetest(y(x)=explicit_sol,ode);

I understand the using symbol with _ is a convention in Maple for global symbols. But I want to use C1 and not _C1 as it is easier to read.

 

Hello guys,

I have three equations with three unknowns that I can not solve but my friend solved it with Mathematica, but I do not know how to get answers with Maple.

 

Thankssolutions.mw

 

Hello,

I'm writing an equation that has a term including divergence .. i'd like to print that as the sum of the derivatives

for example instead of nabla(u) display it as ux+uy+uz

 

restart

VectorCalculus[SetCoordinates]('cartesian'[x, y, z]); F := x, y, z, t

vel := VectorCalculus[VectorField](`<,>`(u(F), v(F), w(F)))

vel := u(x, y, z, t)*`#mover(mi("e"),mo("&lowbar;"))`[x]+v(x, y, z, t)*`#mover(mi("e"),mo("&lowbar;"))`[y]+w(x, y, z, t)*`#mover(mi("e"),mo("&lowbar;"))`[z]

(1)

Mass_eqn := diff(rho(F), t)+Divergence(rho(F)*vel)

Mass_eqn := diff(rho(x, y, z, t), t)+VectorCalculus[Nabla].(Vector(3, {(1) = rho(x, y, z, t)*u(x, y, z, t), (2) = rho(x, y, z, t)*v(x, y, z, t), (3) = rho(x, y, z, t)*w(x, y, z, t)}))

(2)

print(Mass_eqn)

diff(rho(x, y, z, t), t)+VectorCalculus[Nabla].(Vector(3, {(1) = rho(x, y, z, t)*u(x, y, z, t), (2) = rho(x, y, z, t)*v(x, y, z, t), (3) = rho(x, y, z, t)*w(x, y, z, t)}))

(3)

NULL


 

Download aero.mw

How do I convert a complex number to abs and arg presentation.

For example:

z=1+1*I would be z=sqrt(2)*exp(I*Pi/4)

or when doing a calculation how can I tell him to always present these number in that form and do not expand out.

Thanks

Dear all,

 

I have variables like: x1, x2, x3, x4, ...

I want to unassign all x? variables.

How can I do it?

 

I tried

 

for i from 1 to n_x do ... unassign('x||i') ... od:

 

but it does not work :(

How can I run Maple Script ,hold it and continue to run it ?
Somethink like Matlab pause statment

Tank you

How I can convert my maple code to matlab?.

dsolv.mw
 

 

restart;

``

 

fdsolve := proc({alpha:=NULL, t0:=NULL,
                 t1:=NULL, x0:=NULL, y0:=NULL,
                 N:=NULL}, params)
    local t, h, h1, h2, c, b, x, y, L, n, l, X, Y, f, g;
    eval(F(t,x,y), params);
    f := unapply(%, [t,x,y]);
    eval(G(t,x,y), params);
    g := unapply(%, [t,x,y]);
    L := floor(1/alpha);
    h := (t1 - t0)/N;
    h1 := h^alpha/GAMMA(alpha+1);
    h2 := h^alpha/GAMMA(alpha+2);
    c := (i,n) ->
        `if`(i=0,
            (n-1)^(alpha+1) - (n-1-alpha)*n^alpha,
            (n-i+1)^(alpha+1) + (n-i-1)^(alpha+1) - 2*(n-i)^(alpha+1));
    b := (i,n) -> (n-i)^alpha - (n-1-i)^alpha;
    t := Array(0..N, i-> (1-i/N)*t0 + i/N*t1, datatype=float[8]);
    x[0], y[0] := x0, y0;
    for n from 0 to N-1 do
        X[0], Y[0] :=
            x[0] + h1*add(b(i,n+1)*f(t[i],x[i],y[i]), i=0..n),
            y[0] + h1*add(b(i,n+1)*g(t[i],x[i],y[i]), i=0..n);
        for l from 1 to L do
            X[l], Y[l] :=
                x[0] + h2*add(c(i,n+1)*f(t[i],x[i],y[i]), i=0..n)
                     + h2*f(t[n+1], X[l-1], Y[l-1]),
                y[0] + h2*add(c(i,n+1)*g(t[i],x[i],y[i]), i=0..n)
                     + h2*g(t[n+1], X[l-1], Y[l-1]);
        end do;
        x[n+1], y[n+1] := X[L], Y[L];
        #printf("y[%d]=%a\n", n+1, y[n+1]);
    end do;
    return Array(0..N, i -> [t[i], x[i], y[i]]);
end proc:

 

F := (t,x,y) -> r*x*(1-x/k) - beta*x*y/(a+x^2);
G := (t,x,y) -> mu*beta*x*y/(a+x^2) - d*y - eta*x*y;

proc (t, x, y) options operator, arrow; r*x*(1-x/k)-beta*x*y/(a+x^2) end proc

 

proc (t, x, y) options operator, arrow; mu*beta*x*y/(a+x^2)-d*y-eta*x*y end proc

(1)

params := { r=0.05, a=0.8, mu=0.8, d=0.24,
            eta=0.01, beta=0.6, k=1.6 };

{a = .8, beta = .6, d = .24, eta = 0.1e-1, k = 1.6, mu = .8, r = 0.5e-1}

(2)

T := 300.0;  # time interval: 0 < t < T
q := 100;    # divide the time interval into q subintervals

300.0

 

100

(3)

We produce several solutions starting from various initial data x__0, y__0.

This reproduces the phase diagran in the cited article's Figure 2  (alpha=0.98):

sol := fdsolve(alpha=0.98, t0=0.0, t1=T, x0=2.5, y0=0.14, N=q, params):
p1 := plot([seq([sol[i][2], sol[i][3]], i=0..q)])

 

 

 


 

Download dsolv.mw

 

I want to check that all entries in a list are of some value. Say 0. (or in general, if all entries satisfy some condition).

So, If any entry is not zero, then it returns false. It returns true only if all elements meet this conditions.

What would be the right way to do this in Maple? I know I could write a loop. But I am asking if there is a build-in function in Maple. Here is an example

ode:=y(x)*diff(y(x),x)=x*(y(x)^2+2):
sol:= dsolve(ode,y(x)):
check:=map(z->odetest(z,ode1),[sol]);

                       check := [0, 0]

I want to check that all entries in check are zero. This tells me all my solution are correct.

I can't use member(check,0) since this only check if at least one entry is zero. I want to chek that all entries are zero.

In Mathematica, it has AllTrue function. Like this

check = {0, 0, 0};
AllTrue[check, # == 0 &]

     True

The "#==0&"  is the test to do. It uses this test on each element automatically. If all satisfy this test, then it returns true.

Again, I can easily write a small function in Maple to do this,

alltrue :=proc(arr,value)
    local z;
    for z in arr do
        if z<>value then
           return(false);
        fi;
    od;
    return(true);
end proc:

alltrue(check,0) return true.

But I am asking if there is a build-in such function similar to the above one in Mathematica, which accepts a more general test function to use.

I am interested in obtaining a Maple program (symbolic language) that can evaluate exponentials of non-commuting operators. 

eA+B=eAeBeC1eC2eC3...

See R. M. Wilcox, J. Math. Phys. 8, (1967), 962

This is the Baker-Campbell-Hausdorff expansion, or equivalently the Zassenhaus expansion.

 

Hello everyone,

I have a given parametric surface (u,v) -> F(u,v) where F(u,v) is a vector in R^3 and a parametrized vector field (u,v) -> G(u,v) where G(u,v) in R^3. Is it possible to plot the surface together with the vector field so that for some subset {(u_1,v_1),....,(u_n,v_n)} of the parameter set the vector G(u_i,v_i) is plotted at the surface point F(u_i,v_i) for i=1,...,n ?

If it is not directly possible to do this, is there any workaround?

1) I do not understand,

Ei(1, -ln(a-2)) for real numbers > +2

how to I convert it into this series format are there are 2 parameters ? (from https://en.wikipedia.org/wiki/Exponential_integral)

I'm aware of https://www.maplesoft.com/support/help/Maple/view.aspx?path=Ei&term=Ei

but as you can deduce I'm still having difficulties. 

2) Also In mary boas's book she only deals with Ei(x) no where can I figure out how 0.2193839344 is calculated from Ei(1,1.)?

Ei(1,1.)

0.2193839344

 

First 811 812 813 814 815 816 817 Last Page 813 of 2427