dharr

Dr. David Harrington

8440 Reputation

22 Badges

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

To get Maple to work this out, turns out to be surprisingly difficult, if you want to avoid inputting things like the cosine rule that you expect Maple to know. Here's a solution. Really, it should be easier.

restart

with(geometry)

assume(n > 2, 2*r > 0)

Define a regular polygon, with size determined by the radius of the circumscribed circle, r.

Turns out it doesn't accept a symbolic n.

RegularPolygon(P, n, point(o, 0, 0), r)

Error, invalid input: geometry:-RegularPolygon expects its 2nd argument, n, to be of type posint, but received n

Oh, well, I guess we have to make it from triangles. Let's define a triangle by side-angle-side, with the angle at the cenre of the polygon.

triangle(T, [r, angle = 2*Pi/n, r])

T

So now we want to find which r value makes the other side = 1.

sides(T); r := solve(%[3] = 1, r, useassumptions)

[r, r, (2*r^2-2*r^2*cos(2*Pi/n))^(1/2)]

1/(2-2*cos(2*Pi/n))^(1/2)

To make any progress we have to define triangles with 3 points.
So make two triangles with a common side of length r, with that side lying along the x-axis, between the origin at the centre of the polygon and point X.
(Actually, we dont need to generate the triagles, just their vertices.)

point(X, [r, 0]); rotation(A, X, 2*Pi/n, clockwise, o); rotation(B, X, 2*Pi/n, counterclockwise, o)
NULL

X

A

B

Find the midpoints, and the distance between them

midpoint(mOA, o, A); midpoint(mOB, o, B); d := simplify(distance(mOA, mOB))

mOA

mOB

cos(Pi/n)

Find the limit

limit(d, n = infinity)

1

NULL

Download polygon.mw

If I trust isolve (?), then there is only one solution, with the tangents 1, 2 and 3. In the figure below tan(A) = 3, tan(B) = 2, tan(C) = 1.

Download tangents.mw

The exponentials are gone in eq22, so it has worked. I assume that after the substitution, the expression with V simplifies so that there is no longer a V.

If fact you can verify this by doing simplify on eq2.

p.s. use indets(eq22,name) to only see the variable names and not more complicated expressions.

@salim-barzani This iterates over all possibilities of mu[1]=0,1;mu[2]=0,1; etc, and is the only way I can make sense of it.

restart

N := 3

3

f0 := exp(add(mu[i]*eta[i], i = 1 .. N)+add(add(mu[i]*mu[j]*B[i, j], i = 1 .. j-1), j = 1 .. N))

exp(B[1, 2]*mu[1]*mu[2]+B[1, 3]*mu[1]*mu[3]+B[2, 3]*mu[2]*mu[3]+eta[1]*mu[1]+eta[2]*mu[2]+eta[3]*mu[3])

mus := Iterator:-BinaryGrayCode(N); muvals := seq({`~`[`=`](seq(mu[i], i = 1 .. N), seq(mui))}, `in`(mui, mus))

_m2021747042624

{mu[1] = 0, mu[2] = 0, mu[3] = 0}, {mu[1] = 1, mu[2] = 0, mu[3] = 0}, {mu[1] = 1, mu[2] = 1, mu[3] = 0}, {mu[1] = 0, mu[2] = 1, mu[3] = 0}, {mu[1] = 0, mu[2] = 1, mu[3] = 1}, {mu[1] = 1, mu[2] = 1, mu[3] = 1}, {mu[1] = 1, mu[2] = 0, mu[3] = 1}, {mu[1] = 0, mu[2] = 0, mu[3] = 1}

add(eval(f0, muval), `in`(muval, muvals))

1+exp(eta[1])+exp(B[1, 2]+eta[1]+eta[2])+exp(eta[2])+exp(B[2, 3]+eta[2]+eta[3])+exp(B[1, 2]+B[1, 3]+B[2, 3]+eta[1]+eta[2]+eta[3])+exp(B[1, 3]+eta[1]+eta[3])+exp(eta[3])

f1 := exp(add(mu[i]*eta[i], i = 1 .. N)+add(add(mu[i]*mu[j]*ln(b[i, j]), i = 1 .. j-1), j = 1 .. N))

exp(mu[1]*eta[1]+mu[2]*eta[2]+mu[3]*eta[3]+mu[1]*mu[2]*ln(b[1, 2])+mu[1]*mu[3]*ln(b[1, 3])+mu[2]*mu[3]*ln(b[2, 3]))

f := simplify(add(eval(f1, muval), `in`(muval, muvals)))

1+exp(eta[1])+b[1, 2]*exp(eta[1]+eta[2])+exp(eta[2])+b[2, 3]*exp(eta[2]+eta[3])+b[1, 2]*b[1, 3]*b[2, 3]*exp(eta[1]+eta[2]+eta[3])+b[1, 3]*exp(eta[1]+eta[3])+exp(eta[3])

Change b[1,2]*b[2,3]*b[1,3] to b[1,2,3], etc.

evalindets(f,`*`,
  proc(term)
    local inds:=indets(term,specindex(b));
    b[op(op~(inds))]*eval(term,inds=~1);
  end proc);

1+exp(eta[1])+b[1, 2]*exp(eta[1]+eta[2])+exp(eta[2])+b[2, 3]*exp(eta[2]+eta[3])+b[1, 2, 3]*exp(eta[1]+eta[2]+eta[3])+b[1, 3]*exp(eta[1]+eta[3])+exp(eta[3])

``

Download formula.mw

In Maple, u[1/2](t) and u[0.5](t) are not the same so you cannot mix them. I changed all the 0.5's to 1/2 and it seems to work now.

error.mw

It's a bug. A workaround is to use

ans := SolveTools:-PolynomialSystem(eqs,
  {p, q, a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], k[1], k[2], k[3], m[1], m[2], m[3]}, explicit)

If I understand correctly, you want to solve the partial differential equation diff(u(x,y,t),t)-diff(u(x,y,t),x)=z. The answer depends on an arbitrary function f__1 at the end. So if you have some boundary or initial conditions you can refine the solution.

restart;

with(PDEtools):

z := 32*delta2^3*(exp((2*a*y*delta2^3 + 2*(x + y + t)^3*(B1 + 2*B2)*delta2^2 + (2*a*delta1^2*y + t)*delta2 + 2*delta1^2*(x + y + t)^3*(B1 + 2*B2))/(delta1^2 + delta2^2)) - exp((-2*a*y*delta2^3 + 4*(B1 + B2/2)*(x + y + t)^3*delta2^2 + (-2*a*delta1^2*y - t)*delta2 + 4*delta1^2*(B1 + B2/2)*(x + y + t)^3)/(delta1^2 + delta2^2)))*a/((delta1^2 + delta2^2)^2*(exp((2*(delta1^2 + delta2^2)*(x + y + t)^3*B2 + 2*delta2*(a*(delta1^2 + delta2^2)*y + t/2))/(delta1^2 + delta2^2)) + exp((2*(delta1^2 + delta2^2)*(x + y + t)^3*B1 - 2*delta2*(a*(delta1^2 + delta2^2)*y + t/2))/(delta1^2 + delta2^2)))^3):

pde:=diff(u(x,y,t),t)-diff(u(x,y,t),x)=z;

diff(u(x, y, t), t)-(diff(u(x, y, t), x)) = 32*delta2^3*(exp((2*a*y*delta2^3+2*(x+y+t)^3*(B1+2*B2)*delta2^2+(2*a*delta1^2*y+t)*delta2+2*delta1^2*(x+y+t)^3*(B1+2*B2))/(delta1^2+delta2^2))-exp((-2*a*y*delta2^3+4*(B1+(1/2)*B2)*(x+y+t)^3*delta2^2+(-2*a*delta1^2*y-t)*delta2+4*delta1^2*(B1+(1/2)*B2)*(x+y+t)^3)/(delta1^2+delta2^2)))*a/((delta1^2+delta2^2)^2*(exp((2*(delta1^2+delta2^2)*(x+y+t)^3*B2+2*delta2*(a*(delta1^2+delta2^2)*y+(1/2)*t))/(delta1^2+delta2^2))+exp((2*(delta1^2+delta2^2)*(x+y+t)^3*B1-2*delta2*(a*(delta1^2+delta2^2)*y+(1/2)*t))/(delta1^2+delta2^2)))^3)

pdsolve(pde,u(x,y,t));

u(x, y, t) = -32*a*((1/2)*exp(2*(y^3+3*(x+t)*y^2+3*(x+t)^2*y+(x+t)^3)*B1-4*(x+y+t)^3*B1)/(exp(2*(x+y+t)^3*B1+2*delta2*x/(delta1^2+delta2^2))+exp(2*(B2*y^3*delta1^2+B2*y^3*delta2^2+3*B2*y^2*delta1^2*(x+t)+3*B2*y^2*delta2^2*(x+t)+3*B2*y*(x+t)^2*delta1^2+3*B2*y*(x+t)^2*delta2^2+B2*(x+t)^3*delta1^2+B2*(x+t)^3*delta2^2+2*y*a*delta1^2*delta2+2*a*y*delta2^3+delta2*(x+t))/(delta1^2+delta2^2)))-(1/4)*(exp(2*(y^3+3*(x+t)*y^2+3*(x+t)^2*y+(x+t)^3)*B1)+exp(2*(x+y+t)^3*B1))*exp(2*(B2*y^3*delta1^2+B2*y^3*delta2^2+3*B2*y^2*delta1^2*(x+t)+3*B2*y^2*delta2^2*(x+t)+3*B2*y*(x+t)^2*delta1^2+3*B2*y*(x+t)^2*delta2^2+B2*(x+t)^3*delta1^2+B2*(x+t)^3*delta2^2+2*y*a*delta1^2*delta2+2*a*y*delta2^3+delta2*(x+t))/(delta1^2+delta2^2)-4*(x+y+t)^3*B1)/(exp(2*(x+y+t)^3*B1+2*delta2*x/(delta1^2+delta2^2))+exp(2*(B2*y^3*delta1^2+B2*y^3*delta2^2+3*B2*y^2*delta1^2*(x+t)+3*B2*y^2*delta2^2*(x+t)+3*B2*y*(x+t)^2*delta1^2+3*B2*y*(x+t)^2*delta2^2+B2*(x+t)^3*delta1^2+B2*(x+t)^3*delta2^2+2*y*a*delta1^2*delta2+2*a*y*delta2^3+delta2*(x+t))/(delta1^2+delta2^2)))^2)*delta2^2*exp(2*delta2*(x+t)/(delta1^2+delta2^2)+4*a*y*delta2^3/(delta1^2+delta2^2)+4*y*a*delta1^2*delta2/(delta1^2+delta2^2)+2*B1*y^3*delta1^2/(delta1^2+delta2^2)+2*B1*y^3*delta2^2/(delta1^2+delta2^2)+6*B1*y^2*delta1^2*(x+t)/(delta1^2+delta2^2)+6*B1*y^2*delta2^2*(x+t)/(delta1^2+delta2^2)+6*B1*y*(x+t)^2*delta1^2/(delta1^2+delta2^2)+6*B1*y*(x+t)^2*delta2^2/(delta1^2+delta2^2)+2*B1*(x+t)^3*delta1^2/(delta1^2+delta2^2)+2*B1*(x+t)^3*delta2^2/(delta1^2+delta2^2)+2*B2*y^3*delta1^2/(delta1^2+delta2^2)+2*B2*y^3*delta2^2/(delta1^2+delta2^2)+6*B2*y^2*delta1^2*(x+t)/(delta1^2+delta2^2)+6*B2*y^2*delta2^2*(x+t)/(delta1^2+delta2^2)+6*B2*y*(x+t)^2*delta1^2/(delta1^2+delta2^2)+6*B2*y*(x+t)^2*delta2^2/(delta1^2+delta2^2)+2*B2*(x+t)^3*delta1^2/(delta1^2+delta2^2)+2*B2*(x+t)^3*delta2^2/(delta1^2+delta2^2))/(delta1^2+delta2^2)+f__1(y, x+t)

``

NULL

Download pdsolve.mw

Here is one way. pointplot has options to control the shape and size of the point. display is used for combining two or more plots. Notice the with(plots) at the beginning. I'm not sure what you mean by "plotting the distance".

 

with(Student:-Precalculus); with(plots)

with(Plot)

a := [1, 3]

b := [5, 6]

Distance(a, b)

5

mp := Midpoint(a, b)

[3, 9/2]

Line(a, b)

y = (3/4)*x+9/4, 3/4, 9/4, -3

Lplot := Line(a, b, output = plot); display(Lplot, pointplot(mp, symbolsize = 12, symbol = solidcircle, color = blue))

 

 

Download How-to-plot-distance-midpoint.mw

For numerical use (not necessarily for plotting), plottools:-rotate rotates an nx3 Array (datatype=float[8]) of points if you enclose it in a CURVES or POLYGONS call. I'm assuming the alpha, beta, gamma are the Euler angles, or closely related. (I've only actually used the other form of plottools:-rotate where you specify 2 points on the rotation axis and one angle.)

Download Euler.mw

This is the same problem as before; perhaps you did not read my response here.

The 19 equations don't have a solution in those variables. You could change variables or use a smaller set of equations, e.g.,

solve(eqs1[1 .. 14], {a[0], a[1], a[2], a[3], a[4], e[1], k[1], n[1], p[1]});

returns solutions.

Y is already used for something else.

N-soliton.mw

In eq5, you are missing a multiplication between the c and the (. Use a space, or better, a * for multiplication. Here c(...) is being interpreted an an unknown function named c, which solve doesn't know anything about.

maple_code_for_disease_equilibruim.mw

To add to @acer's answer, operators with names starting with & automatically are displayed as infix operators. (See the help page ?neutral.) So using &T instead of T will work, though it will display with the &. If you also want it to have a nice symbol output, choose one of the HTML codes that start with "&" and end with ";" (but not in the `&#...;` form; use the entity form). You are probably familiar with these. Many of the symbols on the operator palette are of this form. For example, I like to use

`⊗` := LinearAlgebra:-KroneckerProduct;

and use the palette in 2D input to easily input

On the main page for the app there is an "Attachment" link, separate from the "Download" link, which has a zip file with the library files, called "maple.hdb", "maple.ind" and "maple.lib" files, which comprise the package.

First 8 9 10 11 12 13 14 Last Page 10 of 83