dharr

Dr. David Harrington

8477 Reputation

22 Badges

21 years, 33 days
University of Victoria
Professor or university staff
Victoria, British Columbia, Canada

Social Networks and Content at Maplesoft.com

Maple Application Center
I am a retired professor of chemistry at the University of Victoria, BC, Canada. My research areas are electrochemistry and surface science. I have been a user of Maple since about 1990.

MaplePrimes Activity


These are replies submitted by dharr

@janhardo You have 

uxx := diff(u[0](x), x $ 2);

but u[0] is already a function of x, so it should be

uxx := diff(u[0], x $ 2);

This is the basic way to do it, with everything in a big loop.

@salim-barzani As I said before, 

-diff(u[i], x $ 2)*I + A[i]

should have some t dependence or you can't expect to correctly take a Laplce transform wrt t. So you need to put the dependence of t in here (or just have it in from the beginning).

@salim-barzani I didn't see where you divided by 2. P[1] looks the same in both versions?

Download P1.mw

int(convert(1/A, Heaviside), x=-1..1);

@salim-barzani Your T[n] in DrD.mw has conjugate(u[k]) outside the summation, so it just stays as k.

Interesting. Nested radicals frequently give me problems. It is interesting that solve thinks they are the same.

expr:=sqrt(x+2*sqrt(x-1));
expr2:=sqrt(x-1)+1;
solve(expr2-expr,x);

gives x.

Probably you can use polygon from the plottools package for this, but if you upload your worksheet using the green up-arrow in the Mapleprimes editor, someone will help you.

@salim-barzani You didn't attempt to use Diff - all your Q's are zero because your B1 are zero.

@salim-barzani Does Diff work for you?

restart

So if I understand correctly you want to carry out all the calculations omitting explicit dependence on x or t. So for example you want

Q := -2*alpha*u[0](x, t)*conjugate(u[0](x, t))*(diff(u[0](x, t), x))

-2*alpha*u[0](x, t)*conjugate(u[0](x, t))*(diff(u[0](x, t), x))

For some specific function. evalc assumes all variables real

f := t^2*cos(x)+I*t*exp(x); eval(Q, u[0](x, t) = f); Q1 := evalc(%)

t^2*cos(x)+I*t*exp(x)

-2*alpha*(t^2*cos(x)+I*t*exp(x))*conjugate(t^2*cos(x)+I*t*exp(x))*(-t^2*sin(x)+I*t*exp(x))

-(-2*alpha*t^4*cos(x)^2-2*alpha*t^2*(exp(x))^2)*t^2*sin(x)+I*(-2*alpha*t^4*cos(x)^2-2*alpha*t^2*(exp(x))^2)*t*exp(x)

But when you want to enter a short form without giving explicit x and t dependence, diff(u[0],x) gives zero. So you can use Diff to avoid this.

Q2 := -2*alpha*u[0]*conjugate(u[0])*(Diff(u[0], x))

-2*alpha*u[0]*conjugate(u[0])*(Diff(u[0], x))

Then when you want to evaluate it for an explicit function:
Next line needs subs, not eval

subs(u[0] = f, Q2); value(%); evalc(%); simplify(%-Q1)

-2*alpha*(t^2*cos(x)+I*t*exp(x))*conjugate(t^2*cos(x)+I*t*exp(x))*(Diff(t^2*cos(x)+I*t*exp(x), x))

-2*alpha*(t^2*cos(x)+I*t*exp(x))*conjugate(t^2*cos(x)+I*t*exp(x))*(-t^2*sin(x)+I*t*exp(x))

-(-2*alpha*t^4*cos(x)^2-2*alpha*t^2*(exp(x))^2)*t^2*sin(x)+I*(-2*alpha*t^4*cos(x)^2-2*alpha*t^2*(exp(x))^2)*t*exp(x)

0

NULL

Download Diff.mw

@salim-barzani I didn't understand that. Can you give a very simple example of where conjugate doesn't allow you to do something which you want to do?

@salim-barzani You say "for diff(conjugate(u(x,t)),x) i use v[i,x]", but diff(conjugate(u(x,t)),x) is a function of t but v[i,x] is not. So for example the Laplace transform wrt t of v[i,x] will not be correct. If you fix these things up, I'll take another look.

I don't exactly understand what you want, but here are some remarks:

1. The calculation needs to be done iteratively (I think the paper uses recursively where I would use iteratively). So you need to work out all the n=0 things before the n=1 and so on. You can have one big loop but you cannot work out, say, A[0]..A[4], before you work out u[0](x,t)..u[4](x,t).

2. For debugging at least I would not use "declare"; it hides what is really happening. For example u[0](x,t) will appear as u[0], but so will u[0]. When you define B[0], you use u[0] but I think this has to be entered as u[0](x,t).

3. You ask about mixing u[i] with u[i,x]. It seems you should never have u[i.x] - only ever one subscript. The display of derivatives as subscripts doesn't mean they are actually subscripts (see point 2). The paper says u(0,x) is an initial condition, but that should be u(x,0) since you have functions of (x,t). So you can have u[2](x,0) but never anything like v[0,x] (which should be diff(v[0](x,t),x) or perhaps it means an initial condition v(x,0) but for which there presumably is a missing subscript.)

4. It is bad practice to use both u(x,t) and u[0](x,t) since they are not independent of each other; instead use U(x,t) and u[0](x,t). It may work if you are not going to assign to u, but things are not what they seem - try u[0](x,t):=g; then eval(u);

@Christopher2222 Well, maybe the symbols were generated by some other calculation which might or might have made them co-linear, but I agree that getting the assumptions right makes using the geometry package frustrating. The hints about what to assume are not always as clear as in this case.

@rockyicer  You can make your permutation matrix for the permutation [1,2,3,4] -> [2,1,4,3] using.

P := IdentityMatrix(4)[[2, 1, 4, 3]]

or you can just do the permutations of the rows and columns by

Y4_R := Y4[[2, 1, 4, 3], [2, 1, 4, 3]];

@acer Nice. I thought I had tried that, but I guess not.

First 6 7 8 9 10 11 12 Last Page 8 of 89