janhardo

700 Reputation

12 Badges

11 years, 41 days

MaplePrimes Activity


These are replies submitted by janhardo

@salim-barzani 

It is not yet a definitive code that can handle all non-linear pdes .
The procedure code must be modified for certain types of pde 
So specify the pde ...

restart; with(PDEtools); with(Physics); declare(u(x, t), complex)

u(x, t)*`will now be displayed as`*u

(1)

NULL

NULL

SplitPDE := proc (pde_expr) local expr, terms, term, linear_terms, nonlinear_terms, i, u_count, conj_u_count, total_count; expr := lhs(pde_expr)-rhs(pde_expr); printf("Original PDE: %a = 0\n\n", expr); terms := [op(expand(expr))]; printf("Terms in PDE:\n"); print(terms); printf("\n"); printf("Analyzing terms:\n"); linear_terms := []; nonlinear_terms := []; for i to nops(terms) do term := op(i, terms); u_count := numboccur(term, u(x, t)); conj_u_count := numboccur(term, conjugate(u(x, t))); total_count := u_count+conj_u_count; printf("Term %d: %a\n", i, term); printf("   u count: %d, conjugate(u) count: %d\n", u_count, conj_u_count); if total_count = 1 and conj_u_count = 0 then linear_terms := [op(linear_terms), term] else nonlinear_terms := [op(nonlinear_terms), term] end if end do; printf("\nLinear terms:\n"); print(`+`(op(linear_terms))); printf("\nNonlinear terms:\n"); print(`+`(op(nonlinear_terms))); printf("\nVerification:\n"); if simplify(expr-(`+`(op(linear_terms)))-(`+`(op(nonlinear_terms)))) = 0 then printf("Verification passed!\n") else printf("Verification failed! Difference:\n"); print(simplify(expr-(`+`(op(linear_terms)))-(`+`(op(nonlinear_terms))))) end if; return `+`(op(linear_terms)), `+`(op(nonlinear_terms)) end proc

pde := u(x, t)+I*(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) = 0

u(x, t)+I*(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 = 0

(2)

linear_part, nonlinear_part := SplitPDE(pde)

Original PDE: u(x,t)+I*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 = 0

Terms in PDE:

 

[u(x, t), I*(diff(diff(u(x, t), x), x)), 2*u(x, t)*(diff(u(x, t), x))*conjugate(u(x, t)), 2*u(x, t)^2*(diff(conjugate(u(x, t)), x)), u(x, t)^3*conjugate(u(x, t))^2]

 


Analyzing terms:
Term 1: u(x,t)
   u count: 1, conjugate(u) count: 0
Term 2: I*diff(diff(u(x,t),x),x)
   u count: 1, conjugate(u) count: 0
Term 3: 2*u(x,t)*diff(u(x,t),x)*conjugate(u(x,t))
   u count: 3, conjugate(u) count: 1
Term 4: 2*u(x,t)^2*diff(conjugate(u(x,t)),x)
   u count: 2, conjugate(u) count: 1
Term 5: u(x,t)^3*conjugate(u(x,t))^2
   u count: 2, conjugate(u) count: 1

Linear terms:

 

u(x, t)+I*(diff(diff(u(x, t), x), x))

 


Nonlinear terms:

 

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

 


Verification:
Verification passed!

 

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

(3)

pde := I*(diff(u(x, t), t))+diff(u(x, t), x, x)+alpha*abs(u(x, t))^2*u(x, t)+beta*u(x, t)^2*(diff(conjugate(u(x, t)), x))+delta*abs(u(x, t))^4*u(x, t) = 0

I*(diff(u(x, t), t))+diff(diff(u(x, t), x), x)+alpha*abs(u(x, t))^2*u(x, t)+beta*u(x, t)^2*(diff(conjugate(u(x, t)), x))+delta*abs(u(x, t))^4*u(x, t) = 0

(4)

linear_part, nonlinear_part := SplitPDE(pde)

Original PDE: I*diff(u(x,t),t)+diff(diff(u(x,t),x),x)+alpha*abs(u(x,t))^2*u(x,t)+beta*u(x,t)^2*diff(conjugate(u(x,t)),x)+delta*abs(u(x,t))^4*u(x,t) = 0

Terms in PDE:

 

[I*(diff(u(x, t), t)), diff(diff(u(x, t), x), x), alpha*abs(u(x, t))^2*u(x, t), beta*u(x, t)^2*(diff(conjugate(u(x, t)), x)), delta*abs(u(x, t))^4*u(x, t)]

 


Analyzing terms:
Term 1: I*diff(u(x,t),t)
   u count: 1, conjugate(u) count: 0
Term 2: diff(diff(u(x,t),x),x)
   u count: 1, conjugate(u) count: 0
Term 3: alpha*abs(u(x,t))^2*u(x,t)
   u count: 2, conjugate(u) count: 0
Term 4: beta*u(x,t)^2*diff(conjugate(u(x,t)),x)
   u count: 2, conjugate(u) count: 1
Term 5: delta*abs(u(x,t))^4*u(x,t)
   u count: 2, conjugate(u) count: 0

Linear terms:

 

I*(diff(u(x, t), t))+diff(diff(u(x, t), x), x)

 


Nonlinear terms:

 

alpha*abs(u(x, t))^2*u(x, t)+beta*u(x, t)^2*(diff(conjugate(u(x, t)), x))+delta*abs(u(x, t))^4*u(x, t)

 


Verification:
Verification passed!

 

I*(diff(u(x, t), t))+diff(diff(u(x, t), x), x), alpha*abs(u(x, t))^2*u(x, t)+beta*u(x, t)^2*(diff(conjugate(u(x, t)), x))+delta*abs(u(x, t))^4*u(x, t)

(5)
 

NULL

Download onderzoek_termen_in_niet_linear_pde5-6-2025mprimes.mw

Checked the procedure with the classical  non -lineair schrodinger eq 
Do you have a idea what are the lineair and non linear parts of your pde

splitsing_pde_conjugate_vorm_4-6-2025mprimes_A.mw

"Ai is trash in 100 time just one time work , when i am stuck i will post here and my work is rare i cant find it any where i have to do step by step,  many thanks for you"

You can't use ai , so this is not a good  attitude , rather simplistic 

@salim-barzani 

assume(A < 0, 0 < C); printf("Original ODE before rewriting (with B = -2AC):\n"); ode_orig := (diff(G(xi), xi))^2 = A^2+(2*A*(-2*A*C))*G(xi)+2*A*C*G(xi)^2+(2*(-2*A*C))*C*G(xi)^3+C^2*G(xi)^4; ode_orig; printf("\nRewritten ODE (after completing the square):\n"); ode := diff(G(xi), xi) = A+C*G(xi)^2-2*A*C*G(xi); ode; sol_general := dsolve(ode, G(xi)); printf("\nExplicit solution (after simplification):\n"); explicit_sol := `assuming`([simplify(sol_general)], [A < 0, 0 < C]); explicit_sol; printf("\nVerification using odetest:\n"); odetest_result := odetest(explicit_sol, ode); `assuming`([simplify(odetest_result)], [A < 0, 0 < C]); G1 := proc (xi) options operator, arrow; -((1/2)*sqrt(-2*A*C)+(1/2)*sqrt(-6*A*C)*tanh((1/2)*sqrt(-6*A*C)*xi))/C end proc; G2 := rhs(explicit_sol); G2fun := unapply(G2, xi); printf("\nDifference between both solutions (should be 0):\n"); diffG := `assuming`([simplify(G1(xi)-G2fun(xi))], [A < 0, 0 < C]); diffG

Original ODE before rewriting (with B = -2AC):

 

(diff(G(xi), xi))^2 = A^2-4*A^2*C*G(xi)+2*A*C*G(xi)^2-4*A*C^2*G(xi)^3+C^2*G(xi)^4

 


Rewritten ODE (after completing the square):

 

diff(G(xi), xi) = A+C*G(xi)^2-2*A*C*G(xi)

 


Explicit solution (after simplification):

 

G(xi) = (A*C-tanh(C^(1/2)*(-A*C+1)^(1/2)*(-A)^(1/2)*(c__1+xi))*C^(1/2)*(-A*C+1)^(1/2)*(-A)^(1/2))/C

 


Verification using odetest:

 

0

 


Difference between both solutions (should be 0):

 

(1/2)*(2*tanh(C^(1/2)*(-A*C+1)^(1/2)*(-A)^(1/2)*(c__1+xi))*C^(1/2)*(-A*C+1)^(1/2)*(-A)^(1/2)-2*A*C-2^(1/2)*C^(1/2)*(-A)^(1/2)-2^(1/2)*3^(1/2)*C^(1/2)*(-A)^(1/2)*tanh((1/2)*6^(1/2)*C^(1/2)*(-A)^(1/2)*xi))/C

(1)

no simplification ..  doing by maple xperts ..
 

another proofmethod that both solutions functions are the same at G1,2(0)

G1 := proc (xi) options operator, arrow; -(1/2)*(sqrt(-2*A*C)+sqrt(-6*A*C)*tanh((1/2)*sqrt(-6*A*C)*xi))/C end proc; G2 := proc (xi) options operator, arrow; (A*C-sqrt(A^2*C^2-A*C)*tanh(sqrt(A^2*C^2-A*C)*xi+_C1))/C end proc; eq := `assuming`([simplify(G1(0) = G2(0))], [A < 0, C > 0]); C1sol := solve(eq, _C1); C1sol

proc (xi) options operator, arrow; -(1/2)*(sqrt(-2*A*C)+sqrt(-6*A*C)*tanh((1/2)*sqrt(-6*A*C)*xi))/C end proc

 

proc (xi) options operator, arrow; (A*C-sqrt(A^2*C^2-A*C)*tanh(sqrt(A^2*C^2-A*C)*xi+_C1))/C end proc

 

-(1/2)*2^(1/2)*(-A)^(1/2)/C^(1/2) = (A*C-C^(1/2)*(-A*C+1)^(1/2)*(-A)^(1/2)*tanh(_C1))/C

 

arctanh((1/2)*(2*A*C^(3/2)+2^(1/2)*(-A)^(1/2)*C)/(C*(-A*C+1)^(1/2)*(-A)^(1/2)))

(2)

``

Download G25_via_maple_nu_-wel_in_mathematica_mprimes3-6-2025.mw

@salim-barzani 

try again...


Wolfram cloud confirms that with this constraints this is the solution ? ..now in Maple 

@salim-barzani Mathematica and Maple can't give a confirmation of G25  for this ode2 that it is a solution ?

@janhardo 
 "after equation 24 the reds one is not satisfy the equation i have to use equation 4-5 condition but i don't know how they use and satisfy the ode "

what  ode for this ?
its not the ode from ode-test-36.mw 

@salim-barzani 

Makes no difference this solution for a odetest in the Ricatti ode, as it seems ?





 

eq5_naar_class1_via_bernouilli_mprimes_30-5-2025.mw

Solving the Bernoulli equation:

@salim-barzani 


start with equation(6) 
 

2 3 4 5 6 7 8 Last Page 4 of 73