Group Abstract Group Abstract

Message Boards Message Boards

0
|
278 Views
|
5 Replies
|
4 Total Likes
View groups...
Share
Share this post:

Example from Guide to Modern Physics ... cannot successfully input

Posted 20 days ago

I’m having some startup difficulty with the first example in Guide to Modern Physics (James W. Rohlf). The book has all the right topics but I cannot enter the examples successfully.

I am running Mathematica 14.3 on a Mac Book Pro with M5 Pro, OS Tahoe and 24 GB of memory. The file myFile.nb shows what I typed. Notice that the N[UnitConvert[e, C],4] does not give the expected answer. I am not sure what to type for e. If I use the Basic Math Paclet, e is that transcendental number, not the ElementaryCharge definition. I can get the correct answer with a copy/paste from the original Quantity definition. But notice that I copied 1 C, not just C.

Quantity["ElementaryCharge"]

returns e

Quantity["Coulambs"]

returns 1 C

N[UnitConvert[e,C]

returns UnitConvert[e,1 C],4]

N[UnitConvert[e,1 C],4]

returns 1.602 x 10-19

Then I went on Rohlf’s site and bought the files that contain the example Mathmatica code. They were not what I expected. It was just the code without any further explanation. I want to be able to type the code in, not use copy/paste.But if I copy/paste the code from this file, it works fine. And yes, the e is in italic, indicating it is the definition of ElementaryCharge. I don’t know how to input that number.

Because I bought the file from Rohlf, I don't think it is appropriate to include it. I may be breaking some copyright rule by posting a file that I bought in a forum. When I copy/paste I get

N[UnitConvert[e,C],4]

returns 1.602 x 10-19

I can also get the example to work by explicitly using Quantity to define ElementaryCharge and Coulambs, but that’s not what th example does.

N[UnitConvert[Quantity["ElementaryCharge"],Quantity["Coulombs"]],4

returns 1.602 x 10-19

So I don't know how to run this example the way that the book does. This is just the first example and I fear I may experience the same problem with the others. What am I doing wrong?

Attachments:
POSTED BY: Theodore Kubaska
5 Replies

Thank you guys very much for answering so promptly. Doing my taxes kept me from replying immediately.

The input shown in Rohlf's book and the file available for sale on his website do not show the intermediate steps. The supplied files are useful only if one prefers copy/paste and does not want to type in the equations.

I am not so much interested in the equations supplied by Rohlf. What I am trying to learn is how to input my own equations. So, copying and pasting from the supplied file is for me only an example. My interest is primarily in quantum mechanics and quantum computing.

Here's what I did (It's a slight modification of what Michael Rogers suggested) ...

N[UnitConvert[ctrl = 1 e Return, accept, ctrl = "Coulambs" Return],4]

For the second ctrl = I entered just "Coulambs" after the ctrl =. If I do the 1 C as Dr. Rogers suggested I get the correct answer but I see 1 C in my input and not just C as in the example.

I have 14.3 Mathematica running on a Mac Book Pro with Tahoe.

Attachments:
POSTED BY: Theodore Kubaska

If we type "CTRL-= Coulombs Return" we get what looks like a C, and if we evaluate it, its output looks like 1 C.

If we type "CTRL-= 1 Coulombs Return" we get 1 C both in the input and in the output.

To the kernel they are the same. The latter is a bit longer to type.

POSTED BY: Gianluca Gorni

Basically, the number 1 is optional in the input. By the way, the correct spelling is Coulomb, not Coulamb.

POSTED BY: Gianluca Gorni

It may help to ask for the InputForm of a strange symbol to discover a way to type it:

Quantity["ElementaryCharge"]
% // InputForm
POSTED BY: Gianluca Gorni

I don't know how Rohlf may intend for the reader/user to input the code. I would copy the output, not type it. Or type Quantity[…] explicitly. In the documentation for Quantity[], it is suggested that control-= can be used to input quantities. If I type:

  1. UnitConvert[ (my Mma shows [] with the insertion point between the brackets).
  2. CTRL-=
  3. "1", Space, "e", Return (3 characters plus return). It offers up the desired "e".
  4. Click the checkmark to accept it.
  5. "," (comma).
  6. CTRL-=
  7. "1", Space, "C", Return (3 characters plus return). It offers up one degree Celsius.
  8. Click the three-dot menu.
  9. In the popup menu, click the "more" menu.
  10. In the second popup menu, select "coulombs".
  11. Click the checkmark to accept it.
  12. Type the closing ] if needed.

Hope that helps.

POSTED BY: Michael Rogers
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard