Robert Israel

6577 Reputation

21 Badges

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

MaplePrimes Activity


These are answers submitted by Robert Israel

Do you mean you have something like f(x)^234 where f(x) is some complicated expression?  The best advice I can give you is that it's probably a very bad idea to try to simplify this by expanding it out: you'd get a huge number of terms, and the system would probably run out of memory trying to compute them.


Do you really need to "simplify" this? 

Do you have some reason to believe that the answer does simplify to some reasonably small form? 

If so, maybe if you gave us more details we could have some suggestions.

chrem

It's not necessarily true that a(n+1)>a(n) (it depends where you start).  What is true is that a(n+1) is between a(n) and the fixed point (assuming, of course, that you start with a(0) >= -1).

> f:= x -> 3/2 + sqrt(x+1);
   assume(x >= -1);
   p:= solve(f(x)=x);
   is((p-f(x))*(f(x)-x)>=0);

             true

Of course, that's an assertion, not a proof. 

 

plot([f(x), -x, x = 0 .. 1], ytickmarks = [seq(-0.2*j=0.2*j,j=0..5)]);

 

Implicitplot (in the plots package) plots a curve of the form f(x,y) = g(x,y) (if given an equation) or f(x,y) = 0 (if given the expression f(x,y)).  So for example:

> with(plots):
> implicitplot(x^2 + y^2 = 1, x = -1 .. 1, y = -1 .. 1);

I'll save this in a variable, for future use.

> IP:= %:

Spline (in the CurveFitting package) produces a piecewise polynomial (in one variable) to interpolate given (x,y) points.  This can then be plotted using plot.  Thus:

> with(CurveFitting): 
   S := Spline([[-1,1],[0,0],[0.2,0.8],[0.4,0.6],[0.7, 0.5], [0.9, 0.7]], x);
   plot(S,x= -1 .. 1, colour=blue);

display (in the plots package) will combine two or more plots together.

> display([%, IP]);

You can also (sometimes) get the infinite Taylor series of an expression like this:

> convert(expr, FormalPowerSeries, x);

For example:

> convert(sin(x), FormalPowerSeries, x);

Sum((-1)^k*x^(2*k+1)/factorial(2*k+1), k = 0 .. infinity)

Maybe something like this?

> newquad:= proc(c) local V,X;
    X:= Statistics[RandomVariable](Uniform(0,1));
    V:= 0.6*Statistics:-Sample(X,2);
    plots[polygonplot]([seq](V+0.4*Statistics:-Sample(X,2),i=1..4),colour=c) 
 end proc;
 G:= proc()
   local i, rng, polylist, newpoly;
   polylist:= [];
   rng:= rand(1..5);
   for i from 1 to 100 do 
     newpoly:= newquad([red,yellow,green,blue,violet][rng()]);
     if nops(polylist) > 20 then polylist:= [newpoly,op(polylist[1..-2])]
     else polylist:= [newpoly,op(polylist)]
     fi;
     Maplets:-Tools:-Set(PL1 = plots[display](polylist,view=[0..1,0..1]));
   end do;
 end proc;
 with(Maplets[Elements]):
 maplet:= Maplet([[
    Plotter['PL1'](plots[polygonplot]([[0,0],[0,1],[1,1],[1,0]],colour=white)),
    Button("Go",Action(Evaluate('function'='G()'))),
    Button("Done",Shutdown())
  ]]):
 Maplets[Display](maplet);


Just assign a value to it, like any other variable.

> _EnvMaxCosetsToddCoxeter := 200000;

That is an answer.  You just need to know how to interpret it.

RootOf(p(_Z), label=_L1) stands for the _L1'th root of the polynomial p(_Z).  In this case Maple is telling you that you have solutions
x=r, y=r, z=r, lambda=r/4, where r is either sqrt(S/3) or -sqrt(S/3) (i.e. one of the two roots of the polynomial  p(z) = 3*z^2 - S).

csum is correct: the series diverges, although the ratio test is inconclusive.  In fact, a(n) -> 1 as n -> infinity, as you see from

limit(a(n),n=infinity);

 

Assuming L is positive, sqrt(a^2 + L^2)/sqrt(1 + a^2/L^2) simplifies to L. 

After making these simplifications, make the problem algebraic by substituting cos(th[i]) = (w[i] + 1/w[i])/2, sin(th[i]) = (w[i]-1/w[i])/(2*I) (so w[i] represents exp(I*th[i])).  The system of three equations can then be solved using a Groebner basis.  Unfortunately the result will be rather complicated - maybe make that hugely complicated.


The simplest way, without bothering with packages and repositories, is just to save the procedure to a text file:

> myproc := proc() 
     whatever
  end proc:
  save myproc, "myproc.txt";

Then when you need it in another worksheet

> read "myproc.txt";

As for your second question: for any substantial Maple project, most experienced Maple programmers use an external text editor of their choice rather than editing the code within a worksheet.  Again, the code can be saved in a text file and read in to the worksheet as needed.

If you're looking for the common calculus notation

I don't think Maple can do it, at least not easily.

I think you may be looking for something like this.

> with(IntegrationTools):
  z := V(F(x),G(x));
   zprime:= diff(z,x);
  Int(zprime,x=a..b) = int(zprime,x=a..b,continuous);

Int(D[1](V)(F(x),G(x))*diff(F(x),x)+D[2](V)(F(x),G(x))*diff(G(x),x),x = a .. b) = -V(F(a),G(a))+V(F(b),G(b))

> Expand(%);

Int(D[1](V)(F(x),G(x))*diff(F(x),x),x = a .. b)+Int(D[2](V)(F(x),G(x))*diff(G(x),x),x = a .. b) = -V(F(a),G(a))+V(F(b),G(b))

> % - op(2,lhs(%));

Int(D[1](V)(F(x),G(x))*diff(F(x),x),x = a .. b) = -V(F(a),G(a))+V(F(b),G(b))-Int(D[2](V)(F(x),G(x))*diff(G(x),x),x = a .. b)

As for your last question, I'm not sure what you're asking for.  Note that the integrands are different.  I don't think integration by parts would be useful for integrating D[1](V)(F(x),G(x))*diff(F(x),x).

> makebits:= proc(n)
   local R, i;
   R:= Vector[row](n);
   R[1]:= rand(2)();
   for i from 2 to n do
       if R[i-1] = 0 then R[i]:= rand(2)() end if
   end do;
   R
 end proc;
    
> makebits(7);
 
                       [0, 0, 0, 1, 0, 0, 1]

First 90 91 92 93 94 95 96 Last Page 92 of 138