Message Boards Message Boards

Manipulate with two outputs?

Posted 2 years ago

Hello all, please do not fire at me, I am still a learner. Suppose I have a "Manipulate calculation" that gives me the wavelength (in nm) of a hydrogen electron passing from one orbital to another. The way I have built it is the following:

r = 1.097*10^7;   (*Rydberg constant*)

h = 6.62607*10^-34;  (*Planck constant*)

ev = 1.602176634*10^-19;  (*value of 1 eV*)

c = 2.99792458*10^8;  (*speed of light in vacuum*)

rh = 13.6; (*Rydberg constant in eV - lowest energy level*)

Then:

Manipulate[1/(r*((1/m^2) - (1/n^2)))*10^9, {m, 1, 9}, {n, 2, 9}]

gives me the wavelength, and:

Manipulate[-rh*((1/n^2)), {n, 1, 900}]

gives me the energy.

Is there a way that I can build a Manipulate calculation that gives me both in the same time?

Many thanks in advance, Mauro B.

6 Replies

Like this?

r = 1.09710^7;
h = 6.6260710^-34;
ev = 1.60217663410^-19;
c = 2.9979245810^8;
rh = 13.6;

Manipulate[
 wL = 1/(r ((1/m^2) - (1/n^2))) 10^9;
 en = -rh ((1/n^2));
 {wL, en},
 {m, 1, 9}, {n, 2, 9}]
POSTED BY: Hans Dolhaine

Brilliant! Thank you Sir !

Dear Hans,

what if I want to use one of the inputs of a calculation in Manipulate to express the energy?

Energy (in eV) of an orbital:

E = -Rh (1/n^2)

that would be :

Manipulate[-rh*((1/n^2)), {n, 1, 9, 1}]

But what I have in mind is to have a Manipulate that has an output of the wavelength, the different energy, and use that input of n to calculate the energy as above.

Likewise, I wanted to explore the use of the output from the calculation in Manipulate and come out with some other calculation, inside the Manipulate itself.

I am asking these questions because the ref. documentation only holds very simple examples.

Many thanks in advance! Mauro B.

I am afraid I do not understand what you want to do. I guess it is this?

r = 1.09710^7;
h = 6.6260710^-34;
ev = 1.60217663410^-19;
c = 2.9979245810^8;
rh = 13.6;
Dynamic /@ {wL, en}

Manipulate[
 wL = 1/(r ((1/m^2) - (1/n^2))) 10^9;
 en = -rh ((1/n^2));
 {wL, "  ", en},
 {m, 1, 9, 1}, {n, 2, 9, 1}]

And now do a (here nonsense) calculation with the values achieved in the Manipulate

Print[wL]
Print[en]
wL^2/Sin[en]
POSTED BY: Hans Dolhaine
Posted 2 years ago

Or maybe something along these lines?

Manipulate[
    x = a*b;
    z = x^c;
    Grid[{
        {"Product of a and b", x},
        {"The product raised to c", z}
    },
     Alignment -> {{Left, Right}, Automatic}, Spacings -> 2
    ],
    {{a, 2}, 0, 10, 1, Appearance -> "Labeled"},
    {{b, 3}, 0, 10, 1, Appearance -> "Labeled"},
    {{c, 4}, 0, 10, 1, Appearance -> "Labeled"},
    {x, None},
    {z, None}
 ]

enter image description here

POSTED BY: Hans Milton

Thank you, Sir ! This already increases my knowledge on W language. I just need to organize some stuff according to your example. Thank you so much!

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

Group Abstract Group Abstract