dharr

Dr. David Harrington

8235 Reputation

22 Badges

20 years, 340 days
University of Victoria
Professor or university staff
Victoria, British Columbia, Canada

Social Networks and Content at Maplesoft.com

Maple Application Center
I am a retired professor of chemistry at the University of Victoria, BC, Canada. My research areas are electrochemistry and surface science. I have been a user of Maple since about 1990.

MaplePrimes Activity


These are answers submitted by dharr

Attempt 2, after OP provided reference.

d_relation2.mw

Well, Maple knows about other classes of functions, though the elementary ones are mixed into those. You could use FunctionAdvisor to make a list of functions that are 0F1 or 1F1 or 2F1 or Other and not elementary. I think that is all [edit: No, there are more classes, see Carl's answer.] The problem with excluding, say, hypergeom is that some hypergeometric functions simplify to elementary functions, depending on their arguments, e.g., by using convert(...,elementary).

Edit: added hypergeom and Hypergeom to the list.

restart;

FunctionAdvisor("0F1");

The 26 functions in the "0F1" class are particular cases of the hypergeometric function and are given by:

[AiryAi, AiryBi, BesselI, BesselJ, BesselK, BesselY, HankelH1, HankelH2, KelvinBei, KelvinBer, KelvinHei, KelvinHer, KelvinKei, KelvinKer, cos, cosh, cot, coth, csc, csch, sec, sech, sin, sinh, tan, tanh]

FunctionAdvisor("1F1");

The 20 functions in the "1F1" class are particular cases of the hypergeometric function and are given by:

[CoulombF, CylinderD, CylinderU, CylinderV, Ei, FresnelC, FresnelS, Fresnelf, Fresnelg, GAMMA, HermiteH, KummerM, KummerU, LaguerreL, WhittakerM, WhittakerW, dawson, erf, erfc, erfi]

FunctionAdvisor("2F1");

The 26 functions in the "2F1" class are particular cases of the hypergeometric function and are given by:

[ChebyshevT, ChebyshevU, EllipticCE, EllipticCK, EllipticE, EllipticK, GaussAGM, GegenbauerC, JacobiP, LegendreP, LegendreQ, LerchPhi, SphericalY, arccos, arccosh, arccot, arccoth, arccsc, arccsch, arcsec, arcsech, arcsin, arcsinh, arctan, arctanh, ln]

FunctionAdvisor(Other);

The 10 functions in the "Other" class are:

[Dirac, Heaviside, LambertW, MeijerG, Stirling1, Stirling2, Wrightomega, bernoulli, euler, unwindK]

FunctionAdvisor(elementary);

The 26 functions in the "elementary" class are:

[arccos, arccosh, arccot, arccoth, arccsc, arccsch, arcsec, arcsech, arcsin, arcsinh, arctan, arctanh, cos, cosh, cot, coth, csc, csch, exp, ln, sec, sech, sin, sinh, tan, tanh]

nmfunctions:={hypergeom,Hypergeom,FunctionAdvisor("0F1",quiet)[],FunctionAdvisor("1F1",quiet)[],FunctionAdvisor("2F1",quiet)[],FunctionAdvisor("Other",quiet)[]} minus {FunctionAdvisor(elementary,quiet)[]};

{AiryAi, AiryBi, BesselI, BesselJ, BesselK, BesselY, Dirac, Ei, GAMMA, JacobiP, KummerM, KummerU, MeijerG, dawson, erf, erfc, erfi, euler, unwindK, ChebyshevT, ChebyshevU, CoulombF, CylinderD, CylinderU, CylinderV, EllipticCE, EllipticCK, EllipticE, EllipticK, FresnelC, FresnelS, Fresnelf, Fresnelg, GaussAGM, GegenbauerC, HankelH1, HankelH2, Heaviside, HermiteH, Hypergeom, KelvinBei, KelvinBer, KelvinHei, KelvinHer, KelvinKei, KelvinKer, LaguerreL, LambertW, LegendreP, LegendreQ, LerchPhi, SphericalY, Stirling1, Stirling2, WhittakerM, WhittakerW, Wrightomega, bernoulli, hypergeom}

As a type

nmtype:=specfunc~(nmfunctions):

type(AiryAi(x),nmtype);
type(sin(x),nmtype);

true

false

``

Download fns.mw

To (recklessly? conveniently?) ignore the signs, simplify(...,symbolic) will work, at least in my version of Maple.

To literally replace the signums with 1, you can do eval(...,signum=1), though I'm not clear on why you would want to do that.

Maple is giving the expected results. In the first case nothing is known about the sign; in the second case a is assumed positive and the expression simplifies. I'm sure you know how to just assume on a; the symbolic simplification works more universally.

I'm not clear on how choosing the value for _Envsignum0 comes into this; it is just saying what the result should be if the expression signum is given is zero. Try signum(a) assuming a=0;

 


 

restart;

S:=proc()
  local k,V:=Vector();
  for k to 10 do
    V(k):=k^2;
  end do;
  V;
end proc:

V:=S();

V := Vector(10, {(1) = 1, (2) = 4, (3) = 9, (4) = 16, (5) = 25, (6) = 36, (7) = 49, (8) = 64, (9) = 81, (10) = 100})

plots:-pointplot(Vector(numelems(V),k->k),V);

``

 

Download VV.mw

Your first problem is that you have not consistently used "*" for multiplication (these look like centered dots, in the middle of the line); many of them are "." (look the way they are typed, at the bottom of the line), which is Matrix multiplication. I converted them all to "*", but there is still the same error message. 

The error message arises because Maple cannot rearrange all the equations into standard form - I'm guessing the squared term (diff(Theta(eta), eta))^2 is the problem. Sometimes rearranging by solving explicitly for these quantities before dsolve can succeed where Maple cannot. I recall some discussion of this on this forum, but I do not have time to work further on this now.

New.mw

expr:=1+5*I+sin(x)-sqrt(8)*I-a;
map(x->if type(x,complex) then Re(x),Im(x)*I else x end if, [op(expr)]);

gives

[1, 5*I, sin(x), 0, -(2*I)*sqrt(2), -a]

assuming expr is a sum of terms, i.e. has type `+`.  (5+I on its own is not a sum of terms.)

Edit: to cover the case of a single complex constant such as 5+I

terms:=proc(expr)
       if type(expr,`+`) then
          map(x->if type(x,'complex') then Re(x),Im(x)*I else x end if, [op(expr)])
       elif type(expr,'complex') then
          [Re(x),Im(x)*I]
       else error "not a sum"
       end if;
end proc:

There are other things that look like sums but aren't of type `+`  (series and perhaps others) that could be included.

To add to @Kitonum's answer, for item in expr iterates over the operands of expr, and op(I) is 1. As it states on the help page for I, I is implemented as Complex(1), so op(I) = op(1,I) = 1 and op(0,I) = Complex. As always when dealing with operands, things are not always as they seem, so care needs to be taken. Note that op(0,5+I) = Complex, so this might be helpful in screening terms.

Edit: you can also test for the type complex or complexcons or realcons.

Note that type(a+I, `+`) returns true (a and I are different numbers) but type(9+I, `+`) returns false (a single complex number). Recognizing this leads the the solution I've given in a separate answer to your update. (Someone promoted that from a reply to an answer.)

simplify([0.*I-3, 5, 7, -2],zero);

 

restart;

spirals:=proc(p::posint,q::posint)
    local A,B,C,r,s,t,eq1,eq2,eq3,ans,Bi,i,j,z,
                circles,j__min,j__max,min_d,max_d;
    # circles A,B,C have centres in the complex plane at
    A:=s*exp(I*t);
    B:=s^(p/q)*exp(I*(p*t+2*Pi)/q);
    C:=1;
    # radii are |A|*r, |B|*r, |C|*r=r, so for mutual touching
    eq1:=simplify(abs(A-C)-(abs(A)+abs(C))*r) assuming positive;
    eq2:=simplify(abs(B-C)-(abs(B)+abs(C))*r) assuming positive;
    eq3:=simplify(abs(B-A)-(abs(B)+abs(A))*r) assuming positive;
    ans:=fsolve({eq1,eq2,eq3},{s=0..infinity,t=0..2*Pi,r=0..infinity});
    A,B,r:=eval([A,B,r],ans)[]; #A,B,r now floating point
    min_d:=0.7; # smallest circle cutoff
    max_d:=100; # half frame size
    for i from 0 to q-1 do              #spirals
       Bi:=B^i;
       j__min:=floor(ln(min_d/abs(Bi))/ln(abs(A)));
       j__max:=ceil(ln(max_d*sqrt(2.)/abs(Bi))/ln(abs(A)));
       for j from j__min to j__max do #circles within spirals
         z:=Bi*A^j;
         circles[i,j]:=plottools:-circle([Re(z),Im(z)],abs(z)*r);
       end do;
    end do;
    plots:-display(plottools:-rectangle([-max_d,max_d],[max_d,-max_d],color=white),
                   entries(circles,'nolist'),
                   scaling=constrained,axes=none,
                   view=[-max_d..max_d,-max_d..max_d]);
end proc:

spirals(2,12);

 

Download DoyleSpirals.mw

Here's one way.

restart

with(plottools):

Basis vectors

u := [1, 0]:

Grid limits

i__min := -3:

ulines := seq(line(i__min*u+j*v, i__max*u+j*v, linestyle = dash), j = j__min .. j__max):

ulabel := plots:-textplot([u[], "u"], 'align' = {'below', 'right'}, font = [times, bolditalic, 25]):

plots:-display(ulines, vlines, arrow([0, 0], u, .1, .4, .4), arrow([0, 0], v, .1, .4, .4), ulabel, vlabel, axes = none);

``

 

Download grid.mw

No entirely sure I understand what you want to do, but perhaps this?

ChgtVariables_VERS_INT:=
seq([diff(theta[i](t),t$2)=cat(ddq,i),
     diff(theta[i](t),t)=cat(dq,i),
     theta[i](t)=cat(q,i)][],i=1..3);

diff(diff(theta[1](t), t), t) = ddq1, diff(theta[1](t), t) = dq1, theta[1](t) = q1, diff(diff(theta[2](t), t), t) = ddq2, diff(theta[2](t), t) = dq2, theta[2](t) = q2, diff(diff(theta[3](t), t), t) = ddq3, diff(theta[3](t), t) = dq3, theta[3](t) = q3

 

 

Download cat.mw

Your use of subs(x=L,nw(x,t)) leads to subs(x=L,diff(p(x,t),x)) which leads for L=0.003 to diff(0.003,t),0.003), which doesn't make sense. This can be solved by converting to D notation, which you need anyway for ICs and BCs. This and other changes indicated in red. But at the end of the day you get (at least in my Maple 2015), the error

Error, (in pdsolve/numeric/match_PDEs_BCs) cannot handle systems with multiple PDE describing the time dependence of the same dependent variable, or having no time dependence.

My interpretation of this is that coupled systems such as yours are not handled in Maple.

system.mw

I see you have now moved to Laplace on the other thread, which is how I would have done it. But the answer to your question about BC2 is to use D rather than diff.

bc_2 := K_1*D[1](c)(a,t) = K_2*D[1](e)(a,t);

Here [1] means differentiate with respect to the first variable, and (a,t) is the point to avaluate at. For example 

c:=(r,t)->r^2*sin(t);
D[1](c)(a,t);

gives 2*a*sin(t).

ShapiroWilkWTest is in the Statistics package, which needs to be loaded by with(Statistics) or just use Statistics:-ShapiroWilkWTest. Perhaps there is some other problem that can be diagnosed if you upload your worksheet with your code, using the green up-arrow. Note that the output (vals) is an expression sequence and not a list.
 

Mat1:=Vector([$1..5]):

p:=Statistics:-ShapiroWilkWTest(Mat1,level=0.05,output='pvalue')

HFloat(0.9548265643483067)

vals:=Statistics:-ShapiroWilkWTest(Mat1,level=0.05)

hypothesis = true, pvalue = HFloat(0.9548265643483067), statistic = HFloat(0.986713744)

p:=eval(pvalue,[vals]);

HFloat(0.9548265643483067)

The following also works, but you need to know that pvalue is second in the sequence, so it is better to use the above methods.

p:=rhs(vals[2]);

HFloat(0.9548265643483067)

``

 

Download ShapiroWilkWTest.mw

Don't know much about this, but seems DEtools:-reduce_order will do what you want.
 

restart

with(PDEtools):

eq := (diff(U(z), z))^3*(diff(U(z), z, z))+(diff(U(z), z))*(diff(U(z), z, z, z, z))-(diff(U(z), z, z))*(diff(U(z), z, z, z));

(diff(U(z), z))^3*(diff(diff(U(z), z), z))+(diff(U(z), z))*(diff(diff(diff(diff(U(z), z), z), z), z))-(diff(diff(U(z), z), z))*(diff(diff(diff(U(z), z), z), z))

Symmetries

syms := symgen(eq);

[_xi = 0, _eta = 1], [_xi = 1, _eta = 0], [_xi = 1, _eta = 1], [_xi = z, _eta = 0]

Use the symmetries to find a first order ode

reduce_order(eq, syms, output = reduced_ode);

diff(_j(_h), _h) = -_j(_h)*(3+(_h^4+4*_h^2)*_j(_h)^2-6*_j(_h)*_h)/_h

This form shows meaning of _h etc

reduce_order(eq, syms);

U(z) = ODESolStruc(Int(_h*exp(-2*(Int(_j(_h), _h))-2*_C3)*(exp(Int(_j(_h), _h)+_C3))^2*_j(_h), _h)+_C1, [{diff(_j(_h), _h) = -_j(_h)*(3+(_h^4+4*_h^2)*_j(_h)^2-6*_j(_h)*_h)/_h}, {_h = (diff(U(z), z))^2/(diff(diff(U(z), z), z)), _j(_h) = -(diff(diff(U(z), z), z))^3/((diff(U(z), z))^2*((diff(U(z), z))*(diff(diff(diff(U(z), z), z), z))-2*(diff(diff(U(z), z), z))^2))}, {z = Int(_h*exp(-2*(Int(_j(_h), _h))-2*_C3)*_j(_h)*exp(Int(_j(_h), _h)+_C3), _h)+_C2, U(z) = Int(_h*exp(-2*(Int(_j(_h), _h))-2*_C3)*(exp(Int(_j(_h), _h)+_C3))^2*_j(_h), _h)+_C1}])

``

NULL

 

Download integration.mw

First 38 39 40 41 42 43 44 Last Page 40 of 81