dharr

Dr. David Harrington

8455 Reputation

22 Badges

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

I didn't submit this earlier since I had the same problem that @Rouben Rostamian had. But if you assume that it doesn't start at rest, but is given an initial finite y-component of the velocity, then you can derive the semicubical parabola.
 

restart

Solve isochrone problem (solution is Neile's semicubical parabola).

We start a mass m at positive coordinates (x__0, y__0) with x component of velocity zero and y component of velocity -v__y and let it move toward the origin under the action of gravity along some curve for which the y (height) coordinate changes by equal amounts in equal times. What is the curve?

 

Solution. Run the problem backwards. At time zero, let the mass leave the origin with velocity components v__x(0) = v__0 and v__y. The problem statement means that v__y is constant.

Let t be the time the particle arrives at coordinates (x,y), so we know y = v__y*t

yt := v__y*t;

v__y*t

At time zero, there is only kinetic energy

E__0 := (1/2)*m*(v__0^2+v__y^2);

(1/2)*m*(v__0^2+v__y^2)

At time t, the energy must be the same

eq := E__0 = (1/2)*m*(v__x^2+v__y^2)+m*g*v__y*t

(1/2)*m*(v__0^2+v__y^2) = (1/2)*m*(v__x^2+v__y^2)+m*g*v__y*t

So the x component of the velocity as a function of time is

vt__x := solve(eq, v__x)[1];

(-2*g*t*v__y+v__0^2)^(1/2)

And this will be zero at time t__0, after which the problem doesn't make sense

t__0 := solve(vt__x, t);

(1/2)*v__0^2/(g*v__y)

So the x coordinate is

xt := `assuming`([int(vt__x, t = 0 .. t)], [v__0::positive]);

-(1/3)*((-2*g*t*v__y+v__0^2)^(3/2)-v__0^3)/(g*v__y)

x__0 := eval(xt, t = t__0);

(1/3)*v__0^3/(g*v__y)

And the y coordinate at the end is

y__0 := v__y*t__0;

(1/2)*v__0^2/g

Eliminate t to get y(x)

ans := solve({x = xt, y = yt}, {t, y}, explicit)[1];

{t = -(1/2)*((-3*g*v__y*x+v__0^3)^(2/3)-v__0^2)/(g*v__y), y = -(1/2)*((-3*g*v__y*x+v__0^3)^(2/3)-v__0^2)/g}

This is a shifted form of the semicubical parabola.

simplify(eval((y-y__0)^3/(x-x__0)^2, ans));

-(9/8)*v__y^2/g

NULL

 

Download Niele.mw

Edit: The conclusion is that to get the conventional form, take (x0,y0) at the origin, which means to take v0 =0, as deduced by Rouben. A more straightforward way rather than going backwards is here:

Niele2.mw

cos(t) goes to zero, meaning 2/cos(t) goes to infinity. So restrict the range with coordinateview. The answer is a vertical line, as you said.
 

plots:-polarplot(2/cos(t), t = 0 .. 2*Pi,coordinateview=[0..6,0..2*Pi],color=red)

``

 

Download polarplot.mw

Not clear exactly how efficient it needs to be. The straightforward way is just to tell sort how to order them.

Download norm.mw

Edit: A one pass using selectremove is more efficient since you are not sorting them all

Download selectremove.mw

PDE:=diff(u(x,t),t)+diff(conjugate(u(x,t)),x)

is correct Maple syntax.

(ans on Mapleprimes doesn't show all the content in the worksheet.)

restart;

f := 2*y^3*z - y^2 -2*m;

2*y^3*z-y^2-2*m

ans:=solve(f,y,parametric,real);

ans := piecewise(And(z = 0, m = 0), [[y = 0]], And(z = 0, m < 0), [[y = sqrt(-2*m)], [y = -sqrt(-2*m)]], And(0 < z, m = 0), [[y = 0], [y = 1/(2*z)]], And(0 < z, m = -1/(54*z^2)), [[y = -1/(6*z)], [y = 1/(3*z)]], And(0 < z, 0 < m), [[y = RootOf(2*_Z^3*z-_Z^2-2*m, index = real[1])]], And(0 < z, m < -1/(54*z^2)), [[y = RootOf(2*_Z^3*z-_Z^2-2*m, index = real[1])]], And(z < 0, m = 0), [[y = 0], [y = 1/(2*z)]], And(z < 0, m = -1/(54*z^2)), [[y = -1/(6*z)], [y = 1/(3*z)]], And(z < 0, 0 < m), [[y = RootOf(2*_Z^3*z-_Z^2-2*m, index = real[1])]], And(z < 0, m < -1/(54*z^2)), [[y = RootOf(2*_Z^3*z-_Z^2-2*m, index = real[1])]], And(0 < z, -1/(54*z^2) < m, m < 0), [[y = RootOf(2*_Z^3*z-_Z^2-2*m, index = real[1])], [y = RootOf(2*_Z^3*z-_Z^2-2*m, index = real[2])], [y = RootOf(2*_Z^3*z-_Z^2-2*m, index = real[3])]], And(z < 0, -1/(54*z^2) < m, m < 0), [[y = RootOf(2*_Z^3*z-_Z^2-2*m, index = real[1])], [y = RootOf(2*_Z^3*z-_Z^2-2*m, index = real[2])], [y = RootOf(2*_Z^3*z-_Z^2-2*m, index = real[3])]], [])

So there are two cases that give three real roots. Let's try the case with And(z < 0, -1/(54*z^2) < m, m < 0)

And(z < 0, -(1/54)/z^2 < m, m < 0)

mz:={m=-1/2,z=-1/20};

{m = -1/2, z = -1/20}

is(eval((And(z<0, -1/(54*z^2) < m, m < 0)),mz));

true

ans1:=eval(ans,mz);
evalf(ans1);

[[y = RootOf(_Z^3+10*_Z^2-10, index = real[1])], [y = RootOf(_Z^3+10*_Z^2-10, index = real[2])], [y = RootOf(_Z^3+10*_Z^2-10, index = real[3])]]

[[y = -9.897926849], [y = -1.057474507], [y = .9554013566]]

Symbolic

map(x->convert(value(rhs(x[])),radical),ans1);

[-(1/6)*(-865+(15*I)*1119^(1/2))^(1/3)-(50/3)/(-865+(15*I)*1119^(1/2))^(1/3)-10/3+((1/2)*I)*3^(1/2)*((1/3)*(-865+(15*I)*1119^(1/2))^(1/3)-(100/3)/(-865+(15*I)*1119^(1/2))^(1/3)), -(1/6)*(-865+(15*I)*1119^(1/2))^(1/3)-(50/3)/(-865+(15*I)*1119^(1/2))^(1/3)-10/3-((1/2)*I)*3^(1/2)*((1/3)*(-865+(15*I)*1119^(1/2))^(1/3)-(100/3)/(-865+(15*I)*1119^(1/2))^(1/3)), (1/3)*(-865+(15*I)*1119^(1/2))^(1/3)+(100/3)/(-865+(15*I)*1119^(1/2))^(1/3)-10/3]

NULL

 

Download CubicSolve.mw

The plot structure is hard to modify, but if you get the graph from SubgroupLattice, then you can use RelabelVertices from the GraphTheory package. The problem is that the vertex labels need to be unique. One way is to add the GroupOrder in parentheses after the original label.

 graphs.mw

Here is another way. [Edit: LinearAlgebra is for RandomMatrix and Copy only, but copy (not in LinearAlgebra) will also work.]

restart

with(LinearAlgebra):

A := RandomMatrix(3, 3); B := RandomMatrix(3, 3)

A := Matrix(3, 3, {(1, 1) = 27, (1, 2) = 99, (1, 3) = 92, (2, 1) = 8, (2, 2) = 29, (2, 3) = -31, (3, 1) = 57, (3, 2) = -76, (3, 3) = -32})

B := Matrix(3, 3, {(1, 1) = 57, (1, 2) = -76, (1, 3) = -32, (2, 1) = 27, (2, 2) = -72, (2, 3) = -74, (3, 1) = -93, (3, 2) = -2, (3, 3) = -4})

Replace last row of A with first row of B (A is changed)

A[3, () .. ()] := B[1, () .. ()]; A

Matrix([[27, 99, 92], [8, 29, -31], [57, -76, -32]])

Replace the last row of A with second row of B with result in C

C := Copy(A); C[3, () .. ()] := B[2, () .. ()]; C

Matrix([[27, 99, 92], [8, 29, -31], [27, -72, -74]])

``

 

Download Rowsubs.mw

plot(F(R), R = 0 .. 100) is correct and works for me. You seemed to have some extra character in that line.

How_to_plot_IR.mw

The discriminant is negative for arbitrary values of the a[i,j], so the roots are usually complex (edit: for real a[i,j]). But for values that make the disciminant zero, you will get two equal real roots. (@tomleslie left off a term of your expression).
 

z := k^2*a[1, 1]^2+k^2*b[1, 1]^2+4*k*a[0, 2]*a[1, 1]+4*k*b[0, 2]*b[1, 1]+4*a[0, 2]^2+4*b[0, 2]^2

k^2*a[1, 1]^2+k^2*b[1, 1]^2+4*k*a[0, 2]*a[1, 1]+4*k*b[0, 2]*b[1, 1]+4*a[0, 2]^2+4*b[0, 2]^2

ans := [solve(z, k)];

[2*(I*a[0, 2]*b[1, 1]-I*a[1, 1]*b[0, 2]-a[0, 2]*a[1, 1]-b[0, 2]*b[1, 1])/(a[1, 1]^2+b[1, 1]^2), -2*(I*a[0, 2]*b[1, 1]-I*a[1, 1]*b[0, 2]+a[0, 2]*a[1, 1]+b[0, 2]*b[1, 1])/(a[1, 1]^2+b[1, 1]^2)]

The discriminant "b^2-4*a*c" can be factored, so the square root disappears. But it is negative, so the roots are complex, unless the discriminant becomes zero

discrim(z, k);

-16*a[0, 2]^2*b[1, 1]^2+32*a[0, 2]*a[1, 1]*b[0, 2]*b[1, 1]-16*a[1, 1]^2*b[0, 2]^2

-16*(a[0, 2]*b[1, 1]-a[1, 1]*b[0, 2])^2

realvals := {a[0, 2] = 1, a[1, 1] = 1, b[0, 2] = 2, b[1, 1] = 2}

{a[0, 2] = 1, a[1, 1] = 1, b[0, 2] = 2, b[1, 1] = 2}

eval(discrim(z, k), realvals);

0

eval(ans, realvals);

[-2, -2]

``


 

Download discrim.mw

The syntax is solve({eq1,eq2,...},{var1,var2,...}). You don't seem to have collected the equations and variables in sets (or lists). Use fsolve if you want a numerical solution. In general, uploading your worksheet (green up-arrow) is helpful for us to diagnose your problem.

If dat is your matrix, then plot(dat) will work. You can add various plot options for label fonts etc.

plot.mw

restart

Need specific N value to make progress.

N := 5

5

eq := add(alpha[n]*kappa^n*n, n = 0 .. N)^2+add(beta[n]*kappa^n*n, n = 0 .. N)^2

(5*kappa^5*alpha[5]+4*kappa^4*alpha[4]+3*kappa^3*alpha[3]+2*kappa^2*alpha[2]+kappa*alpha[1])^2+(5*kappa^5*beta[5]+4*kappa^4*beta[4]+3*kappa^3*beta[3]+2*kappa^2*beta[2]+kappa*beta[1])^2

Symbolically can find the zero root, but will need specific values of alpha and beta to get more

solve(eq, kappa);

0, 0, RootOf((25*alpha[5]^2+25*beta[5]^2)*_Z^8+(40*alpha[4]*alpha[5]+40*beta[4]*beta[5])*_Z^7+(30*alpha[3]*alpha[5]+16*alpha[4]^2+30*beta[3]*beta[5]+16*beta[4]^2)*_Z^6+(20*alpha[2]*alpha[5]+24*alpha[3]*alpha[4]+20*beta[2]*beta[5]+24*beta[3]*beta[4])*_Z^5+(10*alpha[1]*alpha[5]+16*alpha[2]*alpha[4]+9*alpha[3]^2+10*beta[1]*beta[5]+16*beta[2]*beta[4]+9*beta[3]^2)*_Z^4+(8*alpha[1]*alpha[4]+12*alpha[2]*alpha[3]+8*beta[1]*beta[4]+12*beta[2]*beta[3])*_Z^3+(6*alpha[1]*alpha[3]+4*alpha[2]^2+6*beta[1]*beta[3]+4*beta[2]^2)*_Z^2+(4*alpha[1]*alpha[2]+4*beta[1]*beta[2])*_Z+alpha[1]^2+beta[1]^2)

Choose some specific values

vals := zip(`=`, [seq(alpha[n], n = 0 .. N), seq(beta[n], n = 0 .. N)], [seq((rand(-3 .. 3))(), i = 1 .. 2*N+2)])

[alpha[0] = -1, alpha[1] = 2, alpha[2] = 2, alpha[3] = 0, alpha[4] = 2, alpha[5] = 2, beta[0] = 2, beta[1] = -3, beta[2] = 0, beta[3] = -2, beta[4] = -3, beta[5] = 1]

eq2 := eval(eq, vals)

(10*kappa^5+8*kappa^4+4*kappa^2+2*kappa)^2+(5*kappa^5-12*kappa^4-6*kappa^3-3*kappa)^2

ans := solve(eq2, kappa);

0, 0, RootOf(125*_Z^8+40*_Z^7+148*_Z^6+224*_Z^5+110*_Z^4+104*_Z^3+52*_Z^2+16*_Z+13, index = 1), RootOf(125*_Z^8+40*_Z^7+148*_Z^6+224*_Z^5+110*_Z^4+104*_Z^3+52*_Z^2+16*_Z+13, index = 2), RootOf(125*_Z^8+40*_Z^7+148*_Z^6+224*_Z^5+110*_Z^4+104*_Z^3+52*_Z^2+16*_Z+13, index = 3), RootOf(125*_Z^8+40*_Z^7+148*_Z^6+224*_Z^5+110*_Z^4+104*_Z^3+52*_Z^2+16*_Z+13, index = 4), RootOf(125*_Z^8+40*_Z^7+148*_Z^6+224*_Z^5+110*_Z^4+104*_Z^3+52*_Z^2+16*_Z+13, index = 5), RootOf(125*_Z^8+40*_Z^7+148*_Z^6+224*_Z^5+110*_Z^4+104*_Z^3+52*_Z^2+16*_Z+13, index = 6), RootOf(125*_Z^8+40*_Z^7+148*_Z^6+224*_Z^5+110*_Z^4+104*_Z^3+52*_Z^2+16*_Z+13, index = 7), RootOf(125*_Z^8+40*_Z^7+148*_Z^6+224*_Z^5+110*_Z^4+104*_Z^3+52*_Z^2+16*_Z+13, index = 8)

evalf([ans]);

[0., 0., .2359930256+.5296052631*I, .4481955872+1.141969704*I, -.1028659271+.6003394077*I, -.7413226857+0.6729615150e-1*I, -.7413226857-0.6729615150e-1*I, -.1028659271-.6003394077*I, .4481955872-1.141969704*I, .2359930256-.5296052631*I]

fsolve(eq2, complex);

-.741322685659808-0.672961515020724e-1*I, -.741322685659808+0.672961515020724e-1*I, -.102865927127570-.600339407715825*I, -.102865927127570+.600339407715825*I, 0., 0., .235993025621495-.529605263094995*I, .235993025621495+.529605263094995*I, .448195587165883-1.14196970387710*I, .448195587165883+1.14196970387710*I

``

Download solve.mw

Correct syntax is GroupOrder(ds[2]);

I agree; it's a bug. The coefficients are the same since simplify(c1(n)-c2(n)) assuming n::integer; returns zero. The fhat1 sum isn't evaluated correctly, but if sum is replaced by Sum, then (at least in Maple 2015), evalf(eval(fhat1,x=0.9)); returns 0.451026812 as expected.

Order is important, so use lists, not sets

A:=[seq([a[m],b[m],c[m]],m=0..4)];

[[a[0], b[0], c[0]], [a[1], b[1], c[1]], [a[2], b[2], c[2]], [a[3], b[3], c[3]], [a[4], b[4], c[4]]]

B:=[i,j,k];

[i, j, k]

map(x->add(x*~B),A);

[i*a[0]+j*b[0]+k*c[0], i*a[1]+j*b[1]+k*c[1], i*a[2]+j*b[2]+k*c[2], i*a[3]+j*b[3]+k*c[3], i*a[4]+j*b[4]+k*c[4]]

``

Download vecs.mw

First 43 44 45 46 47 48 49 Last Page 45 of 83