dharr

Dr. David Harrington

8270 Reputation

22 Badges

20 years, 357 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

You need eval to make the reference to a refer to the actual table. Tables have special evaluation rules - see the help page for table.

atable := table()

table( [ ] )

a := table()

table( [ ] )

atable["a"] := eval(a)

table( [ ] )

atable["b"] := table()

table( [ ] )

whattype(atable["a"])

indexed

whattype(atable["b"])

indexed

type(atable["a"], table);

true

type(atable["b"], table);

true

 

 

Download tabledefinition.mw

You need to specify the values of Q and lambda. I have assumed some values and shown dsolve works, but you will have to fix up the rest of the worksheet appropriately, The Runge-Kutta-Fehlberg method is for initial value problems, so is not appropriate for this boundary value problem.

ODE_Numeric_solution.mw

Use Elements on the result.

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

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