Rouben Rostamian

MaplePrimes Activity


These are replies submitted by Rouben Rostamian

@one man and @dharr 

In this revised worksheet I have incorporated the improvements suggested by dharr which reduce the time taken by dsolve() from four minutes to 2 seconds(!) and also extra code to calculate the length of the geodesic curve.

Additionally:

  1. I have changed the independent variable in the geodesic's parametrization from the previous u to v.  Now dsolve() works with no extra options.
  2. As noted by one man, there is a second geodesic.  I have added code to calculate the second geodesic which actually is a local maximum of the arc length.  The lengths of the two geodesics agree with those reported by one man.

Here's what the two geodesics look like.  Their lengths are 3.7262 (black curve) and 3.8439.(magenta curve).

Download geodesic-on-rounded-cube2.mw

 

@goebeld Yes, that's also possible.  And if you are going to load the Student:-MultivariateCalculus package, you might as well calculate the norm through Norm(T).  The advantage of the "^+" operator is that it's always avaialble and does not require loading a package.

@goebeld the "^+" applied to a vector or matrix produces the object's transpose.  Therefore, if A and B are column vectors, then A^+ . B is their dot product.  In particular, sqrt(A^+ . A) is the length (that is the Euclidean norm) of the vector A

Alternatively, the dot product and norm can be calculated through dedicated functions in the LinearAlgebra package, as in
LinearAlgebra:-DotProduct(A,B, conjugate=false);
LinearAlgebra:-Norm(A, Euclidean, conjugate=false);

These are too verbose for my taste.  I prefer the "^+" notation.

Aside: There is also the older "^%T" operator for producing the transpose, as in A^%T.  but I have no reason for prefering that over the shorter "^+".

You will need to be more specific regarding "angle in the x-z plane".   That can be (a) angle relative to the x axis, (b) angle relative to the z axis, (c) angle relative to the xz plane.  It also can mean the angle relative to the x or z axes of the vector's projection onto the xz plane.  

There are possibilities beyond those five.  For instance, you may specify a vector through its spherical coordinates (azimuth angle, polar angle, and length).

To remove any ambiguity, it will help if you could provide a concrete example of how you would like to describe a vector by its length and angles.

  1. The title says "3d" but the question says "2d".  Which is it?
  2. What do you mean by "edge coordinates"?
  3. What does it mean to "plot a coordinate"?

@Christian Wolinski That's a very clever combination of map and map2, and does the job well.  Thanks!

@mmcdara You wrote: "The case of spherical coordinates is more complex (read the reference I provided you in y previous reply)".  

In the reference that you have provided, integration in spherical coordinates is made unnecessarily too complicated due to the attempt to integrate with respect to radial direction first and then with respect to the angle.  The solution is simpler if we integrate with respect to the angle first.

@CaptNnFalcon Your English is fine, and being new to Maple is not unusual.  The starting point, hower, is to draw the diagram that I suggested.  Do it by hand, not in Maple.  You can't get started without drawing that diagram.

As this is a homework problem, you are expected to do the work rather than asking others to do it for you.  At least provide some indication of the effort that you have put in toward solving this problem.

Suggestion: If you haven't yet done so, it is essential to draw a good drawing of the intersection of the torus with the y=0 plane.  Mark on the diagram the coordinates of the intersection points with the axes.

@acer I see no point in attempting to optimize OP's "dummy code" (his words) as we don't know what his real application looks like.

But yes, if we want to optimize the dummy code, we call fun just once within the proc, as in F := fun(x,y), and then use F as many times as needed.

@Aleks Here are a couple of different workarounds, in addition to what Preben has suggested.

restart;

A := abs(x*Heaviside(x) + x*Heaviside(-x));

abs(x*Heaviside(x)+x*Heaviside(-x))

A1 := simplify(A);

abs(x)

int(A1, x=-1..1);

1

A2 := convert(A, Heaviside);

2*x*Heaviside(x)-x

int(A2, x=-1..1);

1

Considering that your original question appeared more than a year ago, chances are slim that anyone will notice any updates to that question at this time, unless they happen to be looking under the "Recent Conversations" listing.  That I hardly ever do.

I don't see a harm in your asking the question anew.   It will be a good idea to include a link to your last year's question to remove any chance of confusion or accusations of spamming.  And this time don't wait for six months before you react to an answer.

@Carl Love Thanks for your suggestion.  It had not occurred to me to apply combine().

And here's what we get by just adding the point at [0,0]:

display(
	plot(10 + 1/(x-1)^2, x=0..2, thickness= 3),
	pointplot([0,0], symbol=point)
);

@Preben Alsholm That looks good but I don't see why that is preferable over the much simpler

with(plots):
display(
   plot(10 + 1/(x-1)^2, x=0..2),
   pointplot([0,0], symbol=point)
);

which doesn't fail when there are vertical asymptotes, and avoids the overhead of calls to Optimization:-Minimize and Optimization:-Maximize.

 

3 4 5 6 7 8 9 Last Page 5 of 96