zenterix

405 Reputation

5 Badges

3 years, 125 days

MaplePrimes Activity


These are replies submitted by zenterix

What I am doing is actually, just copying the real part from a complex solution that has a positive real part and subbing it in the original equation to check that it is a good solution.

In the case of the second example, the solution to the simplified equation (9.98*10e-7) does not solve the non-simplified equation very well (we get 9.7*10e-5 = 5*10e-5).

x=-0.005000999800, on the other hand, seems to solve the non-simplified equation perfectly. So why does Maple give an imaginary part to this solution?

I really need to understand numerical algorithms better.

@acer Alright. I have access to a newer version of Maple to install from the university here. I haven't installed simply because it's a bit of a hassle to do it. So I will do it now that I can see that there are definitely relevant improvements in the newer version

@acer 

I just have a question about the use of "combine" with a single argument as is being done in the worksheet you sent with improvements.

Finally, consider the fourth boundary condition.

restart

NULL

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

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

expr3 := B = A*sqrt((V__0-E)/E) = B = A*((V__0-E)/E)^(1/2) 

NULL

 

Here is what is done in the original worksheet:

expr4 := combine(eval(isolate(`ψ__2,d`(l) = `ψ__3,d`(l), G), expr3))

G = A*s*((-(-V__0+E)/E)^(1/2)*cos(s*l)-sin(s*l))*exp(-s__2*l)/s__2

(1)

Let's redo in steps. First, we simply isolate G

isolate(`ψ__2,d`(l) = `ψ__3,d`(l), G)

G = -(A*s*sin(s*l)-B*s*cos(s*l))/(s__2*exp(s__2*l))

(2)

After isolating G, we sub in an expression for B.

result := eval(isolate(`ψ__2,d`(l) = `ψ__3,d`(l), G), expr3)

G = -(A*s*sin(s*l)-A*((V__0-E)/E)^(1/2)*s*cos(s*l))/(s__2*exp(s__2*l))

(3)

NULL

My question is about the command "combine".

combine(result)

G = A*s*((-(-V__0+E)/E)^(1/2)*cos(s*l)-sin(s*l))*exp(-s__2*l)/s__2

(4)

When we use combine like this, what does it try to do exactly? I read the documentation, and "combine" takes a second argument specifying a set of transformations to use. It doesn't mention if there is a default value for this parameter.

 

From the command above, "combine" simply factors out common factors. Is what combine tries to do when it is used with one argument always just this type of factorization?

Download combine.mw

@acer 

Okay, I understand that I need to consider signs in order to think about simplifications.

Once I understood that I tried to replace an entire square root.

expr:=A*sqrt(x*y)

A*(x*y)^(1/2)

(1)

simplify(expr,[x*y=z])

A*z^(1/2)

(2)

simplify(expr,[sqrt(x*y)=z])

Error, (in simplify/siderels:-simplify/siderels) side relations must be polynomials in (name or function) variables

 

eval(expr,sqrt(x*y)=z)

A*z

(3)

algsubs(sqrt(x*y)=z,expr)

Error, (in algsubs) no variables appearing rationally in pattern

 
 

NULL

Not clear to me why these don't work. I need to read the documentation again.

Download subs_square_root.mw

@acer 

It did occur to me that the issue might be with the sign of m_1. I used "assuming" with one single "simplify" command. 

It did not occur to me that I would need to use a second "simplify" command wrapping the first and only then use "assuming".

@Scot Gould 

In the documentation I see the parameters side1, side2, ..., as being optional sets or lists. 

But the second and third arguments are expressions.

@C_R 

Is there some part of the documentation, book, or tutorial that you know of that might teach me a bit more about this sort of thing?

I would not have thought of squaring and taking the square root to obtain the desired simplification.

@C_R 

Ok, so simplify takes as first argument an expression to be simplified. solve returns an expression sequence. Only the first element of this expression sequence is simplified. The other elements are basically ignored (simplify accepts additional parameters that are names, sets, lists, etc) but not other expressions. (Actually, I just saw another reply saying that this behavior is weird and possibly a bug)

I have an additional question.

Consider one of the non-zero elements in (5).

How can I get Maple to simplify by eliminating the 2 in the denominator?

I am reading all I can about simplify in the documentation and also about collect but can't seem to acccomplish this.

@acer 

That does work, thanks. I guess I was hoping for some single command to do it.

@dharr 

To give some context as to where n comes from consider the thermodynamic equation

PV=nRT

Suppose we have a P_1 and a T_1. Then

V_1=nRT_1/P_1

which is a function of n.

Next consider the following equation

PV^g=k

which is a relationship between P and V for a specific type of thermodynamic process, namely, a reversible adiabatic process.

When we sub in P_1 and V_1 the result will be a function of n.

If we have a final pressure P_2 then we can use this equation to compute V_2, a function of n.

Finally, consider the integral of -PdV for this adiabatic process, which is a work integral.

int(k/V^g. V=V_1..V_2)

The integration limits are numbers times the variable n.

This is the type of integral I am asking about.

@C_R I don't quite understand what is going on in your answer.

1) dim_V

In (3) you aren't doing an assignment, so I'm not sure why you wrote that expression. Is dim_V some special type of variable name? Seems not to be. I can use any variable name in (4) and it still works.

Ie

int(n/v, v=n/t [m^3]..m/t [m^3]

works.

What is happening when we divide by some arbitrary variable?

I found the answer:

export exportCsvMatrix := proc(m:: Or(Matrix, list(Matrix)), fileName:: string)

ExportMatrix(fileName, m, target=csv):

end:

The documentation for this is here.

Honestly, I found it confusing because it appears that I could also use [Matrix] instead of list(Matrix) from that documentation but it doesn't work.

@Carl Love 

Interesting, if using strings is better then I will use them from now on.

You are right, there is no need to export these variables. In fact, the only reason they were declared as local variables is because the procedure that I showed is one that I refactored. That is I didn't write it from scratch. I erased the use of the variables, but forgot to remove the declarations.

@acer 

acer to the rescue. You solved it. That was the problem.

Finally, let me just say that everything I am trying to do with tables above I can do with lists and it works. That is, instead of having tables firstChevrons and chevrons that have as keys the nicely readable chevron2A, chevron2B, ... and as values Arrays of size 50 x 3, I can just use lists of these Arrays.

I just find it less readable and maintainable for the future.

So, the algorithm I am using above is correct. This is all a question of Maple's table.

1 2 3 4 5 6 7 Page 1 of 7