Identifying Infinity, Indeterminate, etc

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
5
down vote

favorite
1












I am doing a calculation and sometimes in the middle of the calculation a parameter evaluates to the following



ft = 3/2 (Interval[-∞, ∞] - 
0.182269836621496581329460089919307050446571501722246222934`32.
(Interval[Indeterminate, Indeterminate] +
Interval[-∞, ∞]) -
0.0509521859494036386356673163441370150570327833689743828576`32.
(Interval[Indeterminate, Indeterminate] +
Interval[-∞, ∞]));


I am trying to identify the "Infinity" "Interval" "Indeterminate" so I can stop the calculation and warn the user. I do the following



Print[MemberQ[N[uSolz],ComplexInfinity]];
Print[MemberQ[N[uSolz],Infinity]];
Print[MemberQ[N[uSolz],Indeterminate]];
Print[MemberQ[N[uSolz],Indeterminate]];


or



Print[StringMemberQ[ToString[uSolz],"Indeterminate"]]


or I evaluated my function in some points because normally uSolz has r as a variable.



rrange=N[Range[0,2,(0-2)/1000]];
Print[N[uSolz/.r->rrange]];


From above I was hoping to get some infinity etc.



None of them worked for me.
Any ideas?










share|improve this question



















  • 2




    maybe Not@FreeQ[#, DirectedInfinity[_] | Indeterminate, 0, Infinity] &@N[uSolz]?
    – kglr
    4 hours ago






  • 2




    I'd replace DirectedInfinity[_] with _DirectedInfinity in @kglr's pattern, so that ComplexInfinity is caught as well.
    – J. M. is somewhat okay.♦
    4 hours ago










  • @J.M. good point. DirectedInfinity[___] works as well but is longer.
    – kglr
    4 hours ago










  • @kglr @ J.M It looks like it is working :) , thank you.
    – Erdem
    3 hours ago














up vote
5
down vote

favorite
1












I am doing a calculation and sometimes in the middle of the calculation a parameter evaluates to the following



ft = 3/2 (Interval[-∞, ∞] - 
0.182269836621496581329460089919307050446571501722246222934`32.
(Interval[Indeterminate, Indeterminate] +
Interval[-∞, ∞]) -
0.0509521859494036386356673163441370150570327833689743828576`32.
(Interval[Indeterminate, Indeterminate] +
Interval[-∞, ∞]));


I am trying to identify the "Infinity" "Interval" "Indeterminate" so I can stop the calculation and warn the user. I do the following



Print[MemberQ[N[uSolz],ComplexInfinity]];
Print[MemberQ[N[uSolz],Infinity]];
Print[MemberQ[N[uSolz],Indeterminate]];
Print[MemberQ[N[uSolz],Indeterminate]];


or



Print[StringMemberQ[ToString[uSolz],"Indeterminate"]]


or I evaluated my function in some points because normally uSolz has r as a variable.



rrange=N[Range[0,2,(0-2)/1000]];
Print[N[uSolz/.r->rrange]];


From above I was hoping to get some infinity etc.



None of them worked for me.
Any ideas?










share|improve this question



















  • 2




    maybe Not@FreeQ[#, DirectedInfinity[_] | Indeterminate, 0, Infinity] &@N[uSolz]?
    – kglr
    4 hours ago






  • 2




    I'd replace DirectedInfinity[_] with _DirectedInfinity in @kglr's pattern, so that ComplexInfinity is caught as well.
    – J. M. is somewhat okay.♦
    4 hours ago










  • @J.M. good point. DirectedInfinity[___] works as well but is longer.
    – kglr
    4 hours ago










  • @kglr @ J.M It looks like it is working :) , thank you.
    – Erdem
    3 hours ago












up vote
5
down vote

favorite
1









up vote
5
down vote

favorite
1






1





I am doing a calculation and sometimes in the middle of the calculation a parameter evaluates to the following



ft = 3/2 (Interval[-∞, ∞] - 
0.182269836621496581329460089919307050446571501722246222934`32.
(Interval[Indeterminate, Indeterminate] +
Interval[-∞, ∞]) -
0.0509521859494036386356673163441370150570327833689743828576`32.
(Interval[Indeterminate, Indeterminate] +
Interval[-∞, ∞]));


I am trying to identify the "Infinity" "Interval" "Indeterminate" so I can stop the calculation and warn the user. I do the following



Print[MemberQ[N[uSolz],ComplexInfinity]];
Print[MemberQ[N[uSolz],Infinity]];
Print[MemberQ[N[uSolz],Indeterminate]];
Print[MemberQ[N[uSolz],Indeterminate]];


or



Print[StringMemberQ[ToString[uSolz],"Indeterminate"]]


or I evaluated my function in some points because normally uSolz has r as a variable.



rrange=N[Range[0,2,(0-2)/1000]];
Print[N[uSolz/.r->rrange]];


From above I was hoping to get some infinity etc.



None of them worked for me.
Any ideas?










share|improve this question















I am doing a calculation and sometimes in the middle of the calculation a parameter evaluates to the following



ft = 3/2 (Interval[-∞, ∞] - 
0.182269836621496581329460089919307050446571501722246222934`32.
(Interval[Indeterminate, Indeterminate] +
Interval[-∞, ∞]) -
0.0509521859494036386356673163441370150570327833689743828576`32.
(Interval[Indeterminate, Indeterminate] +
Interval[-∞, ∞]));


I am trying to identify the "Infinity" "Interval" "Indeterminate" so I can stop the calculation and warn the user. I do the following



Print[MemberQ[N[uSolz],ComplexInfinity]];
Print[MemberQ[N[uSolz],Infinity]];
Print[MemberQ[N[uSolz],Indeterminate]];
Print[MemberQ[N[uSolz],Indeterminate]];


or



Print[StringMemberQ[ToString[uSolz],"Indeterminate"]]


or I evaluated my function in some points because normally uSolz has r as a variable.



rrange=N[Range[0,2,(0-2)/1000]];
Print[N[uSolz/.r->rrange]];


From above I was hoping to get some infinity etc.



None of them worked for me.
Any ideas?







pattern-matching






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 2 mins ago









Carl Woll

60.5k279155




60.5k279155










asked 4 hours ago









Erdem

418210




418210







  • 2




    maybe Not@FreeQ[#, DirectedInfinity[_] | Indeterminate, 0, Infinity] &@N[uSolz]?
    – kglr
    4 hours ago






  • 2




    I'd replace DirectedInfinity[_] with _DirectedInfinity in @kglr's pattern, so that ComplexInfinity is caught as well.
    – J. M. is somewhat okay.♦
    4 hours ago










  • @J.M. good point. DirectedInfinity[___] works as well but is longer.
    – kglr
    4 hours ago










  • @kglr @ J.M It looks like it is working :) , thank you.
    – Erdem
    3 hours ago












  • 2




    maybe Not@FreeQ[#, DirectedInfinity[_] | Indeterminate, 0, Infinity] &@N[uSolz]?
    – kglr
    4 hours ago






  • 2




    I'd replace DirectedInfinity[_] with _DirectedInfinity in @kglr's pattern, so that ComplexInfinity is caught as well.
    – J. M. is somewhat okay.♦
    4 hours ago










  • @J.M. good point. DirectedInfinity[___] works as well but is longer.
    – kglr
    4 hours ago










  • @kglr @ J.M It looks like it is working :) , thank you.
    – Erdem
    3 hours ago







2




2




maybe Not@FreeQ[#, DirectedInfinity[_] | Indeterminate, 0, Infinity] &@N[uSolz]?
– kglr
4 hours ago




maybe Not@FreeQ[#, DirectedInfinity[_] | Indeterminate, 0, Infinity] &@N[uSolz]?
– kglr
4 hours ago




2




2




I'd replace DirectedInfinity[_] with _DirectedInfinity in @kglr's pattern, so that ComplexInfinity is caught as well.
– J. M. is somewhat okay.♦
4 hours ago




I'd replace DirectedInfinity[_] with _DirectedInfinity in @kglr's pattern, so that ComplexInfinity is caught as well.
– J. M. is somewhat okay.♦
4 hours ago












@J.M. good point. DirectedInfinity[___] works as well but is longer.
– kglr
4 hours ago




@J.M. good point. DirectedInfinity[___] works as well but is longer.
– kglr
4 hours ago












@kglr @ J.M It looks like it is working :) , thank you.
– Erdem
3 hours ago




@kglr @ J.M It looks like it is working :) , thank you.
– Erdem
3 hours ago










2 Answers
2






active

oldest

votes

















up vote
3
down vote













f = Not[FreeQ[#, _DirectedInfinity | Indeterminate, 0, ∞]]&
f @ ft



True







share|improve this answer



























    up vote
    0
    down vote













    Note that Infinity, Indeterminate etc. are not numbers:



    NumberQ[Infinity]
    NumberQ[Indeterminate]
    NumberQ[ComplexInfinity]



    False



    False



    False




    So, you can define a predicate to identify Interval objects with a non-number element:



    badIntervalQ[Interval[a__]] := AnyTrue[Flatten @ a, Not@*NumberQ]


    Check:



    FreeQ[ft, _Interval?badIntervalQ]



    False




    meaning that ft contains a bad interval.





    share




















      Your Answer




      StackExchange.ifUsing("editor", function ()
      return StackExchange.using("mathjaxEditing", function ()
      StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
      StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
      );
      );
      , "mathjax-editing");

      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "387"
      ;
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function()
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled)
      StackExchange.using("snippets", function()
      createEditor();
      );

      else
      createEditor();

      );

      function createEditor()
      StackExchange.prepareEditor(
      heartbeatType: 'answer',
      convertImagesToLinks: false,
      noModals: false,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      );



      );













       

      draft saved


      draft discarded


















      StackExchange.ready(
      function ()
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f183681%2fidentifying-infinity-indeterminate-etc%23new-answer', 'question_page');

      );

      Post as a guest






























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      3
      down vote













      f = Not[FreeQ[#, _DirectedInfinity | Indeterminate, 0, ∞]]&
      f @ ft



      True







      share|improve this answer
























        up vote
        3
        down vote













        f = Not[FreeQ[#, _DirectedInfinity | Indeterminate, 0, ∞]]&
        f @ ft



        True







        share|improve this answer






















          up vote
          3
          down vote










          up vote
          3
          down vote









          f = Not[FreeQ[#, _DirectedInfinity | Indeterminate, 0, ∞]]&
          f @ ft



          True







          share|improve this answer












          f = Not[FreeQ[#, _DirectedInfinity | Indeterminate, 0, ∞]]&
          f @ ft



          True








          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 3 hours ago









          kglr

          165k8188388




          165k8188388




















              up vote
              0
              down vote













              Note that Infinity, Indeterminate etc. are not numbers:



              NumberQ[Infinity]
              NumberQ[Indeterminate]
              NumberQ[ComplexInfinity]



              False



              False



              False




              So, you can define a predicate to identify Interval objects with a non-number element:



              badIntervalQ[Interval[a__]] := AnyTrue[Flatten @ a, Not@*NumberQ]


              Check:



              FreeQ[ft, _Interval?badIntervalQ]



              False




              meaning that ft contains a bad interval.





              share
























                up vote
                0
                down vote













                Note that Infinity, Indeterminate etc. are not numbers:



                NumberQ[Infinity]
                NumberQ[Indeterminate]
                NumberQ[ComplexInfinity]



                False



                False



                False




                So, you can define a predicate to identify Interval objects with a non-number element:



                badIntervalQ[Interval[a__]] := AnyTrue[Flatten @ a, Not@*NumberQ]


                Check:



                FreeQ[ft, _Interval?badIntervalQ]



                False




                meaning that ft contains a bad interval.





                share






















                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  Note that Infinity, Indeterminate etc. are not numbers:



                  NumberQ[Infinity]
                  NumberQ[Indeterminate]
                  NumberQ[ComplexInfinity]



                  False



                  False



                  False




                  So, you can define a predicate to identify Interval objects with a non-number element:



                  badIntervalQ[Interval[a__]] := AnyTrue[Flatten @ a, Not@*NumberQ]


                  Check:



                  FreeQ[ft, _Interval?badIntervalQ]



                  False




                  meaning that ft contains a bad interval.





                  share












                  Note that Infinity, Indeterminate etc. are not numbers:



                  NumberQ[Infinity]
                  NumberQ[Indeterminate]
                  NumberQ[ComplexInfinity]



                  False



                  False



                  False




                  So, you can define a predicate to identify Interval objects with a non-number element:



                  badIntervalQ[Interval[a__]] := AnyTrue[Flatten @ a, Not@*NumberQ]


                  Check:



                  FreeQ[ft, _Interval?badIntervalQ]



                  False




                  meaning that ft contains a bad interval.






                  share











                  share


                  share










                  answered 3 mins ago









                  Carl Woll

                  60.5k279155




                  60.5k279155



























                       

                      draft saved


                      draft discarded















































                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f183681%2fidentifying-infinity-indeterminate-etc%23new-answer', 'question_page');

                      );

                      Post as a guest













































































                      Comments

                      Popular posts from this blog

                      Long meetings (6-7 hours a day): Being “babysat” by supervisor

                      What does second last employer means? [closed]

                      One-line joke