Menu

#3939 Add string to all outputs

None
not-a-bug
nobody
5
2022-02-09
2022-02-09
Kirill
No

Dear Maxima community
- I have a C++ program that has coefficients (fractions with polynomials), which need to be simplified. It sends the coefficients to Maxima's stdin and reads stdout. But I faced with the problem that it is difficult to understand at what point of output the simplified coefficient ends.
- @robert_dodier suggested make linel very large then the end of output will be newline symbol. But this option doesn't suite work me since I dont'n now in advance how large coefficients can be. It will be very bad if I specify some large number, but after a while (maybe even a week) the program will abort, since the coefficient will be too large.
- I am using ratsimp(...);print("#")$ to solve this problem now. I didn't find a command like "add_to_all_outputs(...)" in the documentation, although it seems that it would be useful. Then it would be possible to write (pseudocode):

>>add_to_all_outputs("#")$
>>ratsimp(COEF_1);
<<SIMPLIFIED_COEF1#
>>ratsimp(COEF_2);
<<SIMPLIFIED_COEF2#

Moreover, the more the coefficient needs to be simplified, the greater the benefit of the command, since it is not necessary to forward "print(...)$" every time.

Thanks in advance.

Discussion

  • Jaime E. Villate

    • status: open --> not-a-bug
     
  • Jaime E. Villate

    This discussion does not belong in this bug tacking system.

     
    • Robert Dodier

      Robert Dodier - 2022-02-09

      Jaime, just flatly stating this isn't the right forum for this question is, um, not user friendly. It would be better to say what the right forum is (presumably maxima-discuss).

       
  • Gunter Königsmann

    What happens if you run your result through sconcat? In theory that would convert the result to a string that isn't interrupted by linebreaks. Afterwards you might want to tell maxima to write that string into a file...

     
  • Robert Dodier

    Robert Dodier - 2022-02-09

    Kirill, it would help a lot for you to give an example of the input you are working with and what you want to get as the output. In particular, it's not clear why the program can run for a long time; maybe you can say more about that.

    The best audience for questions like this is the maxima-discuss mailing list. See: https://sourceforge.net/projects/maxima/lists/maxima-discuss Please send any further messages on this topic to the mailing list.

     
    • Leo Butler

      Leo Butler - 2022-02-09

      Kirill, you want to use the alt-display package.

      https://maxima.sourceforge.io/docs/manual/maxima_176.html

      See the second example for the set_prompt command.

      Leo

       

Log in to post a comment.