How to Print Custom Messages in Mathematica?

  • Mathematica
  • Thread starter Pengwuino
  • Start date
  • Tags
    Mathematica
In summary, the person is having trouble printing their desired output in Mathematica and is seeking help on how to do so. They ask if there is a print command and are provided with the syntax to use it.
  • #1
Pengwuino
Gold Member
5,123
20
Ok i got a problem. Heres my mathematica file.

Im trying to find the critical points and describe them but i don't know how to print stuff in mathematica. How can i make it say instead of like putting...

d[x1, y1]

to find the descriminant (i already setup the function as you can see in the file). How can I do it so the actual output will say "The discriminant of this point is" whatever the number is (in this case, 238) instead if it just spitting out the number alone? Is there like a print command? Thanks for the help :)
 

Attachments

  • needsfixing.zip
    12.5 KB · Views: 207
Physics news on Phys.org
  • #2
ahhh help me guys :D
 
  • #3
Pengwuino said:
Ok i got a problem. Heres my mathematica file.

Im trying to find the critical points and describe them but i don't know how to print stuff in mathematica. How can i make it say instead of like putting...

d[x1, y1]

to find the descriminant (i already setup the function as you can see in the file). How can I do it so the actual output will say "The discriminant of this point is" whatever the number is (in this case, 238) instead if it just spitting out the number alone? Is there like a print command? Thanks for the help :)

Well, I didn't look at your file, something about cookies on my machine or whatever. But you can use a Print commant in Mathematica:

Print["The discrimant is: ",d[x1,y1]];
 

FAQ: How to Print Custom Messages in Mathematica?

1. What is the purpose of making comments in Mathematica?

Comments in Mathematica serve as notes or explanations within the code that are not executed by the program. They help to document and clarify the purpose and functionality of the code for the programmer and others who may read it.

2. How do I make comments in Mathematica?

To make a comment in Mathematica, use the symbol (* to begin the comment and *) to end it. Everything in between will be treated as a comment and will not be executed by the program. Alternatively, you can use (* *) to insert a comment that spans multiple lines.

3. Can I add comments to existing code in Mathematica?

Yes, you can add comments to existing code in Mathematica by placing the comment symbols (* and *) around the desired text. This will turn the selected text into a comment without affecting the rest of the code.

4. Is it necessary to use comments in Mathematica?

While it is not mandatory to use comments in Mathematica, it is considered good programming practice to include comments in your code. They can help you and others understand the code better and make it easier to maintain and modify in the future.

5. Can I use comments to disable certain parts of my code in Mathematica?

Yes, you can use comments to disable certain parts of your code in Mathematica. Simply place the comment symbols around the code you want to disable, and it will not be executed by the program. This can be useful for testing or troubleshooting purposes.

Similar threads

Replies
9
Views
474
Replies
2
Views
1K
Replies
2
Views
1K
Replies
6
Views
3K
Replies
4
Views
3K
Replies
2
Views
2K
Replies
1
Views
3K
Replies
1
Views
2K
Replies
2
Views
2K
Back
Top