MathStudio  Blog  Share  Manual  Forums  Support 
math bugs in MS
  • The following is a sequence on the forum started earlier by me. I am renewing that sequence since I too quickly accepted an answer from Shakey and doubt that it will get any attention now that it is marked as accepted.

    There is a bug in MS in that a script including an if statement works when called from the command line but does not work correctly when called within a loop such as a table or a plot. An example of this is shown below. What is the status of fixing this bug?

    A picture of the computation using an if statement in a table followed. Shakey responded:

    Ok, thanks for letting us know. This seems to be a problem with user-defined functions, since built-in functions appear to work fine.

    For this particular example I would use Table(Choose(x<0,2,x>=0,0),[x,-4,4,1],y).

    Stephen

    I tried his workaround but was unable to get it to work and responded with

    Shakey,
    I accepted your answer too readily. The use of a built-in function (at least Choose) does not solve the problem. See below.


    The particular bug that I am questioning has dogged me a number of times in using MS. From reading the forum, I get the impression that there are a number of other math or programming bugs in MS and that these bugs do not seem to be getting the attention that I feel they deserve. Don't get me wrong. I think that MS is a fabulous program and appreciate tremendously the ability to have such a program on my iPad at such a bargain price. But in my opinion the main function of computational software is to compute so that fixing bugs that impede computation should be getting at least as much attention as adding features or improving user interfaces but I have seen no acknowledgement that they are.

    Mike

    img src="http://www.mathstudio.net/forums/uploads/FileUpload/63/445c65db0681460e7c3abbb024e67e.png" />
    anotherBug.PNG
    768 x 1024 - 70K
  • I would love to attempt to replicate this issue. Can you post a simple, textual, test case? Thank you.
  • I am not quite certain what you are asking for when you ask for a simple textual test case, so I may not be answering your request but here goes.

    One case is computing Table(Choose(Abs(x)<.0001,1,Abs(x)>=.0001,sin(x)/x),[x,-4,4,1],y). This gives the correct table values for all values of x other than zero, but returns error for that entry. However, if I define f(x)=Choose(Abs(x)<.0001,1,Abs(x)>=.0001,sin(x)/x) and compute f(0) then it computes correctly. And if with this definition I try to compute the the table Table[f(x),[x,-4,4,1],y) then I again get an error for x=0.

    Shakey has commented earlier that this may be related to a similar error in which I define a script such as:

    Name=sinc
    Parameters=w
    if(w==0)
    g=1
    else
    g=sin(x)/x
    end
    g


    Computing sinc(0) returns 1 but computing Table[sinc(f),[-4,4,1],d) returns an error for f of 0.

    And if I change the code slightly to:

    Name=sinc
    Parameters=w
    if(abs(w)<.00010)
    g=1
    else
    g=sin(x)/x
    end
    g


    and then attempt to compute the table I get an error message with an exclamation point inside a red circle stating:
    Function: Table
    Error: Too many variables

    although the code still works if I compute sinc(0) by itself.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Login with Facebook Sign In with Google Sign In with OpenID Sign In with Twitter

In this Discussion