Carl Love

Carl Love

28050 Reputation

25 Badges

12 years, 336 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are replies submitted by Carl Love

Both in standard algebra terminology and in Maple, simplifying and solving are separate operations with distinct targets. One simplifies expressions and only expressions; one solves equations and inequalities or sets of them.

Maple relaxes those target restrictions a tiny bit:

  • Simplifying an equation simplifies its two sides separately;
  • Solving an expression is treated as solving the equation formed by setting it to 0.

@vs140580 If you don't care about multiplicities, then using sets would be the best way, and it's trivial to code:

evalb({L2[]} subset {L1[]})

I gave a detailed response 2 weeks ago (it's below) explaining 4 possible reasons for the slowness and 3 possible ways to speed things up. You've given no response about whether they helped or even whether you read them.

I did this without being able to see the procedures/functions that you've defined that are in the integrand.

@AHSAN Ah. The English word that you mean in place of "desire" is "resolution" (in its technical sense related to displayed graphics).

@Christian Wolinski Although your Answer "works" in a limited sense in this case, it may give the user the wrong impression that square brackets can in general be used instead of algebraic parentheses as long as one uses expand afterwards. That's not true in the vast majority of cases. 

@C_R The options that I used are documented on the pages ?plot,axis, ?plot,tickmarks, and ?plot,typesetting.

@Fereydoon_Shekofte I don't see the connection. The matrices in this Question don't have any arithmetic properties, their entries aren't necessarily numbers, they aren't necessarily square matrices, and only rowwise, not columnwise, properties are considered.

@planetmknzm 

Let's say that you've plotted 2 spacecurves (on the unit sphere) and extracted their data arrays as explained at the beginning of this thread. Let's say those arrays are A1 and A2. The following code will give you the (arbitrary number; use however many you want) pairs of indices [i, j] such that the angle between A1[i] and A2[j] is as close to 30 degrees as can be achieved with the discrete (i.e., finite) number of points:

COS:= evalf(cos(30*(Pi/180))): #cos(30 degrees)
[lhs]~(sort([op(2, abs~(A1.A2^%T -~ COS))[]], key= rhs))[..9];
   [[178, 187], [14, 23], [62, 121], [80, 139], [65, 127],
    [74, 136], [15, 191], [10, 186], [29, 39]]

#Check angle of 1st pair:
arccos(A1[178].A2[187]^%T)*evalf(180/Pi);
                          30.00128868


The above computation takes 0.7 seconds on my computer.

I don't know if you've upgraded your Maple yet. Depending on your version, the key option to sort may not work. If that's the case, I can give you an easy workaround.

 

@planetmknzm Which are these scenarios is closest to your situation?

  1. You have a finite list or set of points on the sphere, let's say the points generated for the 2 space curves. You want all pairs of these points that are close to 30 degrees apart.
  2. You have a finite list or set of points on the sphere, the points generated for the 2 space curves. You want all pairs of these points that are close to 30 degrees apart containing 1 point from each curve.
  3. You have two curves that can be parameterized by a real parameter, let's say C1(t) and C2(s). Given a particular value of t, you want to find a value or values of s such that C1(t) and C2(s) are exactly 30 degrees apart.

Options 1 and 2 are crude. I would only use them if I couldn't get the curves continuously parameterized.

@vv Thanks for the correction.

@planetmknzm Given two points on the unit sphere, the central angle (angle at the origin) between them is the arccos of their dot product. If the points are represented as lists P and Q, that's 

arccos(<P>^%T  . <Q>)

There is no picture attached to your Question.

If you have a Maple worksheet, it'd be more helpful if you uploaded that. Use the green up arrow on the toolbar.

@planetmknzm Thank you. I finished the explanation. Let me know if you have any questions.

@planetmknzm 

The geometric simplicity of the surfaces being plotted allows some of the commands that I used to become deceptively simple. The first such simplicity is:

  • Given a point on a sphere centered at the origin, if is viewed as a vector v, then v is a normal vector to the sphere at and hence also a normal vector to the plane tangent to the sphere at P.

I'll detail the other simplicity later.

Let's look at the details of an animate command:

plots:-animate(PP, [A(t)], t= a..b, frames= n)

  • PP is a procedure that returns a plot.
  • A(t) is the arguments to PP parameterized by t.
  • a and b are real numbers, the range of values for t.
  • frames is a keyword, i.e., it appears literally.
  • n is a positive integer, the number of evenly spaced values of t that'll be used.

My animate command was 

plots:-animate(Plane, [C(t)], t= -Pi..Pi, frames= 100, background= Static)

C(t) is my command that generates points on the curve on the sphere. So, 100 such points are passed to Plane. Each point is a list of three real numbers.

Now let's look at Plane:

Plane:= proc(P)
local v:= <P>^%T, B:= LinearAlgebra:-NullSpace(v)^~%T;
    plots:-polygonplot3d(<v+B[1], v+B[2], v-B[1], v-B[2]>)
end proc

A list can be turned into a column vector by enclosing it in angle brackets: <P>. The transpose operator ^%T converts column vectors into row vectors and vice versa. So, v is a row vector, the normal vector of the plane. The distinction between lists, column vectors, and row vectors is of very little mathematical significance; these conversions are just for syntactic reasons.

When NullSpace is passed a row vector v, it returns a basis for the subspace of vectors that are orthogonal to v. In this case, that means the vectors in the tangent plane. The basis is returned as a set of column vectors. I want them to be row vectors for the next command. By adding the elementwise symbol to the transpose operator ^%T (so that the operator is now ^~%T), the entire set is converted to row vectors. So is now a set of 2 row vectors orthogonal to v.

Now here is the second hidden simplifying detail:

  • The NullSpace command returns an orthonormal basis, that is, the basis vectors are orthogonal to each other and they have length 1.

So, adding and subtracting the basis vectors to the point of tangency gives the four corners of a square. That square has diagonal length 2, thus side length sqrt(2). This seemed to be a good size for the animated squares, but you could change it by multiplying the vectors in B by a scaling factor.

The command polygonplot3d accepts a three-column matrix each row of which represents a vertex of the polygon. (The rows are viewed as points, not vectors.) The angle bracket syntax <............stacks the row vectors into a column, which is the same thing as a matrix.

@Ronan In the following example, note how the invisible function application operator distributes over the comma sequencing operator between the f and g:

(f,g)(x,y);
                       
f(x, y), g(x, y)

First 84 85 86 87 88 89 90 Last Page 86 of 709