acer

32602 Reputation

29 Badges

20 years, 42 days
Ontario, Canada

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by acer

Are you trying to get something like this?

Here I use to frontend to suppress/freeze the derivatives, while using eliminate on the variable m, and then consider the remaining conditions (implied equations, the second part of what eliminate returns).

restart;

eq1 := -T*sin(theta(t)) = m*(diff(X(t), t, t)
       +L*(diff(theta(t), t, t))*cos(theta(t))
       -L*(diff(theta(t), t))^2*sin(theta(t))):

eq2 := T*cos(theta(t))-m*g = m*(diff(Y(t), t, t)
       +L*(diff(theta(t), t, t))*sin(theta(t))
       +L*(diff(theta(t), t))^2*cos(theta(t))):

K := frontend(eliminate,[{eq1,eq2},{m}],[{`+`,`*`,`=`,set},{}]):

conds := simplify(map(`=`,K[2],0));

{T*(L*(diff(diff(theta(t), t), t))+(diff(diff(X(t), t), t))*cos(theta(t))+sin(theta(t))*(diff(diff(Y(t), t), t)+g)) = 0}

(1)

conds[1]/T;

L*(diff(diff(theta(t), t), t))+(diff(diff(X(t), t), t))*cos(theta(t))+sin(theta(t))*(diff(diff(Y(t), t), t)+g) = 0

(2)

 

Download eliminate_examp.mw

You can substitute for m+F(xi) using freeze and algsubs, and then collect, and then resubstitute using thaw.

You have a variety of ways to simplify, or not, the coefficients (of the m+F(xi) powers). Below I show two ways, one with some simplification.

restart;

T := K+F(xi)*F(xi):

U := alpha[0]+alpha[1]*(m+F(xi))+beta[1]/(m+F(xi))
    +alpha[2]*(m+F(xi))*(m+F(xi))+beta[2]/(m+F(xi))^2:

d := alpha[1]*T-beta[1]*T/(m+F(xi))^2+2*alpha[2]*(m+F(xi))*T
     -2*beta[2]*T/(m+F(xi))^3:

S := (2*alpha[1]*F(xi)-2*beta[1]*F(xi)/(m+F(xi))^2
     +2*beta[1]*(K+F(xi)^2)/(m+F(xi))^3
     +2*alpha[2]*(K+F(xi)^2)+4*alpha[2]*(m+F(xi))*F(xi)
     -4*beta[2]*F(xi)/(m+F(xi))^3
     +6*beta[2]*(K+F(xi)^2)/(m+F(xi))^4)*T:

expand((2*w*k*k)*beta*S-(2*A*k*k)*d-2*w*U+k*U*U):

value(%):

expr := simplify(%):

temp := algsubs(m+F(xi)=freeze(m+F(xi)),numer(expr)):

thaw(collect(temp, freeze(m+F(xi)))/denom(expr));

(k*alpha[2]^2*(m+F(xi))^8+2*k*alpha[1]*alpha[2]*(m+F(xi))^7+(m+F(xi))^6*(2*k*alpha[0]*alpha[2]+k*alpha[1]^2-2*w*alpha[2])+(8*F(xi)^3*beta*k^2*w*alpha[2]+8*K*F(xi)*beta*k^2*w*alpha[2]-4*A*F(xi)^2*k^2*alpha[2]-4*A*K*k^2*alpha[2]+2*k*alpha[0]*alpha[1]+2*k*alpha[2]*beta[1]-2*w*alpha[1])*(m+F(xi))^5+(-2*A*k^2*alpha[1]*K+4*w*k^2*beta*alpha[2]*F(xi)^4+4*w*k^2*beta*alpha[1]*F(xi)^3+(8*K*beta*k^2*w*alpha[2]-2*A*k^2*alpha[1])*F(xi)^2+4*w*k^2*beta*alpha[1]*F(xi)*K+k*alpha[0]^2-2*w*alpha[0]+4*w*k^2*beta*alpha[2]*K^2+2*k*alpha[1]*beta[1]+2*k*alpha[2]*beta[2])*(m+F(xi))^4+(2*k*alpha[0]*beta[1]+2*k*alpha[1]*beta[2]-2*w*beta[1])*(m+F(xi))^3+(-4*w*k^2*beta*beta[1]*F(xi)^3-4*w*k^2*beta*beta[1]*F(xi)*K+2*A*k^2*beta[1]*F(xi)^2+2*A*k^2*beta[1]*K+2*k*alpha[0]*beta[2]+k*beta[1]^2-2*w*beta[2])*(m+F(xi))^2+(4*w*k^2*beta*beta[1]*F(xi)^4-8*w*k^2*beta*beta[2]*F(xi)^3+(8*K*beta*k^2*w*beta[1]+4*A*k^2*beta[2])*F(xi)^2-8*w*k^2*beta*beta[2]*F(xi)*K+4*w*k^2*beta*beta[1]*K^2+2*k*beta[1]*beta[2]+4*A*k^2*beta[2]*K)*(m+F(xi))+12*w*k^2*beta*beta[2]*F(xi)^4+24*w*k^2*beta*beta[2]*K*F(xi)^2+12*w*k^2*beta*beta[2]*K^2+k*beta[2]^2)/(m+F(xi))^4

simplify(% - expr);

0

Numer:=collect(temp, freeze(m+F(xi)),
               uu->collect(uu,[beta,beta[1],beta[2],k,A,w],
                           uuu->factor(uuu))):

new := thaw(Numer/denom(expr));

(k*alpha[2]^2*(m+F(xi))^8+2*k*alpha[1]*alpha[2]*(m+F(xi))^7+((2*alpha[0]*alpha[2]+alpha[1]^2)*k-2*alpha[2]*w)*(m+F(xi))^6+(8*F(xi)*alpha[2]*(K+F(xi)^2)*w*k^2*beta+2*k*alpha[2]*beta[1]-4*alpha[2]*(K+F(xi)^2)*A*k^2+2*k*alpha[0]*alpha[1]-2*w*alpha[1])*(m+F(xi))^5+(4*(K+F(xi)^2)*(F(xi)^2*alpha[2]+K*alpha[2]+alpha[1]*F(xi))*w*k^2*beta+2*k*alpha[1]*beta[1]+2*k*alpha[2]*beta[2]-2*alpha[1]*(K+F(xi)^2)*A*k^2+k*alpha[0]^2-2*w*alpha[0])*(m+F(xi))^4+((2*k*alpha[0]-2*w)*beta[1]+2*k*alpha[1]*beta[2])*(m+F(xi))^3+(-4*F(xi)*(K+F(xi)^2)*w*k^2*beta[1]*beta+k*beta[1]^2+(2*F(xi)^2+2*K)*A*k^2*beta[1]+(2*k*alpha[0]-2*w)*beta[2])*(m+F(xi))^2+((4*(K+F(xi)^2)^2*w*k^2*beta[1]-8*F(xi)*(K+F(xi)^2)*w*k^2*beta[2])*beta+2*k*beta[1]*beta[2]+(4*F(xi)^2+4*K)*A*k^2*beta[2])*(m+F(xi))+12*(K+F(xi)^2)^2*w*k^2*beta[2]*beta+k*beta[2]^2)/(m+F(xi))^4

simplify(expr - new);

0

 

Download collect_freeze.mw

I don't know of a way to accomplish what you want using a legend per se, especially if the font size and dimensions have to be as you have them.

But what about a combination of shorter line segments alongside textplot, inlined into the plot? It's more effort to set up just right, but gives more flexibility to correct for the linestyles. legendwidth.mw

If the expression (dependinng on a, b, and c) has been assigned to the name `expr` then you can create an operator from that with,

f := unapply(expr, [a,b,c]);

 

The assumptions that modify your Int calls -- made using assuming -- don't carry over to the value calls.

Various simplifications can be made on the result of the value or int calls, using the same assumptions, say.

Another possibility is to convert the integrand to expln form prior to using value.

restart

kernelopts(version);

`Maple 2016.2, X86 64 LINUX, Jan 13 2017, Build ID 1194701`

(1)

U1 := `assuming`([Int(ln(r)*sin(k1*Pi*ln(r/Rs)/ln(r4/Rs))/r, r = Rs .. r4)], [Rs > 0, r4 > 0, r4 > Rs, k1::posint])

Int(ln(r)*sin(k1*Pi*ln(r/Rs)/ln(r4/Rs))/r, r = Rs .. r4)

(2)

ans1 := `assuming`([combine(simplify(simplify(combine(evalc(value(U1)))), size))], [Rs > 0, r4 > 0, r4 > Rs, k1::posint])

ln(Rs/r4)*((-1)^k1*ln(r4)+ln(1/Rs))/(k1*Pi)

(3)

`assuming`([value(convert(U1, expln))], [Rs > 0, r4 > 0, r4 > Rs, k1::posint]);

(1/2)*(2*(-1)^(1+k1)*ln(r4)^2*Pi*k1+2*ln(Rs)*ln(r4)*(-1)^k1*Pi*k1+2*ln(Rs)*ln(r4)*Pi*k1-2*ln(Rs)^2*Pi*k1)/(Pi^2*k1^2)

(4)

pars := [Rs = 2, r4 = 1, k1 = 3];

[Rs = 2, r4 = 1, k1 = 3]

 

Int(-ln(r)*sin(3*Pi*ln((1/2)*r)/ln(2))/r, r = 2 .. 1)

 

-0.5097764806e-1

 

-(1/3)*ln(2)^2/Pi

 

-0.5097764806e-1

(5)

U3 := `assuming`([Int(sin(k1*Pi*ln(r/Rs)/ln(r4/Rs))*(r/r4)^(m1*Pi*`τds`/d)/r, r = Rs .. r4)], [Rs > 0, r4 > 0, r4 > Rs, k1::posint, m1::posint, d > 0, `τds` > 0])

Int(sin(k1*Pi*ln(r/Rs)/ln(r4/Rs))*(r/r4)^(m1*Pi*`τds`/d)/r, r = Rs .. r4)

(6)

ans3 := `assuming`([combine(simplify(simplify(combine(evalc(value(U3)))), size))], [Rs > 0, r4 > 0, r4 > Rs, k1::posint, m1::posint, d > 0, `τds` > 0])

d^2*k1*(r4^(m1*Pi*`τds`*ln(Rs^2)/(d*ln(r4/Rs)))*exp(Pi*m1*`τds`*(ln(Rs)^2+ln(r4)^2)/(d*ln(Rs/r4)))-(-1)^k1)*ln(r4/Rs)/(Pi*(ln(Rs)^2*m1^2*`τds`^2+m1^2*`τds`^2*ln(r4)*ln(1/Rs^2)+ln(r4)^2*m1^2*`τds`^2+k1^2*d^2))

(7)

ans3b := `assuming`([numer(ans3)/collect(denom(ans3), m1, proc (u) options operator, arrow; combine(simplify(u, size)) end proc)], [Rs > 0, r4 > 0, r4 > Rs, k1::posint, m1::posint, d > 0, `τds` > 0])

d^2*k1*(r4^(2*m1*Pi*`τds`*ln(Rs)/(d*ln(r4/Rs)))*exp(Pi*m1*`τds`*(ln(Rs)^2+ln(r4)^2)/(d*ln(Rs/r4)))-(-1)^k1)*ln(r4/Rs)/(Pi*`τds`^2*ln(Rs/r4)^2*m1^2+Pi*k1^2*d^2)

(8)

`assuming`([simplify(ans3-ans3b)], [Rs > 0, r4 > 0, r4 > Rs, k1::posint, m1::posint, d > 0, `τds` > 0])

0

(9)

ans3c := `assuming`([simplify(combine(value(simplify(combine(convert(U3, expln))))), size)], [Rs > 0, r4 > 0, r4 > Rs, k1::posint, m1::posint, d > 0, `τds` > 0]):

k1*d^2*ln(Rs/r4)*((-1)^k1-r4^(-m1*Pi*`τds`/d)*Rs^(m1*Pi*`τds`/d))/(Pi*`τds`^2*ln(Rs/r4)^2*m1^2+Pi*k1^2*d^2)

(10)

parsmore := [Rs = 2, r4 = 1, k1 = 3, m1 = 2, d = 1/3, `τds` = 1/4];

-1.786983542

(11)

``

Download integrals_acc.mw

Try this in your Maple 2016, using the name `#msub(mi("n"),mi("r"))` wrapped in a typeset call.

mprime_ac.mw

If you are in (plaintext) 1D Maple Notation mode then you can do it as below.

If you are in 2D Input mode then you can use the Accent palette to insert a typeset c with a circumflex accent. See below for a result.

plot( sin(x), x = 0 .. Pi, size = [600,200],
      labels = [ `#mover(mi("c"),mo("ˆ"))`, y ],
      tickmarks = [[], []], gridlines = false );

plot(sin(x), x = 0 .. Pi, size = [600, 200], labels = [`#mover(mi("c"),mo("ˆ"))`, y], tickmarks = [[], []], gridlines = false)

``

Download accent_label.mw

You can plot the four "roots" versus B (for a single value of V), or you can plot a single root versus B (for, say, multiple values of V).

You can use either solve or (a procedure that calls) fsolve, to evaluate the roots for the values of B.

Note the the individual formulas (any of the four returned by solve, whether explicit or as implicit RootOf) do not necessarily correspond to a (perceived) single one of the connected portions of solution curves in the plot of all roots. The same goes for picking off a particular place in the four roots returned by fsolve. Hopefully the colors illustrate this aspect. There are ways in which sometimes one can track one of the curves, say by picking the closest the previous value found, possibly also tracking yhe slope. Root crossing can be problematic. This is generally tricky on mathematical grounds, not just as a Maple issue.

restart;

gm := V -> 1/sqrt(1-V^2):
T := w-k*V:
S := w*V-k:

f := unapply(I*B*gm(V)^3*T^3+gm(V)^2*T^2
             -I*gm(V)^3*T*S^2-1/3*I*B*gm(V)^3*S^3*T-1/3*gm(V)^2*S^2,
             w,B,V,k):

k:=2:
Vlist:=[1/2, 2, 4]:

Hgen := simplify(rationalize(f(w,B,V,k)));

2*(-V^2+1)^(1/2)*(((-(1/2)*w^2+6)*V^2-4*w*V+(3/2)*w^2-2)*(-V^2+1)^(1/2)+I*(B*w^3*V^3+((-6*B+3)*w^2-12*B)*V^2+(24*B-12)*w*V-3*B*w^2-8*B+12)*(V-(1/2)*w))/(3*V^4-6*V^2+3)

H := simplify(eval(Hgen, V=Vlist[1]));

-(1/27)*3^(1/2)*((-11*w^2+16*w+4)*3^(1/2)+I*(B*w^3+(-36*B+6)*w^2+(96*B-48)*w-88*B+96)*(w-1))

HSols := [solve(numer(H),w,explicit)]:

cols := [red,blue,green,gold]:

H1,H2,H3,H4 := seq(plot([Re,Im](HSols[i]), B=-1.0 .. 1.0,
                        linestyle=[solid, dash], gridlines=false,
                        color=cols[i], title=i),
                   i=1..4):

# plot of multiple roots, for one V value
plots:-display(H1,H2,H3,H4, view=-6..6,
               title=typeset(V=Vlist[1]));

# slower
F:=(B,v,k,i)->fsolve(f(w,B,v,k),w, complex)[i]:
F1,F2,F3,F4 := seq(plot([Re,Im]('F'(B,Vlist[1],k,i)), B=-1.0 .. 1.0,
                        linestyle=[solid, dash], gridlines=false,
                        color=cols[i], title=i),
                   i=1..4):

plots:-display(F1,F2,F3,F4, view=-6..6,
               title=typeset(V=Vlist[1]));

Hgensols := [solve(numer(Hgen),w,explicit)]:
Hgensols := simplify(Hgensols,size) assuming V>0, B::real:

altcols := ["Violet","Orange","Navy"]:

# plot of one root, for multiple V values
plots:-display(
  seq(plot([Re,Im](eval(Hgensols[1], V=Vlist[i])), B=0.0 .. 1.0,
           linestyle=[solid, dash], gridlines=false,
           color=altcols[i], legend=[typeset(V=Vlist[i]), ""]),
      i=1 .. nops(Vlist))
);

 

 

Download rootplot.mw

Just for fun, as it's somewhat obscure and likely not as efficient as the double `seq`. But it's terse, and without dummy names.
restart;
A1:= [a1, a2, a3]:
A2:= [b1, b2]:

map[3](op@zip,`/`,A1,A2);
         
          a1    a2    a3    a1    a2    a3
        [----, ----, ----, ----, ----, ----]
          b1    b1    b1    b2    b2    b2

map[3](op@zip,f,A1,A2);

    [f(a1, b1), f(a2, b1), f(a3, b1), f(a1, b2), f(a2, b2), f(a3, b2)]

Here are three ways it may be accomplished, if I have understood the goal.

odeplots_in_an_Explore_command_ac.mw

(If you feel like some heavier reading you might glance at these two older posts, 1, 2 ).

The result from diff already had the completed square inside the radicals.

with(Typesetting)

Settings(typesetdot = true)

NULL

eq := l = sqrt((d-x(t))^2+h^2)+y(t)

l = ((d-x(t))^2+h^2)^(1/2)+y(t)

a := solve(eq, y(t))

-((d-x(t))^2+h^2)^(1/2)+l

a1 := diff(a, t)

(d-x(t))*(diff(x(t), t))/((d-x(t))^2+h^2)^(1/2)

a2 := diff(a1, t)

(d-x(t))^2*(diff(x(t), t))^2/((d-x(t))^2+h^2)^(3/2)-(diff(x(t), t))^2/((d-x(t))^2+h^2)^(1/2)+(d-x(t))*(diff(diff(x(t), t), t))/((d-x(t))^2+h^2)^(1/2)

collect(a2, diff, proc (u) options operator, arrow; simplify(u, size) end proc)

(d-x(t))*(diff(diff(x(t), t), t))/((d-x(t))^2+h^2)^(1/2)-(diff(x(t), t))^2*h^2/((d-x(t))^2+h^2)^(3/2)

``

Download collect_denominator_ac.mw

Perhaps your would like to use the plots:-logplot command, or the axis options of the plot command.

I prefer kernel builtins over custom-procs, where reasonable.

remove(`=`, EQI__4, 0=0);

And I dislike using has (or hastype) for a targeted job. By this I mean that the stated goal was to remove entries that are 0=0 and not more generally all instances that might occur in subexpressions (even though the supplied example had none such).

Conversion to a set will, in general, remove duplicates as well as possibly reorder the entries. If that's ok (ie. neither of those happens for the given example) then one short syntax is,

[op({EQI__4[]} minus {0=0})]

It is important to note that there will not be a set of steps which will get "whatever form you expect" for all examples.

restart;

 

S:=e->(ee->convert(expand(numer(ee)),sqrfree)
           /convert(expand(denom(ee)),sqrfree))(simplify(expand(rationalize(e)))):

 

expr := (L__b+lambda)^2*(I*sqrt(3)*lambda-2*L__b+lambda)^7
        *(I*sqrt(3)*lambda+2*L__b-lambda)^7
        /(16384*(L__b^2-lambda*L__b+lambda^2)^5*lambda^3);

(1/16384)*(L__b+lambda)^2*(I*3^(1/2)*lambda-2*L__b+lambda)^7*(I*3^(1/2)*lambda+2*L__b-lambda)^7/((L__b^2-L__b*lambda+lambda^2)^5*lambda^3)

 

S(expr);

-(L__b^3+lambda^3)^2/lambda^3

simplify(% - expr);

0

expr2 := -320*L__a/(3*(L__a-lambda)^3*(I*sqrt(3)*lambda+2*L__a+lambda)^3
                    *(I*sqrt(3)*lambda-2*L__a-lambda)^3);

-(320/3)*L__a/((L__a-lambda)^3*(I*3^(1/2)*lambda+2*L__a+lambda)^3*(I*3^(1/2)*lambda-2*L__a-lambda)^3)

S(expr2);

(5/3)*L__a/(L__a^3-lambda^3)^3

simplify(% - expr2);

0

 

Download simpl_example.mw

I could mention that the following produces the same results for these two examples. Of course, messing about with it affects what examples it handles.
R:=e->convert(expand(numer(e))/expand(denom(e)),sqrfree):
R(expr);
R(expr2);

You can use the plotsetup command to send the plotting results to a file.

You can generate the frames of each animation separately (if you aren't already). But rather than displaying them together, use plots:-display on them individually. Before each call to plots:-display, call plotsetup and make the filename (plotputput option) be a contenation of a base string and some counter (using the cat command). The counter could be your loop index, or the frame number.

If you uploaded a worksheet that demonstrated even one of your current animations then it would be possible to show you explicitly.

First 166 167 168 169 170 171 172 Last Page 168 of 339