Carl Love

Carl Love

28055 Reputation

25 Badges

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

MaplePrimes Activity


These are answers submitted by Carl Love

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).

The first error is that you define the procedure named GenerateStencil, but in PoissonSolve you call Stencil, not GenerateStencil.

There are other errors, but that's a start.

It is -m, but modulo 2*Pi, depending on the branch of the logarithm.

simplify(evalc(I*ln(cos(m)+I*sin(m)))) assuming -Pi < m, m <= Pi;

                                                           -m

Is the assumption -Pi < m <= Pi valid in your case?

First, end each of the EQs with a semicolon. Then assign the initial conditions to a variable, say ics, and end with a semicolon. Then

dsolve({EQ||(1..5), ics}, {q||(1..5)(T)}, method= laplace, convert_to_exact= false):
allvalues(%):  #obtain approximate roots of polynomials.
evalc(%):  #convert exp(a*I*T) to sin cos forms.
simplify(%, zero);  #Remove spurious imaginary parts.

a:= proc(n) option remember; a(0)+a(n-1) end proc:  a(0):= 1:
a(4);

                                                  5

Your phi46N in the matrix is what is known as an "escaped local" variable. (This is the problem that you suspected.) So, it is different from the variable phi46N which you enter at the top level. To refer to this variable, you need to extract it from the context in which it occurs. So one form of a correct solve command is

solve({seq(eq[i], i= 1..6)}, convert(phi4N, set));

Constructing the eq[i] in a loop is actually superfluous, so you could do

solve(convert(phiN =~ phi4N, set), convert(phi4N, set));

Set Digits to a higher value (and higher than 15), redo the computation, and subtract the new results for the eigenvalues from the original. You can do the same with the eigenvectors except that they made be reversed in sign.

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