zenterix

405 Reputation

5 Badges

3 years, 125 days

MaplePrimes Activity


These are questions asked by zenterix

I am very confused by the y-value of the rightmost point on the plot below.

restart

I'd like to find the values of x for which x^2/(10^(-8)-x) = 5*10^(-3).

So I ask Maple to solve this equation.

evalf(solve(x^2/(10^(-8)-x) = 5*10^(-3)))

-0.5000010000e-2, 0.10000e-7

(1)

Do these solutions work?

eval(x^2/(10^(-8)-x), x = 1.0000*10^(-8)) = Float(infinity) 

eval(x^2/(10^(-8)-x), x = -0.5000010000e-2) = 0.5000000000e-2 NULL

Suppose I define the function

f := proc (x) options operator, arrow; x^2/(1/100000000-x) end proc = proc (x) options operator, arrow; x^2/(1/100000000-x) end proc 

f(10^(-8))

Error, (in f) numeric exception: division by zero

 

f(.999999*10^(-8)) = 0.9999980000e-2NULL

f(.99999*10^(-8)) = 0.9999800001e-3NULL

Now, the function seems continuous between these two points

plot(f, .99999*10^(-8) .. .999999*10^(-8))

 

It is late, and perhaps I am just tired and not seeing things clearly. I expected the topmost point on the right to have a y-value of 0.00999998, ie almost 0.01.

I expected that the bottom leftmost point to be 0.0009999800001, ie almost 0.001, and it is.

And I thus expected to show that there must be some x for which we have f(x)=0.005, which if I am not mistaken is between the two numbers. After all, 0.999998e-2-0.5e-2 = 0.499998e-2NULL

0.5e-2-0.9999800001e-3 = 0.4000020000e-2NULL

what am i missing here?


Download plotq.mw

I have a question about a calculation I was just trying to do. For some context, I am trying to calculate the pH of a solution of a weak acid in water. When the concentration of the weak acid is low enough, we need to consider the effect of ionization of the water itself (ie, autoprotolysis of water), since the order of magnitude of this ionization is the same as the order of magnitude of the ions due to the weak acid in this case of very low concentration.

There is a specific formula that can be used for this, which is shown below.

K_a is a constant that depends on the weak acid being considered, and K_w is a constant as well (for the autoprotolysis of water). I am interested in solving for the concentration of hydronium, given an initial concentration of the weak acid [HA]_initial.

I'd like to solve the equation for different values of [HA]_initial.

In the calculations below, I am trying to solve for [H__3*LinearAlgebra:-Transpose(O)] in the expression

K__a = ([H__3*LinearAlgebra:-Transpose(O)])([H__3*LinearAlgebra:-Transpose(O)]-K__w/[H__3*LinearAlgebra:-Transpose(O)])/(HA__initial+[-H__3*LinearAlgebra:-Transpose(O)]+K__w/[H__3*LinearAlgebra:-Transpose(O)])

Below, I use x as the concentration of hydronium [H__3*LinearAlgebra:-Transpose(O)] and K__a = 5*10^(-3), K__w = 10^(-14), HA__initial = 10^(-3)

evalf(solve((x^2-10^(-14))/(10^(-3)-x+10^(-14)/x) = 5*10^(-3), x))

0.854101976e-3-0.4e-11*I, -0.5854101969e-2-0.465063510e-12*I, -0.9e-11+0.3865063510e-11*I

(1)

If I use a manual simplification (noting that K__w is extremely small compared to reasonable values of [H__3*LinearAlgebra:-Transpose(O)], then I am able to get real solutions.

evalf(solve(x^2/(10^(-3)-x) = 5*10^(-3), x))

-0.5854101966e-2, 0.854101966e-3

(2)

Now, looking at the complex solutions, the imaginary parts are very small and the real parts of two of the three solutions match the real solutions above, so I guess perhaps I could have just ignored those complex parts.

On the other hand, if I try to do similar calculations but with HA__initial = 10^(-6), I get

evalf(solve((x^2-10^(-14))/(10^(-6)-x+10^(-14)/x) = 5*10^(-3), x))

0.1009702e-5-0.3e-11*I, -0.5000999802e-2-0.332050808e-12*I, -0.9902e-8+0.3132050808e-11*I

(3)

evalf(solve(x^2/(10^(-6)-x) = 5*10^(-3), x))

-0.5000999800e-2, 0.999800e-6

(4)

So here, I don't see a complex solution that looks like the positive real solution above. Which means that I am not sure if the equation with the complex solutions (which is not simplified) is useful to me (I am doing various such calculations with different values of "`HA__initial`)".

Download concentrations.mw

Today I was working on some plots involving pH, which is defined as -log_10 ([hydronium]), that is, the negative of the base 10 logarithm of the concentration of hydronium in a solution.

I reached an expression for a variable x that is a function of an initial concentration C_i.

I wanted to plot the pH given by -log_10 (0.0001+x).

Note that x(0)=0, and so for this latter plot we should have the point (0, 4).

I am not able to see any part of the plot near (0,4), as can be seen below.

plot(-log[10](0.1e-3+x))

 

x := -0.2550000000e-2+0.5000000000e-4*sqrt(2601.+(2.000000000*10^6)*C__i)

-0.2550000000e-2+0.5000000000e-4*(2601.+2000000.000*C__i)^(1/2)

(1)

plot(-log[10](0.1e-3+x))

 

I want to see the plot being 4 at C__i = 0.

 

Note that subs({C__i = 0}, x) = 0. and evalf(subs({C__i = 0}, -log[10](0.1e-3+x))) = 4.000000000 

NULL

plot(-log[10](0.1e-3+x), C__i = 0 .. 1)

 

plot(-log[10](0.1e-3+x), C__i = 0 .. 1, view = [0 .. 1, 1 .. 4])

 

plot(-log[10](0.1e-3+x), C__i = 0 .. 1, view = [0 .. .1, 1 .. 4])

 

NULL

Download plotatzero.mw

I am taking a course in quantum mechanics and trying to do the calculations in Maple.

In the worksheet below I try to solve a system of equations to find some constants. 

It isn't very relevant that the domain is physics. 

The issues I have are with manipulations of expressions (specifically, simplifications).

restart

Levine - Ch. 2.4 - Particle in a Rectangular Well

NULL

Define

s__1 := sqrt(2*m*(V__0-E))/`ℏ` = 2^(1/2)*(m*(V__0-E))^(1/2)/`ℏ`NULL

s__2 := -s__1 = -2^(1/2)*(m*(V__0-E))^(1/2)/`ℏ`NULL

NULLs := sqrt(2*m*E)/`ℏ` 

2^(1/2)*(m*E)^(1/2)/`ℏ`

(1)

`ψ__1`, `ψ__2` and `ψ__3` are wavefunctions.

`ψ__1` := proc (x) options operator, arrow; C*exp('s__1'*x) end proc = proc (x) options operator, arrow; C*exp('s__1'*x) end procNULL

`ψ__2` := proc (x) options operator, arrow; A*cos('s'*x)+B*sin('s'*x) end proc = proc (x) options operator, arrow; A*cos('s'*x)+B*sin('s'*x) end procNULL

`ψ__3` := proc (x) options operator, arrow; G*exp('s__2'*x) end proc = proc (x) options operator, arrow; G*exp('s__2'*x) end procNULL

NULL

assume(G <> 0, C <> 0)

NULL

I would also like to assume that A and B cannot both be zero simultaneously.


As can be seen above, there are four unknown constants, "A,B,C,"and G.

 

We can obtain values for these unknowns by imposing boundary conditions.

 

Some of the boundary conditions involve the first derivatives of the wavefunctions.

`&psi;__1,d` := D(`&psi;__1`) = proc (z) options operator, arrow; C*s__1*exp(s__1*z) end procNULL

`&psi;__2,d` := D(`&psi;__2`) = proc (z) options operator, arrow; -A*s*sin(s*z)+B*s*cos(s*z) end procNULL

`&psi;__3,d` := D(`&psi;__3`) = proc (z) options operator, arrow; G*s__2*exp(s__2*z) end procNULL

NULL

The boundary conditions are

NULL

`&psi;__1`(0) = `&psi;__2`(0)*`&psi;__2`(l) and `&psi;__2`(0)*`&psi;__2`(l) = `&psi;__3`(l)*(D(`&psi;__1`))(0) and `&psi;__3`(l)*(D(`&psi;__1`))(0) = (D(`&psi;__2`))(0)*(D(`&psi;__2`))(l) and (D(`&psi;__2`))(0)*(D(`&psi;__2`))(l) = (D(`&psi;__3`))(l)

NULL

My question is how to find the constants in Maple.

NULLNULL

In this problem, E < V__0 and m > 0.

 

assume(E < V__0, m > 0)

 

Solving the first boundary condition is easy.

expr1 := solve(`&psi;__1`(0) = `&psi;__2`(0), {C}) = {C = A}

NULL

Next, I solve the third boundary condition and sub in the result from solving the first boundary condition. We get B in terms of A.

expr3 := eval(solve(`&psi;__1,d`(0) = `&psi;__2,d`(0), {B}), expr1) = {B = A*(m*(V__0-E))^(1/2)/(m*E)^(1/2)}NULL

NULL

Already here it is not clear to me why Maple does not cancel the m's.

 

Next, consider the second boundary condition

expr2 := solve(`&psi;__2`(l) = `&psi;__3`(l), {G}) = {G = (A*cos(s*l)+B*sin(s*l))/exp(s__2*l)}

 

We can obtain G in terms of just A by subbing in previously found relationships, as follows

expr2 := simplify(subs(expr3, expr2))

{G = exp(2^(1/2)*m^(1/2)*(V__0-E)^(1/2)*l/`&hbar;`)*A*(sin(2^(1/2)*m^(1/2)*E^(1/2)*l/`&hbar;`)*(V__0-E)^(1/2)+cos(2^(1/2)*m^(1/2)*E^(1/2)*l/`&hbar;`)*E^(1/2))/E^(1/2)}

(4)

NULL

Finally, consider the fourth boundary condition.

solve(`&psi;__2,d`(l) = `&psi;__3,d`(l), {G})

{G = (m*E)^(1/2)*(A*sin(2^(1/2)*(m*E)^(1/2)*l/`&hbar;`)-B*cos(2^(1/2)*(m*E)^(1/2)*l/`&hbar;`))/((m*(V__0-E))^(1/2)*exp(-2^(1/2)*(m*(V__0-E))^(1/2)*l/`&hbar;`))}

(5)

expr4 := simplify(subs(expr3, solve(`&psi;__2,d`(l) = `&psi;__3,d`(l), {G})))

{G = (sin(2^(1/2)*m^(1/2)*E^(1/2)*l/`&hbar;`)*E^(1/2)-cos(2^(1/2)*m^(1/2)*E^(1/2)*l/`&hbar;`)*(V__0-E)^(1/2))*exp(2^(1/2)*m^(1/2)*(V__0-E)^(1/2)*l/`&hbar;`)*A/(V__0-E)^(1/2)}

(6)

result := simplify(subs(expr2, expr4))

{exp(2^(1/2)*m^(1/2)*(V__0-E)^(1/2)*l/`&hbar;`)*A*(sin(2^(1/2)*m^(1/2)*E^(1/2)*l/`&hbar;`)*(V__0-E)^(1/2)+cos(2^(1/2)*m^(1/2)*E^(1/2)*l/`&hbar;`)*E^(1/2))/E^(1/2) = (sin(2^(1/2)*m^(1/2)*E^(1/2)*l/`&hbar;`)*E^(1/2)-cos(2^(1/2)*m^(1/2)*E^(1/2)*l/`&hbar;`)*(V__0-E)^(1/2))*exp(2^(1/2)*m^(1/2)*(V__0-E)^(1/2)*l/`&hbar;`)*A/(V__0-E)^(1/2)}

(7)

At this point, we have this complicated expression.

 

The calculations above come from the book "Quantum Chemistry" by Levine. The variable "result" above should, after a few more steps of manipulating the expression, give us

 

(2*E-V__0)*sin(sqrt(2*mE)*l/`&hbar;`) = 2*sqrt(-E^2+E*V__0)*cos(sqrt(2*mE)*l/`&hbar;`)

(2*E-V__0)*sin(2^(1/2)*mE^(1/2)*l/`&hbar;`) = 2*(-E^2+E*V__0)^(1/2)*cos(2^(1/2)*mE^(1/2)*l/`&hbar;`)

(8)

 

I've done the calculation by hand. It is not difficult. The exponentials and the A cancel on each side and we are left with an equation involving sin(sl) and cos(sl) which easily comes out to the desired equation above.

I would like to be able to do it here in Maple.

The first thing I would do at this point is to start eliminating some of the clutter. For example, I would like to replace sqrt(2*mE)/`&hbar;` with s.

 

This is a first task (that I have asked about in a separate question).

 

Then, I would want Maple to do the cancellations for me, but I have already used "simplify".

 

Finally, I think I would like to collect terms involving cos and sin.

 

Here is what happens when I try to get Maple to solve the equations for me in one go

 

solve({`&psi;__1`(0) = `&psi;__2`(0), `&psi;__1,d`(0) = `&psi;__2,d`(0), `&psi;__2`(l) = `&psi;__3`(l), `&psi;__2,d`(l) = `&psi;__3,d`(l)}, {A, B, C, G})

{A = 0, B = 0, C = 0, G = 0}

(9)

Download solve_constants.mw

In a calculation, I obtained the following expression from Maple.

expr1:=A*sqrt(-m*(-V__0 + E))/sqrt(m*E)

A*(-m*(-V__0+E))^(1/2)/(m*E)^(1/2)

(1)

The first question I have is why the "m's don't cancel."

Next, consider the expression

expr2:=exp(sqrt(2)*sqrt(m)*sqrt(-V__0 + E)*l*I/`&hbar;`)

exp(I*2^(1/2)*m^(1/2)*(-V__0+E)^(1/2)*l/`&hbar;`)

(2)

simplify(expr2,[E-V__0=y])

exp(I*2^(1/2)*m^(1/2)*y^(1/2)*l/`&hbar;`)

(3)

simplify(expr2,[2*m=y])

exp(I*y^(1/2)*(-V__0+E)^(1/2)*l/`&hbar;`)

(4)

Why doesn't the simplification below work?

simplify(expr2,[2*m*(E-V__0)=y])

exp(I*2^(1/2)*m^(1/2)*(-V__0+E)^(1/2)*l/`&hbar;`)

(5)

I also tried with other commands

eval(expr2,2*m=y)

exp(I*2^(1/2)*m^(1/2)*(-V__0+E)^(1/2)*l/`&hbar;`)

(6)

eval(expr2,E-V__0=y)

exp(I*2^(1/2)*m^(1/2)*y^(1/2)*l/`&hbar;`)

(7)

eval(expr2,2*m*(E-V__0)=y)

exp(I*2^(1/2)*m^(1/2)*(-V__0+E)^(1/2)*l/`&hbar;`)

(8)

algsubs(2*m=y,expr2)

exp(I*y^(1/2)*(-V__0+E)^(1/2)*l/`&hbar;`)

(9)

algsubs(E-V__0=y,expr2)

exp(I*2^(1/2)*m^(1/2)*y^(1/2)*l/`&hbar;`)

(10)

algsubs(2*m*(E-V__0)=y,expr2)

exp(I*2^(1/2)*m^(1/2)*(-V__0+E)^(1/2)*l/`&hbar;`)

(11)
 

NULL

In reality, I would like to the entirety of sqrt(2m(E-V__0)/hbar) a variable by the name of s.

Download simplify_roots.mw

1 2 3 4 5 6 7 Last Page 1 of 20