Question about mathematics commands

  • Thread starter raymound
  • Start date
  • Tags
    Mathematics
In summary, the conversation discusses ways to comment out lines of code in different programming languages. The options mentioned include using symbols like "//" or "!" in languages like PHP and Fortran, using braces in Mathematica, or changing the cell properties in Mathematica to prevent evaluation. Another suggestion is to define a specific operator that would return Null and not evaluate any arguments.
  • #1
raymound
13
0
hi
I was going to ask if there's a way to command mathematica not to run a sentence or a part of a sentence as "//" works in php and "!" in fortran
 
Physics news on Phys.org
  • #2
You mean comment out a line?

(* This is a Mathematica comment *)
 
  • #3
yes,
is that the only way
isn't there any syntax like the ones in fortran or php?
 
  • #4
I don't think I follow...

This is a command // remove this bit in PHP (or C++)
This is a command ! remove this bit in Fortran
This is a command (* remove this bit in Mathematica *)
This is a command /* remove this bit in C */

The start and end braces mean you can have it mid-line, whereas the // and ! assume you mean 'comment out to the end of the line'.

a = b + c (* + d *) + e

will give you a = b + c + e
 
  • #5
thanks
 
  • #6
If the material you want to comment out is in a separate cell, or you position the cursor and divide the cell with <shift><ctrl>d to put the material in a separate cell, then you change the cell properties and make that a text cell or a Section cell or a SubSection cell or any other kind of cell that isn't evaluated.

Later you can merge the cells back together by selecting the desired cells and merging with <shift><ctrl>m

This would not be appropriate for some things.

Or... something perhaps much less appropriate. What if you picked one of the otherwise unused characters, defined it to be an operator, which is really just a function, set the attributes so that it would not evaluate any arguments and had the operator return Null. I am not certain all this could be done or that this would be a good idea.
 

1. What are some commonly used mathematical commands?

Some commonly used mathematical commands include addition (+), subtraction (-), multiplication (*), division (/), exponentiation (^), and square root (√).

2. How do I write a mathematical equation using commands?

To write a mathematical equation using commands, you can use symbols such as +, -, *, /, and ^. For example, the equation 2+3=5 can be written as 2+3=5.

3. Are there any shortcuts for using mathematical commands?

Yes, there are many shortcuts for using mathematical commands. Some common ones include using the asterisk (*) symbol for multiplication and the caret (^) symbol for exponentiation.

4. Can mathematical commands be used in other fields besides mathematics?

Yes, mathematical commands can be used in other fields such as physics, engineering, and finance. These fields often use complex equations and formulas that require the use of mathematical commands.

5. Are there any online resources for learning about mathematical commands?

Yes, there are many online resources for learning about mathematical commands. Some popular ones include Khan Academy, Math is Fun, and Mathway. These websites offer tutorials, practice problems, and interactive tools for learning and using mathematical commands.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
21
Views
5K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
984
  • MATLAB, Maple, Mathematica, LaTeX
Replies
9
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
2
Replies
36
Views
905
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
762
Back
Top