Vrbatim

118 Reputation

9 Badges

10 years, 221 days

MaplePrimes Activity


These are questions asked by Vrbatim

I've been tasked with generating "phase plots" which are visualizations of complex functions. 

A 2D phase plot is easy to create: Given a complex function F : C -> C colour points (x, y) in R^2 by [ arg(F(x+I*y)), 1, 1, colortype=HSV].   Something like the following seems to do the trick
    
    p := plot3d( 
        1,
        x=-5..5,
        y=-5..5,
        scaling=constrained,
        color=[ argument(f(x+I*y))/2/Pi, 1, 1, colortype=HSV],
        axes=none,
        style=patchnogrid,
    ):

    
    g := plottools[transform]((x,y,z)->[x,y],p);
    plots[display]( g(p) ):

Now, "colouring each point of R^2" is only possible using some type of bijection onto the Riemann sphere or Pseudosphere.

The pseudosphere is:

    x := (u,v) -> sech(u)*cos(v);
    y := sech(u)*sin(v);
    z := u - tanh(u);
    
    return  plot3d(
        [x(u,v),y(u,v),z(u,v)],
        u=0..3,
        v=0..2*Pi,
        numpoints=2^10,
        lightmodel=none,
        color=ColorFunc(u,v) );

In this case I need  ColorFunc to be:

ColorFunc := proc(u,v)
    x, y := v, exp(u);
    ans  := Re( f(x+I*y) );
    if ans > 2*Pi then
       return [0,0,0,colortype=HSV];
    end if;
    return [ans/2/Pi,1,1,colortype=HSV];
end proc;

But it seems that "ColorFunc" cannot be very sophisticated.  Namely, it cannot contain "frems" or even "if" statements because (as far as I can tell) of the order of evaluations.  

It seems possible that I can generate a psuedosphere then change colours AFTER by swapping out the COLOR information in a more sophisticated way.  How can I do this?  I really just need to know how to identify and swap out points from a MESH.

I am interested in efficiently plotting a grid of squares where each square is coloured. 

 

From what I understand I can do this using plotting primitives. For example,

P1 := Array( 1..4, 1..2, [[0,0],[1,0],[1,1],[0,1]],storage=rectangular, order=C_order, datatype=float[8] );

P2 := Array( 1..4, 1..2, [[1,1],[2,1],[2,2],[1,2]],storage=rectangular, order=C_order, datatype=float[8] );

PLOT( POLYGONS(P1,P2), COLOUR(RGB,1,0,0,0,1,0)  );

plots one red and one green unit sqaure.

 

I am interested however in plotting millions of squares.  Is there a way to efficiently store the sequence required for the POLYGONS and COLOUR primitive?  Ideally I want to store them as arrays.

Is this deliberate or a bug?  If deliberate, what is the reason?

> Algebraic[GetAlgebraics]( 1*I );

                                        {I}

 

> Algebraic[GetAlgebraics]( 1.0*I );

                                        {}

 

Can anyone coax Maple to solve this reccurence relation? It seems harmless enough but Maple is struggng a bit with "hypergeomsols."

f := c -> (2*n-c)*f(c-1) - (c-1)*n*f(c-2);

f(0) := 1;

f(1) := 2*n-1;

 

The following is taken from p 328 of the Maple TA manual.

 

\documentclass[12pt]{article}
\usepackage{ed}
\begin{document}

\begin{question}{Formula}
% This question uses randomized variables.
\qutext{Find the formula for the inverse of the function
$f(x)=\var{a}x+\var{b}$.}
\answer{(x-\var{b})/\var{a}}
\code{
$a=int(rint(9)+2);
$b=int(rint(9)+2);
}
% The above code chooses random integer coefficients a and b between
% 2 and 10.
\end{question}

\end{document}

 

Running it though the online compiler generates the following when Service Pack 1 checkbox is UNCHECKED

Note: Successful conversion from LaTeX to QU does not guarantee that your testbank will load into Maple T.A. correctly. Please examine the contents of the box below for any additional errors that may be generated when your testbank is loaded into Maple T.A.

l2e_pkIwct.qu: Error at line 3.
Line ended while reading variable name (missing "=" at end of name?)

(A response of "[OK]" indicates that there should be no problems uploading your converted testbank file to Maple T.A.)

 

and the following when it is CHECKED

...

[30] [31] [32] [33] [34] [35] [36] [37] [38] [39] [40] [41] [42] [43] [44]
[45] [46] [47] [48] [49] [50] [51] [52])
(/usr/local/latex2edu/newt4ht/texmf/tex/generic/tex4ht/html-mml.4ht)
(/usr/local/latex2edu/texmf/tex/local/ed/ed.4ht [53] [54]))
(/usr/local/latex2edu/newt4ht/texmf/tex/generic/tex4ht/html4.4ht)
(/usr/local/latex2edu/newt4ht/texmf/tex/generic/tex4ht/unicode.4ht)
(/usr/local/latex2edu/newt4ht/texmf/tex/generic/tex4ht/html4-uni.4ht)
(/usr/local/latex2edu/newt4ht/texmf/tex/generic/tex4ht/mathml.4ht)
(/usr/local/latex2edu/newt4ht/texmf/tex/generic/tex4ht/html-mml.4ht)
(/usr/local/latex2edu/texmf/tex/local/ed/ed.4ht))
No file l2e_yQsgNQ.aux.
)
*
! Emergency stop.
<*> \def\production{}\input l2e_yQsgNQ.tex

Output written on l2e_yQsgNQ.dvi (54 pages, 25316 bytes).
Transcript written on l2e_yQsgNQ.log.

 

 

What's going on?

1 2 3 4 5 Page 1 of 5