dharr

Dr. David Harrington

8482 Reputation

22 Badges

21 years, 34 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

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

You can replace the assumption by another assumption (including "anything", which is no assumption), but I don't think there is an unassume feature, which I think is what you are asking about. Edit: Not correct - see @Preben Alsholm's correct answer.

restart

A := Omega:

true

The following removes the tilde but not the assumption

B := 'Omega';

Omega

true

Replace the assumption by something else

assume(Omega::anything);

is(B > 0);

false

B;

Omega

``

 

Download assumetest.mw

If you set Digits:=20, then the last values in the sequence will be 4. In approximate arithmetic, at some point x and x+1 have the same approximation, and then the difference in the logs will be zero.

[1$5] gives [1,1,1,1,1]

In general, one does not find the inverse of a matrix if it is only required as an internediate step. If the vector you are going to premultiply with is x^t, and the result is y^t, then (treating x as a column vector so x^t is a row vector):

y^t = x^t.M^(-1)

y^t.M = x^t

M^t.y = x

M.y = x (symmetric)

So LinearSolve(M,x) gives y.

It is better to do the LinearSolve with simple symbolic entries, then substitute in the complicated ones. You will need to add your required x[1], x[2], x[3] to vals:

mat.mw

Edit: in your extended document the vector x is S2 or S3, and you have some further calculations. I updated your document to complete the calculations in document mode here. The results are very long; remove the colons to see them. Simplifying is slow but reduces the size by a factor of 3.

matrix_inverse_3.mw

or as a worksheet:

matrix_inverse_3w.mw

indets(expr,name) will do this. There are various refinements depending on whether you want to include Pi and other named constants or just variables or what you want to do with subscripted symbols.
 

s := a*exp(x[1])*Pi;

a*exp(x[1])*Pi

indets(s);

{a, x[1], exp(x[1])}

indets(s, name);

{Pi, a, x[1]}

indets(s, assignable(name));

{a, x[1]}

indets(s, symbol);

{Pi, a}

``

 

Download indets.mw

odeplot can plot expressions involving the numerical answer. Assuming a,b, and c are numbers and sol is the output from dsolve, then

plots:-odeplot(sol, [x,a*u1(x)+b*u2(x)+c*u3(x)],0..5)

where 0..0.5 is the range of x to solve and plot over.

ans1[12..14,3] is an Array with three plots. So you can get the 200x2 Matrix contents for each; combine them into a 200x6 Matrix, and then select the columns that you want, which I assume are 1 (x values?), 2, 4, 6 (three sets of y values?). So the following gives what I think you want:

ExcelTools:-Export(Matrix([seq(op([1,1],ans1[12..14,3][i]),i=12..14)])[..,[1,2,4,6]]);
First 40 41 42 43 44 45 46 Last Page 42 of 83