dharr

Dr. David Harrington

9152 Reputation

22 Badges

21 years, 259 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 replies submitted by dharr

@salim-barzani OK, lets take epsilon=1 then I agree with Eq 3.7. I needed W because you can't integrate wrt a function in Maple, i.e. int(..., w(xi__1)) doesn't work.

But as I showed there is no way to transform F to F2, so the integral that gives the arctan result is invalid, and so Eq 3.13 is incorrect, so it will not satisfy the ode. You can perfom the integral with e2 and e0 in (just change the Int to int). The problem is then that you get xi__1 = f(w) but here and in general f(w) has multiple w in, so you cannot easily invert it to get w as a function of xi__1.

The solution to this is to solve the ode in Eq 3.7. dsolve will do this directly, or you could take the square root and integrate. Since you get a general solution it will work for arbitrary e2 and e0. If you want to then find cases that are real for various choices of e2 and e0 you can make assumptions that make the things under the square roots positive.

@salim-barzani Almost there.

@salim-barzani Well if it were changed I might look at it. I have several times pointed out that it makes it harder to help you, and I have ignored several of your recent questions for this reason. In the present case using w instead of r will be especially difficult since the paper uses w later for a different purpose.

I notice that as usual you changed the notation in your worksheet to make it harder to follow the paper. Perhaps you wish to correct that.

@sand15 Sorry; I must have google searched it instead of clicking the link

@sand15 Your second link does not work (not a web address).

@Alfred_F It is a pity that the nice numbers aren't really proven because the maximization works in floating point numbers, so r = 0.749999999968849584 we guess is 3/4, and identify guesses at the exact values of the angles. Possibly by doing the differentiations involved in the gradients involved in the maximization and solving, you could do it all symbolically.

geom3d is a nice package and easily works here for the duals since the radius of the circumsphere and in-sphere are built-in. It has a duality command that I didn't make use of. One limitation, unlike its 2D equivalent geometry, is that the sizes have to be fixed at the time of creation, so you can't have a cube with sides a, where a is a name.

@dharr Yes it works with 3 Euler angles; see updated answer. I should have realized that right away. As usual you have to play around with the initial point.

@Alfred_F If I do the further tilt you describe, I can get 9/16.

cubeoctOptimization2.mw

I suspect I need 3 Euler rotations, so I'll try that and update if it works.

Can't be sure it is a global maximum. [Edit: updated to use Euler angles, which gives a larger maximum than my first attempt.]

restart

with(geom3d); _local(O, gamma)

Let C and O be the cube and octahedron. The cube has sides of length 1. Take the circumsphere of the octahedron to be 1 for now.

point(o, 0, 0, 0); cube(C, o, side = 1); octahedron(O, o, 1)

Rotate the octahedron by Euler angles alpha, beta, gamma.

line(zax, [0, 0, t], t); line(xax, [t, 0, 0], t); rotation(OR, rotation(Ozx, rotation(Oz, O, gamma, zax), beta, xax), alpha, zax)

Scale by r and consider the vertices

verts := map(proc (q) options operator, arrow; `~`[`*`](r, q) end proc, vertices(OR))

[[r*(cos(alpha)*cos(gamma)-sin(alpha)*cos(beta)*sin(gamma)), r*(cos(alpha)*cos(beta)*sin(gamma)+sin(alpha)*cos(gamma)), r*sin(beta)*sin(gamma)], [r*(-cos(alpha)*cos(gamma)+sin(alpha)*cos(beta)*sin(gamma)), r*(-cos(alpha)*cos(beta)*sin(gamma)-sin(alpha)*cos(gamma)), -r*sin(beta)*sin(gamma)], [r*(-cos(alpha)*sin(gamma)-sin(alpha)*cos(beta)*cos(gamma)), r*(cos(alpha)*cos(beta)*cos(gamma)-sin(alpha)*sin(gamma)), r*sin(beta)*cos(gamma)], [r*(cos(alpha)*sin(gamma)+sin(alpha)*cos(beta)*cos(gamma)), r*(-cos(alpha)*cos(beta)*cos(gamma)+sin(alpha)*sin(gamma)), -r*sin(beta)*cos(gamma)], [r*sin(alpha)*sin(beta), -r*cos(alpha)*sin(beta), r*cos(beta)], [-r*sin(alpha)*sin(beta), r*cos(alpha)*sin(beta), -r*cos(beta)]]

The constraints are that each coordinate lies between -1/2 and +1/2, so no vertex "sticks out" of the cube

c1 := `~`[`>=`](`~`[op](verts), -1/2); c2 := `~`[`<=`](`~`[op](verts), 1/2); constr := remove(is, {c1[], c2[]}, true)

{-1/2 <= r*(-cos(alpha)*cos(gamma)+sin(alpha)*cos(beta)*sin(gamma)), -1/2 <= r*(cos(alpha)*cos(gamma)-sin(alpha)*cos(beta)*sin(gamma)), -1/2 <= r*(-cos(alpha)*sin(gamma)-sin(alpha)*cos(beta)*cos(gamma)), -1/2 <= r*(cos(alpha)*sin(gamma)+sin(alpha)*cos(beta)*cos(gamma)), -1/2 <= r*(-cos(alpha)*cos(beta)*cos(gamma)+sin(alpha)*sin(gamma)), -1/2 <= r*(cos(alpha)*cos(beta)*cos(gamma)-sin(alpha)*sin(gamma)), -1/2 <= r*(-cos(alpha)*cos(beta)*sin(gamma)-sin(alpha)*cos(gamma)), -1/2 <= r*(cos(alpha)*cos(beta)*sin(gamma)+sin(alpha)*cos(gamma)), -1/2 <= r*cos(beta), -1/2 <= r*cos(alpha)*sin(beta), -1/2 <= r*sin(alpha)*sin(beta), -1/2 <= r*sin(beta)*cos(gamma), -1/2 <= r*sin(beta)*sin(gamma), -1/2 <= -r*cos(beta), -1/2 <= -r*cos(alpha)*sin(beta), -1/2 <= -r*sin(alpha)*sin(beta), -1/2 <= -r*sin(beta)*cos(gamma), -1/2 <= -r*sin(beta)*sin(gamma), r*(-cos(alpha)*cos(gamma)+sin(alpha)*cos(beta)*sin(gamma)) <= 1/2, r*(cos(alpha)*cos(gamma)-sin(alpha)*cos(beta)*sin(gamma)) <= 1/2, r*(-cos(alpha)*sin(gamma)-sin(alpha)*cos(beta)*cos(gamma)) <= 1/2, r*(cos(alpha)*sin(gamma)+sin(alpha)*cos(beta)*cos(gamma)) <= 1/2, r*(-cos(alpha)*cos(beta)*cos(gamma)+sin(alpha)*sin(gamma)) <= 1/2, r*(cos(alpha)*cos(beta)*cos(gamma)-sin(alpha)*sin(gamma)) <= 1/2, r*(-cos(alpha)*cos(beta)*sin(gamma)-sin(alpha)*cos(gamma)) <= 1/2, r*(cos(alpha)*cos(beta)*sin(gamma)+sin(alpha)*cos(gamma)) <= 1/2, r*cos(beta) <= 1/2, r*cos(alpha)*sin(beta) <= 1/2, r*sin(alpha)*sin(beta) <= 1/2, r*sin(beta)*cos(gamma) <= 1/2, r*sin(beta)*sin(gamma) <= 1/2, -r*cos(beta) <= 1/2, -r*cos(alpha)*sin(beta) <= 1/2, -r*sin(alpha)*sin(beta) <= 1/2, -r*sin(beta)*cos(gamma) <= 1/2, -r*sin(beta)*sin(gamma) <= 1/2}

So we want to maximize r subject to these constraints

ans := Optimization:-Maximize(r, constr, alpha = -Pi .. Pi, gamma = -Pi .. Pi, beta = 0 .. Pi, initialpoint = {alpha = (1/4)*Pi, beta = (1/4)*Pi, gamma = (1/4)*Pi, r = 1})

[.749999999968849584, [alpha = HFloat(0.7853981633974485), beta = HFloat(1.230959417307807), gamma = HFloat(0.7853981633974483), r = HFloat(0.7499999999688496)]]

Evidently r is 3/4, alpha=gamma = Pi/4

identify(eval(alpha, ans[2])); identify(eval(beta, ans[2])); identify(eval(gamma, ans[2]))

(1/4)*Pi

HFloat(1.230959417307807)

(1/4)*Pi

Some further exploration at higher Digits suggests beta = arccos(1/3)

arccos(1/3); evalf(%)

arccos(1/3)

1.230959417

So go back and scale and rotate a new octahedron accordingly

octahedron(O2, o, 3/4); rotation(OR2, rotation(Ozx2, rotation(Oz2, O2, (1/4)*Pi, zax), arccos(1/3), xax), (1/4)*Pi, zax)

draw([C(cutout = .85), OR2])

And the maximum volume is

volume(OR2)

9/16

``

Download cubeoctOptimization2.mw

Even though kernelopts(version) is incorrect, interface(version) correctly reports 2026.1.

@C_R Converting the lprint(%) to 1-D resolves the issue. But I was not able to generate it with a fresh 2026.1 worksheet (I didn't try document mode). But I have a recollection that recently 2D math with % in has not worked consistently. So it might not be to do wth lprint but with % in 2D. Unfortunately I can't get it to not work when I try a few examples. If I come up with one I'll post it here.

You added a second question with the uploaded file instead of editing your own question and uploading the file to it. So I did this for you, moving your file to where it should have been. I then deleted the now redundant question, with the reason "duplicate question" and not "spam", though perhaps the system shows you that.

I am happy to accept donations for my brain upgrade. On the other hand you may wish to delete this post.

Maple's standard diff can differentiate with respect to theta, but not to theta(s). However diff is modified to accept theta(s) when the Physics package is loaded. So with(Physics) solves the error and returns some output, but I don't know if it is what you wanted.

@Mth2026 That download page for the assistant implies that it is not included with Maple Flow but has to be downloaded separately.

1 2 3 4 5 6 7 Last Page 1 of 102