Carl Love

Carl Love

27616 Reputation

25 Badges

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

MaplePrimes Activity


These are answers submitted by Carl Love

Indeed, here is the procedure.  It takes a PLOT structure containing a VIEW as input and returns the PLOT structure with the appropriate points erased.

Eraser:= proc(P::specfunc(function,PLOT))
# Uses the VIEW specification of a PLOT structure to erase points outside the view.
   local
      x1,x2,y1,y2
     ,View:= indets(P, specfunc(anything, VIEW))
   ;
   if nops(View) = 0 then  return P  end if;
   if nops(View) > 1 then  error "Multiple VIEWs found: %1", View  end if;
   View:= View[];
   PLOT(
      op(
         plottools:-transform(
            subs(
               [x1,x2,y1,y2] =~ [op](map(op, subs(DEFAULT= -infinity..infinity, View)))
              ,(x,y)-> `if`(`or`(x1 > x,x > x2, y1 > y,y > y2), [undefined$2], [x,y])
            )
         )(P)
      )
     ,View
   )
end proc:

We can use plottools:-transform like an eraser on an existing PLOT structure by converting points outside a desired view to undefined. Then they will stay undefined if the VIEW is subsequently enlarged. (I'm using all caps for certain words because that's how they appear in the PLOT structure.)

a:= Statistics:-BubblePlot([4, 5, 2, 3], [1, 2, 7, 8], [8, 1, 3, 2]):
Eraser:= (x,y)-> [x, `if`(4 <= y and y <= 9, y, undefined)]:
a1:= plottools:-transform(Eraser)(a):
plots:- display(a1);

           [plot not shown in post]

plots:-display(a1, view= [default, 0..9]);

           [plot not shown in post]

The above procedure Eraser is ad hoc, for your particular view; but I can easily generalize it so that it will extract the range(s) from the VIEW option of an existing PLOT.

Note that however you change the view in a BubblePlot, the circles will be distorted to ellipses because they are created as POLYGONs, rather than as single points. This also means that they may be cut by an invisible horizontal or vertical line. If you want to erase points without changing the axes (which means that circles would stay circles), I'll have to think of something else.

I assume that you mean a memory limit, so that you can access your virtual memory. The command is (for example, to increase to 16 GB)

kernelopts(datalimit= 16*Unit(gibibyte));

However, having read your other recent post, I know that a lack of memory is not the true cause of your troubles. Get your bugs worked out on a smaller version of your problem first!

Addressing the OP's direct question: No, there is no limitation on set size. If you have the RAM for it, the Maple kernel can handle it. The Maple kernel will give you an explicit error message if it runs into any memory limitation.

I am assuming that by "create" you mean "plot". And I am assuming that your question could be rephrased as "How can one plot a function with a restriction on the abscissae ('x values') or on the ordinates ('y values')?" If those are not what you meant, please let me know.

There are many ways to do it. Here are just a few. Which one you choose may depend on what types of algebraic manipulation you need to do to the function before or after plotting (such as, how you decided on 0.2 and 1.3).

Method 1a: piecewise, abscissa-oriented:

f:= piecewise(Or(And(x>=0.19740,x=3.3390, x

plot(f, x= 0..2*Pi, discont);

Method 1b: piecewise, ordinate-oriented:

f:= piecewise(tan(x) >= .2 and tan(x) < 1.3, tan(x), undefined);

plot(f, x= 0..2*Pi, discont);

Method 2a: restricted plot, abscissa-oriented:

plots:-display(
   [plot(tan(x), x= 0.19740..0.91510), plot(tan(x), x= 3.3390..4.0567)]
   ,view= [0..2*Pi, DEFAULT]
);

Method 2b: restricted plot, ordinate-oriented:

plot(tan(x), x= 0..2*Pi, y= 0.2..1.3, discont);

Your expression contains five pairs of square brackets which should be parentheses. If this expression is the output of a Maple command, then the input must have had inappropriate square brackets.

Markiyan's answer is fine, but here is another way. I prefer to build each frame of an animation, and then animate it, rather than merging animations. I think this gives more flexibility for changes, and avoids some repetition of arguments.

ball:= Pt-> plots:-pointplot([Pt], color= blue, symbol= solidcircle, symbolsize= 20):
balls:= ()-> plots:-display(ball ~ ([args])):  # One frame
BallData:= [[1+sin, 1-sin], [sin,sin]]:  # All data in one place.
plots:-animate(balls, BallData(t), t= 0..2*Pi, scaling= constrained, frames= 100);

You have asterisks (*) after the word unapply. Get rid of those.

g := unapply*(funktion1, x, y);

                     ^

Also, change linalg:-inverse to LinearAlgebra:-MatrixInverse, or simply use (-1) as exponent. I guess your Jacobian is from the VectorCalculus package. You should explicitly reference the package. 

Preben's answer shows adequtely how to get the right answer (and I am surprised that fsolve can do it). Here, I answer the other question: What went wrong in the original attempts?

The expression

    add(length(i), i = 1 .. n)

(outside of a procedure) gives an error (unable to execute add) because the value of n is unknown.

The expression

   sum(length(i), i = 1 .. n)

gives the wrongs answer because length(i) is evaluated before values of i are substituted (whereas add delays the evaluation). Since i is a symbol with one character, length(i) is 1. Hence the equation

   (sum(length(i), i = 1 .. n) = 2893

simplifies to n = 2893.

 

My first approach would be to take the series definition given at ?JacobiTheta and truncate the series. Given that your nome has modulius << 1, five terms of the series should be more than enough.  For example,

restart;
nome:= evalhf(0.1*exp(0.1*Pi*I)):
z:= evalf[15](expand(Pi*I*(a+b*I))):
Nterms:= 5:
JT1:= (z,q)-> 2*q^(1/4)*(add((-1)^n*q^(n*(n+1))*sin((2*n+1)*z), n= 0..Nterms-1)):
CodeTools:-Usage(
   plot3d(argument(JT1(z,nome))
      ,b= -4..4, a= -4..4
      ,grid= [300,300]
      ,shading= zhue
      ,style= surface
      ,axes= box
      ,orientation= [-90,0,0]
   )
);

memory used=4.56MiB, alloc change=10.98MiB, cpu time=515.00ms, real time=524.00ms (On an Intel i7)

My experience going from 3 to 5 terms is that each additional term contributes one more level to the fractal "forking".

I'm very pleased to know that evalhf now works with complex numbers. The page ?evalhf,fcnlist needs to be updated to include argument, Re, and Im, and perhaps others.

Replace the line

Dist := int(Density, t);

with

Dist := unapply( int(Density, t), t);

This will make Dist an operator, so that the expression Dist(t-1) makes sense.

The plot command will accept a list of points defining a curve. Each point is represented as a list with two elements. For example:

plot( [ [0,0], [1,1], [1,2], [2,3] ] );

The list can be arbitrarily long.

Three points:

  1. This problem is different than the one in the original post: The linear term in f has been changed from -3x to -x.
  2. The new equation has infinitely many real solutions.
  3. In this case, allvalues sets the global _ValuesMayBeLost to true, so the answers it gives may not include all values.

"fi" and "end if" mean exactly the same thing, but you can't have them both. I suggest removing the "fi". Do the same thing two lines below that. Also, you need to remove the ";" at the end of the first line.

The type ?even is predefined, and ?select is a command. Putting them togther, letting L be your list above, the command is

select(type, L, even)

 

For those who like fewer words, the following does the same thing:

select(`::`, L, even)

First 387 388 389 390 391 392 Page 389 of 392