dharr

Dr. David Harrington

8340 Reputation

22 Badges

21 years, 5 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

15 minutes sounds about right.

@dharr The paper keeps 4 variables in A[i], with both diff(U(x,t),x) and diff(conjugate(U(x,t)),x) present. When I do that, I get the wrong coefficients for A[2], but the right number of terms, and the sums of subcripts = 2 as required. On the other hand in your post here you get the coefficients correct for A[2], but you do not have any diff(conjugate(U(x,t)),x).

There is definitely some difficulty about processing diff(conjugate(U(x,t)),x) that I do not understand - I have been careful to substitute for U(x,t) then conjugate so that the differentiation sees only expressions without conjugate. It's not clear to me how to proceed from here.

The whole process with the lambda's can be replaced by some recurrence formulas, but these have partial differentiation wrt the v[i] and again the conjugate variables make this hard to work out.

Laplace Adomian Decomposition method.

restart

with(Physics); with(inttrans)

pde0 := I*(diff(U(x, t), t))+diff(U(x, t), `$`(x, 2))+2*(diff(U(x, t)*conjugate(U(x, t)), x))*U(x, t)+U(x, t)^2*conjugate(U(x, t))^2*U(x, t)

I*(diff(U(x, t), t))+diff(diff(U(x, t), x), x)+(2*(diff(U(x, t), x))*conjugate(U(x, t))+2*U(x, t)*(diff(conjugate(U(x, t)), x)))*U(x, t)+U(x, t)^3*conjugate(U(x, t))^2

pde := expand(-I*pde0)

diff(U(x, t), t)-I*(diff(diff(U(x, t), x), x))-(2*I)*U(x, t)*(diff(U(x, t), x))*conjugate(U(x, t))-(2*I)*U(x, t)^2*(diff(conjugate(U(x, t)), x))-I*U(x, t)^3*conjugate(U(x, t))^2

Operator parts

LLu := diff(U(x, t), t); RRu := I*(diff(U(x, t), x, x)); NNu := -pde+LLu-RRu

diff(U(x, t), t)

I*(diff(diff(U(x, t), x), x))

(2*I)*U(x, t)*(diff(U(x, t), x))*conjugate(U(x, t))+(2*I)*U(x, t)^2*(diff(conjugate(U(x, t)), x))+I*U(x, t)^3*conjugate(U(x, t))^2

We treat each [U(x, t), diff(U(x, t), x), diff(conjugate(U(x, t)), x), conjugate(U(x, t))]like a simple variable v[1],..,v[4].

vars := [op(`minus`(indets(NNu), {t, x}))]; nvars := nops(vars); vvars := [seq(v[i], i = 1 .. nvars)]; NNv := subs(`~`[`=`](vars, vvars), NNu)

[U(x, t), diff(U(x, t), x), diff(conjugate(U(x, t)), x), conjugate(U(x, t))]

4

[v[1], v[2], v[3], v[4]]

(2*I)*v[1]*v[2]*v[4]+(2*I)*v[1]^2*v[3]+I*v[1]^3*v[4]^2

u[0] starts as the initial condition, form which we find A[0] and Ru[0]. vals[0] are the values of the 4 vvars corresponding to u[0]

u[0] := beta*exp(I*x); vals[0] := `assuming`([simplify(eval(subs(conjugate(U(x, t)) = conjugate(u[0]), U(x, t) = u[0], vars)))], [real]); A[0] := `assuming`([simplify(eval(NNv, `~`[`=`](vvars, vals[0])))], [real]); Ru[0] := `assuming`([simplify(eval(RRu, U(x, t) = u[0]))], [real])

beta*exp(I*x)

[beta*exp(I*x), I*beta*exp(I*x), -I*beta*exp(-I*x), beta*exp(-I*x)]

I*beta^5*exp(I*x)

-I*beta*exp(I*x)

Next iteration.
u[1] becomes a function of t for the next Laplace transform. Asym is redundant here seems to agree with A[1] below Eq 25 but I didn't check every term.
However A[1] here does not agree with the result in the numerical example.

n := 1; u[n] := invlaplace(laplace(Ru[n-1]+A[n-1], t, s)/s, s, t); vals[n] := `assuming`([simplify(eval(subs(conjugate(U(x, t)) = conjugate(u[n]), U(x, t) = u[n], vars)))], [real]); Asym[n] := eval(diff(subs({seq(v[j] = add(v[j][i]*lambda^i, i = 0 .. n), j = 1 .. nvars)}, NNv), `$`(lambda, n)), lambda = 0); A[n] := simplify(eval(diff(subs({seq(v[j] = add(vals[i][j]*lambda^i, i = 0 .. n), j = 1 .. nvars)}, NNv), `$`(lambda, n)), lambda = 0)); Ru[n] := `assuming`([simplify(eval(RRu, U(x, t) = u[n]))], [real])

1

I*exp(I*x)*(beta^5-beta)*t

[I*exp(I*x)*beta*(beta^4-1)*t, t*(-beta^5+beta)*exp(I*x), t*(-beta^5+beta)*exp(-I*x), -I*exp(-I*x)*beta*(beta^4-1)*t]

(2*I)*v[1][1]*v[2][0]*v[4][0]+(2*I)*v[1][0]*v[2][1]*v[4][0]+(2*I)*v[1][0]*v[2][0]*v[4][1]+(4*I)*v[1][0]*v[3][0]*v[1][1]+(2*I)*v[1][0]^2*v[3][1]+(3*I)*v[1][0]^2*v[4][0]^2*v[1][1]+(2*I)*v[1][0]^3*v[4][0]*v[4][1]

exp(I*x)*t*(-beta^9+beta^5)

exp(I*x)*beta*(beta^4-1)*t

Next iteration; of course this can be put in a for loop.

n := 2; u[n] := invlaplace(laplace(Ru[n-1]+A[n-1], t, s)/s, s, t); vals[n] := `assuming`([simplify(eval(subs(conjugate(U(x, t)) = conjugate(u[n]), U(x, t) = u[n], vars)))], [real]); Asym[n] := eval(diff(subs({seq(v[j] = add(v[j][i]*lambda^i, i = 0 .. n), j = 1 .. nvars)}, NNv), `$`(lambda, n)), lambda = 0); A[n] := simplify(eval(diff(subs({seq(v[j] = add(vals[i][j]*lambda^i, i = 0 .. n), j = 1 .. nvars)}, NNv), `$`(lambda, n)), lambda = 0)); Ru[n] := `assuming`([simplify(eval(RRu, U(x, t) = u[n]))], [real])

2

-(1/2)*exp(I*x)*(beta^9-2*beta^5+beta)*t^2

[-(1/2)*exp(I*x)*beta*(beta^8-2*beta^4+1)*t^2, -((1/2)*I)*exp(I*x)*beta*(beta^8-2*beta^4+1)*t^2, ((1/2)*I)*exp(-I*x)*beta*(beta^8-2*beta^4+1)*t^2, -(1/2)*exp(-I*x)*beta*(beta^8-2*beta^4+1)*t^2]

(12*I)*v[1][0]^2*v[4][0]*v[1][1]*v[4][1]+(4*I)*v[1][0]*v[2][0]*v[4][2]+(4*I)*v[1][1]*v[2][0]*v[4][1]+(6*I)*v[1][0]^2*v[4][0]^2*v[1][2]+(4*I)*v[1][0]^2*v[3][2]+(8*I)*v[1][0]*v[3][0]*v[1][2]+(8*I)*v[1][0]*v[3][1]*v[1][1]+(4*I)*v[1][0]*v[2][2]*v[4][0]+(4*I)*v[1][0]^3*v[4][0]*v[4][2]+(4*I)*v[1][2]*v[2][0]*v[4][0]+(2*I)*v[1][0]^3*v[4][1]^2+(4*I)*v[1][0]*v[2][1]*v[4][1]+(4*I)*v[1][1]^2*v[3][0]+(4*I)*v[1][1]*v[2][1]*v[4][0]+(6*I)*v[1][0]*v[4][0]^2*v[1][1]^2

-I*exp(I*x)*t^2*beta^5*(beta^8-2*beta^4+1)

((1/2)*I)*exp(I*x)*beta*(beta^8-2*beta^4+1)*t^2

 

 

Download Laplace_Adomiian_Decomposition_method_3.mw

@dharr This is how I would approach it, but there is something I'm not understanding about Eq 8.12 (aside from it suggesting setting lambda=0 before differentiating wrt lambda. I'm out of time for the next few days.

Laplace Adomian Decomposition method.

restart

with(Physics); with(inttrans)

pde0 := I*(Diff(U(x, t), t))+Diff(U(x, t), `$`(x, 2))+2*(Diff(U(x, t)*conjugate(U(x, t)), x))*U(x, t)+U(x, t)^2*conjugate(U(x, t))^2*U(x, t)

I*(Diff(U(x, t), t))+Diff(U(x, t), x, x)+2*(Diff(U(x, t)*conjugate(U(x, t)), x))*U(x, t)+U(x, t)^3*conjugate(U(x, t))^2

pde := expand(-I*pde0)

Diff(U(x, t), t)-I*(Diff(Diff(U(x, t), x), x))-(2*I)*U(x, t)*(Diff(U(x, t), x))*conjugate(U(x, t))-(2*I)*U(x, t)^2*(Diff(conjugate(U(x, t)), x))-I*U(x, t)^3*conjugate(U(x, t))^2

Operator parts

LLu := Diff(U(x, t), t); RRu := I*(Diff(U(x, t), x, x)); NNu := -pde+LLu-RRu

Diff(U(x, t), t)

I*(Diff(U(x, t), x, x))

I*(Diff(Diff(U(x, t), x), x))+(2*I)*U(x, t)*(Diff(U(x, t), x))*conjugate(U(x, t))+(2*I)*U(x, t)^2*(Diff(conjugate(U(x, t)), x))+I*U(x, t)^3*conjugate(U(x, t))^2-I*(Diff(U(x, t), x, x))

u[0] starts as the initial condition.

u[0] := beta*exp(I*x); A[0] := `assuming`([simplify(value(eval(NNu, U(x, t) = u[0])))], [real])

beta*exp(I*x)

I*beta^5*exp(I*x)

u[1] is a function of t for the next Laplace transform.

Ru[0] := `assuming`([simplify(value(eval(RRu, U(x, t) = u[0])))], [real]); u[1] := invlaplace(laplace(Ru[0]+A[0], t, s)/s, s, t)

-I*beta*exp(I*x)

I*exp(I*x)*(beta^5-beta)*t

Using Eq 8.12 - something wrong here or with the formula?

n := 1; `assuming`([(eval(diff(value(eval(NNu, U(x, t) = add(lambda^i*u[i], i = 0 .. n))), `$`(lambda, n)), lambda = 0))/factorial(n)], [real]); A[n] := `assuming`([simplify(eval(%))], [real])

1

(3*I)*u[0]^2*conjugate(u[0])^2*u[1]+(2*I)*u[0]^3*conjugate(u[0])*conjugate(u[1])

t*(-beta^9+beta^5)*exp(I*x)

NULL

NULL

Download Laplace_Adomiian_Decomposition_method_2.mw

@rlewis Click the green up-arrow; then choose the file, click upload, then click insert link. (Sometimes insert content doesn't work, though the link will usually work.

@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.

4 5 6 7 8 9 10 Last Page 6 of 87