Menu

Vector Field in 3d

Help
2022-02-10
2022-02-14
  • Alan Bromborsky

    Alan Bromborsky - 2022-02-10

    I am plotting the magnetic field produced by a three phase power cable. I found this in the Asymptote examples -
    **import graph;
    size(100);

    pair a=(0,0);
    pair b=(2pi,2pi);

    path vector(pair z) {return (0,0)--(sin(z.x),cos(z.y));}

    add(vectorfield(vector,a,b));**

    and the forum entry on how to apply it to 3 dimensions. My question is can this method be used to plot the field over a predefined point set rather than the automatically generated rectangular grid defined by a and b in the example. For example if I wished to plot the field at point on a circle that I define. Essentially, define an array

    triple [] xyz;

    and plot the vector field at the points defined by xyz?

     
  • Alan Bromborsky

    Alan Bromborsky - 2022-02-13

    I wrote routines to do what I wanted after looking at the arguments to "vectorfield." The routines are attached

     
  • John Bowman

    John Bowman - 2022-02-13

    It would help to include a usage example. Ideally one would would like analogues to the vectorfield routine in graph3.asy, with similar function signatures.

     
  • Alan Bromborsky

    Alan Bromborsky - 2022-02-14

    As you suggested I am coding some examples. I want to generalize my code to 3d but getting an error from the statement -

    void vectorfield3d(triple [] xyz,triple f(triple xyz),real scale=0.0, arrowbar arrow = Arrow3)

    The error is -

    VectorField.asy: 51.88: cannot cast expression to 'bool(picture, path, pen, marginT(path, pen))'

    I think I am using the wrong data type for Arrow3 but I can't find the datatype for Arrow3 in the documentation. Is that my problem?

     
  • Alan Bromborsky

    Alan Bromborsky - 2022-02-14

    As you suggested I am coding some examples. I want to generalize my code to 3d but getting an error from the statement -

    void vectorfield3d(triple [] xyz,triple f(triple xyz),real scale=0.0, arrowbar arrow = Arrow3)

    The error is -

    VectorField.asy: 51.88: cannot cast expression to 'bool(picture, path, pen, marginT(path, pen))'

    I think I am using the wrong data type for Arrow3 but I can't find the datatype for Arrow3 in the documentation. Is that my problem?

     
  • Alan Bromborsky

    Alan Bromborsky - 2022-02-14

    Disregard previous post. I found arrowbar3!

     

Log in to post a comment.