Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4545744
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T15:51:22+00:00 2026-05-21T15:51:22+00:00

I am trying to figure out the logic of Message behavior. Consider evaluation of

  • 0

I am trying to figure out the logic of Message behavior.

Consider evaluation of the following:

On[]
Sin[1,1]

After evaluating the above you will get about 830 (!) Messages (in Mathematica 7).

All these Messages have arisen during producing the one:

Sin::argx: Sin called with 2 arguments; 1 argument is expected. >>

(this is one but last Message).

The last Message

Message::trace: Message[Sin::argx,Sin,2] --> Null. >>

corresponds to finishing of the work of internal Mathematica‘s Message function. Most of the other Messages go from evaluation of $NewMessage and $MessagePrePrint.

My questions are:

1) Why there are no infinite loop of Message generation? If calling Message[Sin::argx,Sin,2] produces more than 830 other Messages why each of them does not produce similar number of Messages? How such behavior can be simulated (by writing an analog of Message)?

2) Is it possible to force Message do not produce any additional Messages when it is called in the tracing mode (I mean the mode after evaluating On[])?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T15:51:22+00:00Added an answer on May 21, 2026 at 3:51 pm

    It seems that I have found one way to achieve with built-in function Message what I want:

    Unprotect[Message];
    Message[_, HoldForm[Block[List[$MyMagicalTag$, ___], _]], _] := Null;
    Message[args___] /; 
       Block[{$MyMagicalTag$, Message}, Not@TrueQ[inMsg]] := 
      Block[{$MyMagicalTag$, inMsg = True, lastargs = HoldComplete[args]},
        Message[args]];
    Message[args___] /; 
       Block[{$MyMagicalTag$, 
         Message}, (inMsg && (HoldComplete[args] =!= lastargs))] := Null;
    Protect[Message];
    

    Now things work as expected:

    In[6]:= On[]
    In[7]:= Sin[1,1]//AbsoluteTiming
    During evaluation of In[7]:= Message::trace: Message[Sin::argx,Sin,2] --> Block[{$MyMagicalTag$,inMsg=True,lastargs=HoldComplete[Sin::argx,Sin,2]},Message[Sin::argx,Sin,2]]. >>
    During evaluation of In[7]:= Sin::argx: Sin called with 2 arguments; 1 argument is expected. >>
    During evaluation of In[7]:= AbsoluteTiming::trace: AbsoluteTiming[Sin[1,1]] --> {0.1502160,Sin[1,1]}. >>
    Out[7]= {0.1502160,Sin[1,1]}
    

    The only problem with the above is that CPU load is still high as you can see from the timings.

    Other tested cases also work correctly:

    In[8]:= 1+1//AbsoluteTiming
    During evaluation of In[8]:= Plus::trace: 1+1 --> 2. >>
    During evaluation of In[8]:= AbsoluteTiming::trace: AbsoluteTiming[1+1] --> {0.0400576,2}. >>
    Out[8]= {0.0400576,2}
    

    Thanks to Mr.Wizard for his help.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to figure out what logic should go into the different UIViewController methods
I'm trying to figure out the logic for creating tasks that have dependencies. In
I'm trying to figure out the logic of how to do this. I have
I'm having a great deal of difficulty trying to figure out the logic behind
Newbie trying to figure out how to get a Node.js application to authenticate and
I am having a hard time trying to figure out if the following design
I am trying to figure out the logic of setting up models for a
I have been trying to figure out the logic of upgrading web applications. Like
I am having some trouble trying to figure out the logic behind aligning the
So I'm trying to figure out what I'm doing wrong with this logic. It

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.