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 answers submitted by Carl Love

My first Reply above was a result of my being thrown off track by your inappropriate use of the word "group", which has a precise mathematical definition. And then I thought that you were looking for a minimal set of generators of the group.

From your followup Reply, and also from VV's clarifying comment, I know that you're looking for a basis (a minimal set of generators) of the subspace of F^(2x2) spanned (or generated) by your given set of matrices, where F is any field containing all of the matrix entries that you present. A basis can be extracted as a one-liner:

map2(Matrix, 2, convert~(LinearAlgebra:-Basis(convert~(S, Vector)), list))^~ %T;

where S is the given set of matrices.

Note that a basis never contains the zero element, which is considered to be generated by the empty set. You'll just need to put that back into the set if you want it there.

Answering the question that is somewhat implied by your title: The set operations for sets with vector (not group) elements that you're looking for are (essentially) Basis, SumBasis, IntersectionBasisRowSpaceColumnSpace, and NullSpace (all in LinearAlgebra), but you'll often need to do some fiddling with convert, etc., to get things into the correct format.

Great example. Vote up.

The output's ordering and signage depends on the changing variable's lexicographic order with respect to x0. The y and z come after x0 and all your other changing variables come before x0. The ordering of the the terms in the argument to ln appears to be lexicographic, and the signage (but not the order) of the argument to arctan also depends the variables' lexicographic order. The difference between ln and arctan is, as Tom Leslie notes, that arctan is an odd function. So arctan can do this manipulation. I don't know what purpose it serves to actually do it. The code at showstat(arctan) is fairly brief and fairly easy to understand. You can see some sign manipulations in lines 74 and 75 (Maple 2016) and other places. The result ultimately depends on the what's returned by the built-in sign. Compare sign(x0-x) with sign(x0-y).

You also asked if there was a better way to generate your sequence of variables. Yes:

cat(a..z);

Here's an example of doing it. I take the Petersen graph and draw the central star with thick, red, dotted edges.

restart:

macro(GT= GraphTheory):

P:= GT:-SpecialGraphs:-PetersenGraph();

GRAPHLN(undirected, unweighted, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], Array(%id = 18446744401546248310), `GRAPHLN/table/1`, 0)

dp:= GT:-DrawGraph(P);

VP:= GT:-GetVertexPositions(P):

Make a list of the desirted subgraph's vertices:

Sv:= [6,7,8,9,10]:

S:= GT:-InducedSubgraph(P, Sv);

GRAPHLN(undirected, unweighted, [6, 7, 8, 9, 10], Array(%id = 18446744401584846118), `GRAPHLN/table/2`, 0)

GT:-SetVertexPositions(S, VP[Sv]);

Construct the graph difference P - Edges(S):

P:= GT:-Graph(GT:-Vertices(P), GT:-Edges(P) minus GT:-Edges(S));

GRAPHLN(undirected, unweighted, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], Array(%id = 18446744401584820342), `GRAPHLN/table/3`, 0)

GT:-SetVertexPositions(P, VP);

dp:= GT:-DrawGraph(P);

ds:= subs(
   {THICKNESS(2)= THICKNESS(4), COLOR(RGB, 0, 0, 1)= COLOR(RGB, 1, 0, 0)},
   plots:-display(GT:-DrawGraph(S), linestyle= dot)
);

plots:-display(dp, ds);

 

 

Download Subgraph_Different.mw

The following code will count the number of recursion levels allowed:

RC:= 0:   proc() :-RC:= :-RC+1; thisproc() end proc():   RC;

On my computer, this consistently returns 99755. So, that's the software limitation.

You should post the smallest example that you have of code that gives you the error message. It could be something that you're doing wrong, or it could be a bug in Maple.

You can get the same help from the on-board help system, which is still accessible via the command-line interface. At the command prompt, enter

???VariationalCalculus,EulerLagrange

(Using Cygwin, I need to hit Enter (or Return) twice for this command to be processed. I don't know if that will be true in SSH.)

The three question marks will take you directly to the Examples section of the help page. The command input of the examples will be in 1D plaintext (aka Maple Input), and the output will be in 2D ASCII (equivalent to interface(prettyprint= 1)). You should be able to copy-and-paste the command input. (Using Cygwin, I need to use the Copy and Paste functions directly from the mouse rather than the keyboard shortcuts Ctrl-C and Ctrl-V.)

In Maple, the constant Pi is capitalized; lowercase pi is just a variable.

If you want a decimal point in the output, the easiest way to get it is to use a decimal point in the input: sin(Pi/2.). However, I encourage you to first try doing your work with exact values rather than decimals.

Please don't check off all the Products boxes in your message header. This Question is about Maple itself.

There's a very, very limited facility for abstract sets in Maple. See ?in. Your set A might be specified as

A:= SetOf([realcons $ 3]);

and B might be

B:= SetOf(nonnegative);

I don't know if this works in Maple 13.

If you present some more-fully-formed ideas, we may be able to find better representations of them in Maple.

Your Question isn't about MaplePrimes, although it's on MaplePrimes. So, I removed MaplePrimes from your "Products" check-offs.

 

Please don't check off all the "Products" categories in the message header. Your Question is about Maple itself, not about any other product.

Getting a result with a RootOf isn't an error. It's an indication that there's no simpler way of expressing the exact roots of your equation. If you want a decimal approximation of the real root, use fsolve(EQ). If you want decimal approximations of all nine complex roots, use fsolve(EQ, complex).

Using the view option will stabilize the viewing window, thus making it appear that the point moves.

Explore(plots:-pointplot(a*[1, 1], view= [-10..10, -10..10]), a= -10..10);

I don't use context menus, so I don't know if the above is accessible via one.

I've only analyzed the case phi[4]*S[3]; I guess that the analysis for the other cases is similar. Your integrand has a singularity at x=1. ApproximateInt doesn't handle improper integrals.

If you don't provide any extra options, then ApproximateInt uses a midpoint Riemann method with only 11 evenly spaced evaluation points. ApproximateInt is primarily intended for educational illustration purposes. There is no inherent error control. You would have to decide on the value of partition required to achieve a certain accuracy.

Regarding Int/int's epsilon option: If you set epsilon to .5*10^(1-d), then the result will have d digits of accuracy if Maple can complete the calculation to that accuracy without using too many extra guard digits. If Maple can't complete the calculation thus, the integral is returned unevaluated. In that case, increasing the value of Digits while keeping epsilon the same may help the computation to complete.

The k in your expression is used as a function symbol, not a coefficient. A number can be used as a function that is a constant function that returns the number. For example, 3(x) is simply 3. There is no d in your expression, so I don't know why you expect something to happen when you substitute for d.

To enter boundary or initial conditions that have derivatives, use D form rather than diff form.

Maple's numeric dsolve won't allow infinity as a boundary point. You'll just have to use some number to substitute for infinity.

inf:= 10: #Substitute for infinity.
Bcs:= theta(inf) = 0, D(theta)(0) = -k*(1-theta(0)):
ode:=
     diff(theta(eta),eta$2) +
     pr*Q*(1/alpha*(1-exp(-alpha*eta))*diff(theta(eta),eta) +
     Omega*theta(eta))+B*(-alpha*exp(-alpha*eta))^2 =
     0
;

Now you'll need two boundary conditions for the differential order of the ODE, plus one boundary condition for every unspecified constant: B, Q, Omega, k, pr, and alpha. So, you need eight boundary conditions.

Assuming that your matrix represents an "augmented" matrix, i.e., one where the rightmost column represents the right sides of the equations, then do

LinearAlgebra:-LinearSolve(R, free= t);

The t can be any unused variable that you want to use for the parameters. If you don't supply one, Maple will make one up.

You need to substitute a procedure (colloquially called a function) for x[1] rather than substituting an expression for x[1](whatever). Like this:

eval(junk, x[1]= ((a,b,c)-> R(b,c)*sin(omega*a + phi(b,c))));

Always use eval for these high-level calculus substitutions. Using subs isn't necessarily wrong, but eval is safer. The use of subs should be reserved for low-level purely syntactic substitutions.

I am highly skeptical of Kitonum's Answer. I don't doubt the computed critical value of D(theta)(0)---I got the same value. But I do doubt the solution curves. And I doubt the existence of a finite T such that theta(T) = Pi and D(theta)(T) = 0. My intuition is that diff(theta(t), t) (for t > 0) is a strictly positive, strictly decreasing function whose limit at infinity is 0.

Here are some computations to support these hypotheses:

restart:

I simplified your ODE. I hope that you'll agree that my form is equivalent.

ODE:= diff(theta(t),t$2) = sin(theta(t))*(cos(theta(t))-9.81);

diff(diff(theta(t), t), t) = sin(theta(t))*(cos(theta(t))-9.81)

The following dsolve solves the problem as a BVP. The value of the upper boundary T is up to you. As you make it higher, eventually either the BVP solver will give up, or you'll run out of patience waiting for it to finish.

T:= 9:

sol:= dsolve(
     {ODE, theta(0) = 2*Pi/3, theta(T) = Pi},
     numeric,
     abserr= 1e-9, maxmesh= 2^9
):

plots:-odeplot(
     sol, [[t,theta(t)-Pi], [t,diff(theta(t),t)]], 0..T,
     color= [red,blue], gridlines= false
);

Is theta'(T) = 0?

eval(diff(theta(t),t), sol(T));

HFloat(9.886613896682558e-13)

What is D(theta)(0)?

DTZ:= eval(diff(theta(t),t), sol(0));

HFloat(3.2496153618561823)

Now solve as an IVP using the high-accuracy taylorseries method.

sol2:= dsolve(
     {ODE, theta(0) = 2*Pi/3, D(theta)(0) = DTZ},
     numeric, method= taylorseries,
     abserr= 1e-9
):

My intuition is that the blue curve going negative simply represents the point where the Taylor series expansion is no longer accurate. If I ask for more accuracy, this point moves to the right.

plots:-odeplot(
     sol2, [[t,theta(t)-Pi], [t,diff(theta(t),t)]], 0..T,
     color= [red,blue], gridlines= false
);

 

 

 

Download Highly_unstable_ODE.mw

First 214 215 216 217 218 219 220 Last Page 216 of 395