Group Abstract Group Abstract

Message Boards Message Boards

0
|
3.3K Views
|
4 Replies
|
1 Total Like
View groups...
Share
Share this post:

Filling field of values from MatrixFieldOfValues?

Posted 4 years ago

Hi,

I'm looking for a way to fill field of values with light blue color. Since function "MatrixFieldOfValues" only gives a boundary can someone please help me with changing below code?

Show[ParametricPlot[
  ReIm[ResourceFunction["MatrixFieldOfValues"][mat1, t]], {t, 0, 
   2 \[Pi]}, Axes -> False, Frame -> True], 
 ComplexListPlot[Eigenvalues[N[mat1]], PlotMarkers -> Automatic, 
  PlotStyle -> Red]]

Thank you!

POSTED BY: Kamil Gacek
4 Replies
Posted 4 years ago

Hi again! I don't want to open new topic so I try my luck here ;)

Is it possible to draw a associated curve of matrix in Mathematica? Let's say I have matrix A which after decomposition and calculating generating curve we have equation 1/2sqrt(2)uv^2-2v^2-2u^2+4=0 (generating curve is F(w,u,v)=0 but we take w=1).

Could you please help me draw it? I find it really challenging :(

I know that the graph should look like oval with little 'triangle' inside, but I have no idea how to draw in projective space...

Thank you!

POSTED BY: Kamil Gacek
Posted 4 years ago

I'm assuming that you've pulled this from the example in the documentation for the MatrixFieldOfValues ResourceFunction. So I don't know whether you really want a parametric plot or if any visualization type will do. I'll show one way to do it with FilledCurve.

Graphics[
 FilledCurve[
  Line[Table[
    ReIm[ResourceFunction["MatrixFieldOfValues"][mat, t]], {t, 0., 
     2. Pi, .1}]]]]

Couple of things to note:

  • The general strategy I used was to create data representing 2D coordinates, wrap it in Line (since Mathematica has useful functions that operate on Line structures), wrap that in FilledCurve (to represent the idea that we're wanting to visualize the filled region bounded by our line), and the trigger the display with Graphics (without which you just have the structure that represents the semantics of a filled region bounded by a set of line segments).
  • The "."s (periods) used in the range for t specified by the Table force the ResourceFunction expressions to evaluate.
  • The example you provided, by the way used 2[Pi] instead of 2 Pi, and this generated an error in the ParametricPlot.
  • You can change the "resolution" by changing how many "samples" you use in your Table. In the range specifier, {t, 0., 2. Pi, .1}, the .1 is the step size. Make it smaller to get more points and a smoother curve, bigger to get a chunkier curve.
  • You can look at the documentation for FilledCurve and Graphics and Line, and use the info to change the appearance of the final output (colors, textures, edges, etc).
POSTED BY: Eric Rimbey
Posted 4 years ago

Thank you so much, everything is as I imagined! :)

POSTED BY: Kamil Gacek
Posted 4 years ago

A little trickery is needed if you want to make a filled region out of the field of values function:

With[{mat1 = ExampleData[{"Matrix", "WEST0067"}]},
     Show[ParametricPlot[ReIm[ResourceFunction["MatrixFieldOfValues"][mat1, t]],
                         {t, 0, 2 Pi}, Axes -> False, Frame -> True, 
                         PlotStyle -> Directive[EdgeForm[Directive[AbsoluteThickness[4],
                                                                   ColorData[97, 1]]], 
                                                FaceForm[Opacity[0.4, ColorData[97, 1]]]]] /.
               Line -> Polygon, 
           ComplexListPlot[Eigenvalues[N[mat1]], PlotMarkers -> Automatic, PlotStyle -> Red]]]

where I use PlotStyle to insert any useful directives, and then replace all instances of Line[] with Polygon[] afterwards.

POSTED BY: J. M.
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard