plot2d: expression evaluates to non-numeric value everywhere in plotting range

Thomas
2013-02-16
2013-04-18
  • Thomas
    Thomas
    2013-02-16

    Is there some sequence of processing events which keeps this from plotting?

    (%i62) F(omega) := abs((%i * omega + 2E4)^2);

    (%i64) plot2d(F(omega), [omega, 0.01, 2E5]);
    plot2d: expression evaluates to non-numeric value everywhere in plotting range.
    plot2d: nothing to plot.
    (%o64) false

     
    • Does

      plot2d('F(omega), [omega, 0.01, 2E5]);

      (note that F(omega) is quoted!) or

      plot2d(F, [omega, 0.01, 2E5]);

      what you want?

       
      • Thomas
        Thomas
        2013-02-19

        Albrecht,

        I do not see the single quote to which you refer in my original post.

        It seems to me that the evaluation involves imaginary numbers even if the abs eliminates them at some point. When I played with the plot2d routine with functions that were exclusive of imaginary numbers it worked without problems.

         
        • Thomas,

          I did not see the single quote in your original post either. That's why I put it there.

          I analyzed your problem and it boiled down to an error in the simplification method of the abs function. This is an error I detected in Version 12.04.0 of wxMaxima, which is not present in wxMaxima 0.8.3.

          If you type "F(omega)". You will see that the abs function is gone, and therefore plot2d tries to plot complex numbers.

          Putting the quote before "F(omega)" in the plot2d call or using the function name alone seems to suppress the erroneous simplification.

          I think this simplification error should be fixed in Maxima. I tried to post more details about this issue, but when I had this ready and pressed the "Post" button, sourceforge replied with a 403-error and the complete post was gone - no way to retrieve it.

          Regards

          Albrecht

           
          • I just updated tickets #2549 and #2550 as I think they are related to this problem.

             
  • arielCo
    arielCo
    2013-02-16

    Interestingly,
    wxdraw2d(explicit(F(omega),omega,0.01,2e5));
    works.

    I also defined the function by mistake as
    abs((%i*omega*2e4)^2);
    and that works with both wxdraw2d and plot2d.

     
  • Ago77
    Ago77
    2013-02-18

    I am not familiar with the details of the "plot" routine, but it seems to get stuck due to numbers with an imaginary part that are created during the evaluation process. For example, this is plotted correctly
    F(omega) := realpart(abs((%i * omega + 2E4)^2));

    draw seems to be set up to ignore the imaginary parts, see this for example
    wxdraw2d(explicit(%i+x, x, -1, 1));

     
  • Thomas
    Thomas
    2013-02-19

    The original question was generated by me after I had problems with a Bode plot for a transfer function. I finally reduced the wxMaxima problem to the posted for simplicity sake to try to get at the problem.

    I used wxMaxima on the original problem by doing more of the math reduction myself, viz., taking the magnitudes myself and using log functions.

    I will try arielCo's suggestion on the original problem.

     
  • The is an option plot_realpart for the plot2d function, which could help. Try with

    plot2d(F(omega), [omega, 0.01, 2E5], [plot_realpart, true]);

     
  • Ben
    Ben
    2013-04-03

    I am having a similar problem to the original post:

    plot2d(xp3);
    plot2d(Ucr(y),[y,-dp/2,dp/2])
    

    This works just fine if I plot these individually. Xp3 is a list of discrete data points and Ucr(y) is a a function. But when I try to plot them together on the same plot.

    plot2d([x[p3], Ucr(y)], [y, -dp/2, dp/2],[style,lines,lines],[color,blue,red]);
    

    I get the error: expression evaluates to a non_numeric........
    Any Thoughts???
    Ben

     
    • Le 03/04/2013 21:55, Ben a écrit :

      I get the error: expression evaluates to a non_numeric........
      try to evaluate your function Ucr(y):
      Ucr(y);
      Probably it does not evaluate to numeric value but expression with
      symbols instead.

      Regards

      --
      Jean-François MAUREL
      PIMECA
      http://www.pimeca.com

       
  • Ben
    Ben
    2013-04-04

    Dear Jean Francois,

    I appreciate the help. I am not sure how to evaluate a function with a variable in it. could you possibly make a suggestion? Here is the function.

    y is the variable everything else has a value. C1 is a list whose values are complex.
    Ucr(y):=offset+c1[21]+2sum(realpart(c1[m+20])cos(23.14(m-1)y/dp) - imagpart(c1[m+20])sin(23.14(m-1)*y/dp),m,2,nmax+1);

    Regards,
    Ben

     
    • Le 05/04/2013 01:10, Ben a écrit :

      Hi,

      Ucr(y):=offset+c1[21]+2/sum(realpart(c1[m+20])/cos(2/3.14/(m-1)/y/dp)
      - imagpart(c1[m+20])/sin(2/3.14/(m-1)*y/dp),m,2,nmax+1);

      You can use:
      offset+c1[21]+2/sum(realpart(c1[m+20])/cos(2/3.14/(m-1)/y/dp) -
      imagpart(c1[m+20])/sin(2/3.14/(m-1)y/dp),m,2,nmax+1);
      this shows a lot of errors multiply operators are missing.
      May be:
      offset+c1[21]+2
      /sum(realpart(c1[m+20])/cos(2/3.14/(m-1)/y/dp) -
      imagpart(c1[m+20])/
      sin(2/3.14/(m-1)y/dp),m,2,nmax+1);

      Regards

      --
      Jean-François MAUREL
      PIMECA
      http://www.pimeca.com

       
  • Ben
    Ben
    2013-04-08

    Jean-Francois Maurel,

    The function Ucr(y) is fine. I use it in other parts of the code as well as set it equal to values and generate values for y. I get no errors with Ucr(y) I can even plot it, it just fails when I try to plot the function with other plots on the same graph.

    I think the operator errors are just a mistake I made when typing into this webpage.

    Best,
    Ben