Carl Love

Carl Love

28025 Reputation

25 Badges

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

MaplePrimes Activity


These are answers submitted by Carl Love

while n >= 1 do
     for i from 1 to n do
          S[i]:= resultant(F[i], F[i+1], Plex[i])
     end do;
     F[i]:= S[i];
     n:= n-1
end do;

I am not sure if you are more interested in reproducing the animation in your first link or in analyzing solids of revolution as in the second (MapleSoft) link. I chose the former. Except for the coordinate axes, the following is very close to the animation in your first link. I just estimated the number of gridlines.

restart:
f:= x-> -x^3+4*x^2-3*x+1:
plots:-animate(
     #Each frame of animation has 4 pieces put together by `display`.
     plots:-display,
     [[
       #A cylindrical sector of the curved surface:
       'plot3d'(
            [r,t,f(r)], t= 0..T, r= 0..3,
            coords= cylindrical, style= wireframe, grid= [30,20]
       ),
       #A sector of the base cylinder:
       'plot3d'(
            [3,t,z], t= 0..T, z= 0..f(3),
            coords= cylindrical, style= wireframe, grid= [30,2]
       ),
       #A sector of the base disk of the base cylinder:
       'plot3d'(
            [r,t,0], t= 0..T, r= 0..3,
            coords= cylindrical, style= wireframe, grid= [30,8]
       ),
       #The curve which is being revolved:
       'plots:-spacecurve'(
             #The main curve:
            {[r,T,f(r)],
             #The 3 straight line segments of the curve:
              [[3,T,f(3)], [3,T,0], [0,0,0], [0,0,f(0)]]
             },
            r= 0..3, coords= cylindrical, thickness= 2, color= red
       )
      ], scaling= constrained, axes= normal, orientation= [90,65]
     ], T= 0..2*Pi, paraminfo= false
);

Basically, you want to plot -abs(x^x).

plot(-abs(x^x), x= -2..0);

 

 

e^x is exp(x) in Maple; e is treated simply as another variable, hence your error messages. Try this:

plot(exp(x)*ln(x), x= 0.1..10);

Kitonum wrote:

Herd size that satisfies all the constraints, very large, and Maple can count it only approximately.

Not true, at least in Maple 18. It can compute all 200,000+ digits of the answer in the blink of an eye, if you use evala. This may be a good example to show how Maple has advanced.

restart:
w:= 300426607914281713365*sqrt(609)+84129507677858393258*sqrt(7766):
n:= evala((w^4658-1/w^4658)^2/(4657*79072)):
d:=3515820*n;                             
B:= (1243419/585970)*d;
local D: D:= (367903/175791)*d;
W:= (246821/83710)*d;
Y:= (125739/106540)*d;
b:= (815541/585970)*d;
w:= (17158/8371)*d;
y:= (1813071/1171940)*d;

... long integer answers omitted ...

is(sqrt(W+B), integer);

                        true

is(-3/2+(1/2)*sqrt(1+8*(D+Y)),integer);

                        true

In your second plot---the one with more points---you forgot to increase the denominators from 149 to 249. Thus, you only increased the number of points outside the set. If you increase the denominators to 249, you will indeed get a denser, more-detailed plot.

I don't know what you mean by "flush". And why do you expect lines when you are plotting points? If you use enough points, then you will get a plot that doesn't appear pixellated.

Here's a better way to plot the Mandelbrot set: We use the concept of "escape time".  In your code, you rejected points if they got to Float(infinity) after 100 iterations. Actually, once the abs(z) > 2, it's guaranteed to go to infinity. In the escape-time way, we count the number of iterations it takes to get abs(z) > 2 or max out at 100 iterations. The color of a point is determined by the number of iterations.

Mandelbrot:= proc(x,y)
local n,c,z;
     c:= x+I*y;
     z:= 0;
     for n to 100 while abs(z) < 2 do
          z:= z^2+c
     end do;
     n
end proc:

plots:-densityplot(
     Mandelbrot, -1.5..0.5, -1..1, grid= [250,250],
     colorstyle= HUE,
     axes= boxed, scaling= constrained,
     style= patchnogrid,
     labels= [Re,Im]
);

You'll notice that this is much faster than your code, yet it is doing a very similar computation. That's because this code is processed in the evalhf environment.

P:= randpoly([x,y]);

 

C:= [coeffs(P, [x,y], 't')];

t;

 

add(C[k]*t[k], k= 1..nops(C));

 

I don't see what you're trying to achieve in your code. But you can get the solution in one step with isolve.

{W=5/6*B+Y, B=9/20*D+Y, D=13/42*W+Y, w=7/12*(B+b),
  b=9/20*(D+d), d=11/30*(Y+y), y=13/42*(W+w)}:
isolve(%);

It is better to place the PLOT components in a Vector and to select them with type specfunc. Like this:

rearrangeCurves:= proc(v_items::specfunc(anything, PLOT), v_reorder::list([integer,integer]):= [])
local p, curves:= Vector(1), rest:= Vector(1), i:= 0, j:= 0;
     for p in v_items do
          if p::specfunc(anything, CURVES) then
               i:= i+1;
               curves(i):= p
          else
               j:= j+1;
               rest(j):= p
          end if
     end do;
     for p in v_reorder do
          curves[p]:= curves[p[[2,1]]]
     end do;
     PLOT(convert(curves,list)[], convert(rest, list)[])
end proc:

(x1,x2):= fsolve(x^2+3*x+1, x);

The parentheses on the left are not needed, but it is my personal style to use them with multiple assignment.

You need all three initial conditions to solve the system numerically. You have three first-order derivatives, so you need three conditions. So there's no point in using a loop. Simply use

Sol:= dsolve({sys, ics[]},{T1(t),T2(t),T3(t)}, numeric);

Here's a first attempt. This does not deal with punctuation marks, capitalization, unusual characters that may be considered letters in other alphabets, or aposthropes.

LCS:= module()
local
     X, Y, # lists of words
     C, # Array of counts
     
    ModuleApply:= proc(S1,S2)
        X:= StringTools:-Split(S1);
        Y:= StringTools:-Split(S2);
        LCSLength();
        backtrack(nops(X), nops(Y))
    end proc,

    LCSLength:= proc()
        local m:= nops(X), n:= nops(Y), i, j;
        C:= Array(0..m, 0..n, datatype= integer[2]);
        for i to m do
            for j to n do
                C[i,j]:= `if`(X[i]=Y[j], C[i-1,j-1]+1, max(C[i,j-1], C[i-1,j]))
            end do
        end do
    end proc,

    backtrack:= proc(i::nonnegint, j::nonnegint)
        if i=0 or j=0 then [][]
        elif X[i]=Y[j] then cat(thisproc(i-1,j-1), " ", X[i])
        elif C[i,j-1] > C[i-1,j] then thisproc(i,j-1)
        else thisproc(i-1,j)
        end if
    end proc
;
end module:

S1:=
"die einkommen der landwirte sind fuer die abgeordneten ein
buch mit sieben siegeln um dem abzuhelfen muessen dringend alle
subventionsgesetze verbessert werden":
S2:=
"die steuern auf vermoegen und einkommen sollten nach meinung
der abgeordneten nachdruecklich erhoben werden dazu muessen die
kontrollbefugnisse der finanzbehoerden dringend verbessert werden":

LCS(S1,S2);

" die einkommen der abgeordneten muessen dringend verbessert werden"

Whatever Maple commands that you would ordinarily use to solve the system will still work when you use complex numbers.

To help you enter the system, begin with

restart;
interface(imaginaryunit= j);
with(LinearAlgebra):

Remember to work in radians instead of degrees. You can, of course, convert the final answers to degrees at the end of the computation. To facilitate the entry of degrees, define

d:= Pi/180;

and then enter degree quantities as, for example,

150*d

Beginning your computation:

V:= < 150*d, 0 >:
A:= < 13-j*14, -(12-j*16); 27+j*16, -(26+j*13) >:
Determinant(A);

A^(-1);

If myFunction is a polynomial (or a polynomial of functions), then use simplify with side relations. See ?simplify,siderels . Example:

Horrible:= a^2+b^2+c^2:
simplify(Horrible, {a^2+b^2 = myFunction});

I don't know what you mean by A. A more-detailed example would help.

This Answer is to address your issues with the display of processor usage and memory usage at the bottom of the Maple window.

Use a process monitor external to Maple such as Windows Task Manager on Windows. This will give you closer-to-real-time information on processor and memory usage. The ticker at the bottom of the Maple window only updates when garbage is collected. Garbage is only collected when a certain amount has piled up or you force it with gc(). Your Maple code may still be processing, but if it is not generating any significant amount of garbage, then there will be no updates at the bottom of the window. You will see the processor usage in the external process monitor.

When you do a restart, the memory is released immediately. You can also see this on an external monitor. But it won't show on the Maple screen until a garbage collection is done. You tried to force a garbage collection with 

restart; gc():

However, this is erronenous. The restart command should always be in its own execution group. See the eighth paragraph at ?restart .

 

First 304 305 306 307 308 309 310 Last Page 306 of 395