Robert Israel

6522 Reputation

21 Badges

18 years, 182 days
University of British Columbia
Associate Professor Emeritus
North York, Ontario, Canada

MaplePrimes Activity


These are answers submitted by Robert Israel

> convert(sin(x)^4/cos(x)^2,csccot);

1/(csc(x)^2*cot(x)^2)

> applyop(convert,1,%,sin);

sin(x)^2/cot(x)^2

> applyop(convert,2,%,tan);

sin(x)^2*tan(x)^2

Of course.  Just use a for loop:

> x[1](0):= ...:
   x[2](0):= ...:
   theta[0](0):= ...:
  for k from 0 to 100 do
     x[1](k*T + T) := ...:
     x[2](k*T + T) := ...:
     theta[0](k*T + T) := ...
  end do:

In that generality, no, there is no closed form solution.  Even very simple nonlinear recurrences with one dependent variable typically have no closed form solution. 

In some cases (usually when the limit does not exist), limit will return a range a .. b, meaning that the lim sup is at most b and the lim inf is at least a.  For example:

> limit(sin(x), x=infinity);

   -1 .. 1

This won't happen if all your terms are rational functions, but I was just trying to be as general as possible.

Kamel is correct, although you really should use LinearAlgebra rather than the deprecated linalg package.   I might, however, note that in general (in particular with mixed boundary conditions) the equation Chareqn might not have closed-form solutions, and solve is likely to return a RootOf in those cases.
For example:

> with(LinearAlgebra):
   dsolve(diff(y(x),x,x) + lambda^2*y(x) = 0, y(x));
   Y:= unapply(rhs(%),x);
   bc:= {Y(0)=0, Y(1) - D(Y)(1)  = 0};
   Chareqn:= Determinant(GenerateMatrix(%, [_C1,_C2])[1]);
   solve(Chareqn,lambda,AllSolutions);

RootOf(-tan(_Z)+_Z)

In such a case RootFinding:-NextZero can be used.

> with(RootFinding):
   f:= unapply(Chareqn,lambda);
   Lambda[0]:= 0;
   for i from 1 to 5 do
     Lambda[i]:= NextZero(f,Lambda[i-1])
   end do;


                            Lambda[0] := 0

                       Lambda[1] := 4.493409457

                       Lambda[2] := 7.725251836

                       Lambda[3] := 10.90412165

                       Lambda[4] := 14.06619391

                       Lambda[5] := 17.22075527

That's what select is for.  It returns every term that satisfies the criterion.  So:

> L := 3 + 4*r + 5/r + 6*r^2 - 7*r^3;
   criterion:= proc(t) is(limit(t/r^2, r=infinity) <> 0) end proc;
   select(criterion, L);

6*r^2-7*r^3

 

If XSol is the result of pdsolve, as in my worksheet, then to plot the value of u at X=0 for, say, 0 <= t <= 2 you could use

XSol:-plot(X=0, t = 0 .. 2);

Of course if you want a certain value of the x variable you'll want to transform that to the corresponding X.

Hmm, well, order r^d or greater would mean limit(t/r^d, r=infinity) <> 0 (including infinite or undefined).  So the criterion would just be

criterion:= proc(t) is(limit(t/r^d, r=infinity) <> 0) end proc;

Sorry about using L for two different purposes in the previous posting.  I should have caught that. 

If your exp1 is in the form you gave (with the terms in the order given)

A1/A5 = op(1,exp1)/exp2

If L is a list or a sum of terms, to get the ones that go like, say, const/r^2 as r -> infinity you could try

> criterion := proc(t)
    local L;
    L:= limit(t*r^2, r=infinity);
    not type(L,{infinity,range}) and is (L <> 0)
   end proc:
   select(criterion, L);

You have n as both a formal parameter and a local variable of Fern.  Apparently these are supposed to be two different variables.  I suspect the local variable is the one that is supposed to be assigned a sequence of points, while the formal parameter is an integer.  But then you also have an index variable for your for loop, also called n; this should be another local variable.

You end up plotting n(12500).  I don't know what that's supposed to be, but if this n is the sequence of points, the 12500 will have no effect.  You would want to make this sequence into a list, though, in order to plot it.

Finally, you probably want end proc at the end of your procedure.

If you're concerned about order, you want a list, not a set. 
[a, b, c] is a list, {a, b, c} is a set.

You could try

> [seq(seq(x^n * y^m, m = 0 .. 2 - n), n = 0 .. 2)];
   U:= sort(%, (a,b) -> degree(a) < degree(b));

The composition sign (in  Maple input) is @.  So:

> f := x -> x^2 + 1;
   g:= x -> 3*x - 2;
   (f @ g)(x);

(3*x-2)^2+1

Your definition of f seems to have a free variable w.  Can you copy your actual code, or upload a worksheet?

1) Not if you insist on using a set. If ordering is important, use a list instead.

2) subs(sol, vars);

3) Vector(convert(yourset, list));

First 19 20 21 22 23 24 25 Last Page 21 of 138