Carl Love

Carl Love

28095 Reputation

25 Badges

13 years, 100 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are answers submitted by Carl Love

You can use op to extract the operands. The odd-numbered operands are the conditions, and the even-numbered operands are the "pieces". For example,

op(3, f);

op(4, f);

 2

op(6, f);

The following produces a list of equations of the coefficients all equated to 0.

[coeffs(collect(lhs(EQ), a), a)] =~ 0;

The preliminary collect step may be superfluous in this case but would be required for some more-complicated polynomials.

The normal is not a keyword in the command collect(a, x, normal). Rather, it is the simplifier procedure. See ?normal. It is a form a simplification not as intense as that provided by simplify.

If I cut-and-paste your two columns of data directly into a worksheet, it automatically becomes a 7x2 Matrix. To convert a Matrix M into the form that you seem to want, use convert(M, listlist).

The matrix M1 is equal to [[1,x], [1,x]] (i.e., two identical rows). Hence it is singular and cannot be inverted.

You should change GenerateMatrix to LinearAlgebra:-GenerateMatrix. (Not that that will fix the singular matrix.)

series, rhs,and convert(..., polynom) are all built-in commands.

Use two sets of unevaluation quotes around each Intat in the rule like this:

ToSumInt:=
     ''Intat''(
           A::algebraic*Sum(v::algebraic,r::{name,equation})*
           B::algebraic,u::equation
     )= Sum(''Intat''(A*v*B,u),r)
:
J:= Intat(f(xi)*Sum(g(n*xi), n), xi= x);

applyrule(ToSumInt, J);

Note that MaplePrimes makes two single quotes look like a double quote.

Regarding your second problem, please post plaintext of the expression that useInt does not work on.

I think that you'd like a simple algebraic function f of (i,j) such that u[i,j] = Sol[f(i,j)] for all relevant i and j. The following will work regardless of how complicated the order of the entries in Sol is.

UtoSol:= table((`[]`@op)~(Sol) =~ [$1..nops(Sol)]):
Sol_idx:= (i,j)-> UtoSol[[i,j]]:

For example,

Sol_idx(1,1);

                             9

Sol[Sol_idx(1,1)];

 

 

You are missing a multiplication sign between the two polynomials in parentheses.

Here is another way to do a polar plot of a numeric dsolve solution:

Sol:= dsolve({diff(r(t),t)=cos(t), r(0)=0}, r(t), numeric):
plots:-changecoords(
     plots:-odeplot(Sol, [r(t),t], axiscoordinates= polar),
     polar
);

Note that the coordinates must be ordered (r, theta), not (theta, r).

The answer to this is very similar to the answer to your last question. If you use assumptions and simplify the dsolve results with evalc, then those results will simplify dramatically. Then you can check directly that they satisfy the ODEs. (I am not saying that there's anything wrong with odetest or Mehdi's Answer; I am showing that Maple can work well with imaginary values.)

restart:
assume(a > 0, -Pi < m, m <= Pi);
sys_ode:=
     diff(d11(m),m) =
           -(3*sin(m)^2-1)*d31(m)/a^(3/2)+(-3*cos(m)*sin(m)/a^(3/2))*d41(m),
     diff(d21(m),m) =
          (-3*cos(m)*sin(m)/a^(3/2))*d31(m)-(3*cos(m)^2-1)*d41(m)/a^(3/2),
     diff(d31(m),m) = -a^(3/2)*d11(m),
     diff(d41(m), m) = -a^(3/2)*d21(m)
:
Sol1:= dsolve({sys_ode}):
Sol2:= simplify(evalc(Sol1));

Now verify that these solutions satisfy the original system of ODEs:

simplify((lhs-rhs)~(eval({sys_ode}, Sol2)));

There are very many ways to do this in Maple. Here's a way that puts the values in a Vector:

f:= x-> x^3+2*x+1:
fvalues:= Vector(10001, k-> f((k-1)*0.001));

What do you want to do with the values? Knowing that makes it easier to decide which way to generate them.

You forgot the parentheses. Surrounding a block with (*  *) comments it out. Also, # comments until the end of the line.

Use numeric integration: Enter Int with a capital I, and then

evalf(%);

0.1780721092

Such an operation is not usually done with a for loop in Maple, although it can be done that way. It is done like this:

a:= proc(n::nonnegint)
option remember;
local t;
     unapply(f(thisproc(n-1)(t), thisproc(n-2)(t)), t)
end proc:
a(0):= 0:  a(1):= t-> t:

When you say that you want to plot a[N](t), do you mean for a specific N? Note that with the procedure a as defined above, the notation is a(N)(t) rather than a[N](t).

First 307 308 309 310 311 312 313 Last Page 309 of 395