janhardo

690 Reputation

12 Badges

11 years, 36 days

MaplePrimes Activity


These are replies submitted by janhardo

Adding more points and lines,circle 


 

protected names O and I   , that's why using O_ , I_   

with(plots); alpha := (1/4)*Pi; a := 2^alpha*exp(I*alpha); b := 2^(alpha+1)*exp(I*(alpha+(1/2)*Pi)); h := 1/(1/a+1/b); O_ := 0; A := a; B := b; H := h; I_ := (O_+H)*(1/2); J := (H+B)*(1/2); toCoords := proc (z) options operator, arrow; [Re(evalf(z)), Im(evalf(z))] end proc; pO := toCoords(O_); pA := toCoords(A); pB := toCoords(B); pH := toCoords(H); pI := toCoords(I_); pJ := toCoords(J); triangle := plot([pO, pA, pB, pO], color = blue, thickness = 2); points := pointplot([pO, pA, pB, pH, pI, pJ], symbol = solidcircle, color = red, symbolsize = 15); xaxis := textplot([[2, -.3, "Re(z)"]], font = [TIMES, BOLD, 12]); yaxis := textplot([[-.3, 2, "Im(z)"]], font = [TIMES, BOLD, 12]); makeLabel := proc (name, coords) textplot([coords[1]+0.5e-1, coords[2], cat(name, "(", sprintf("%.2f", coords[1]), ",", sprintf("%.2f", coords[2]), ")")]) end proc; labelO := makeLabel("O", pO); labelA := makeLabel("A", pA); labelB := makeLabel("B", pB); labelH := makeLabel("H", pH); labelI := makeLabel("I", pI); labelJ := makeLabel("J", pJ); display([triangle, points, xaxis, yaxis, labelO, labelA, labelB, labelH, labelI, labelJ], scaling = constrained, axes = normal, title = "Extended triangle OAB with points H, I, J", labels = ["Re(z)", "Im(z)"])

 

NULL


 

Download complexe_plotdriehoek_en_cirkel10-6-2025mprimes.mw

@jalal 
Hi,
a example to start with 

A := 1 + I;
B := 4 + 2*I;
C := 2 + 5*I;
punt := z -> [Re(z), Im(z)];
driehoek := plot([punt(A), punt(B), punt(C), punt(A)], color = blue, thickness = 2);
punten := pointplot([punt(A), punt(B), punt(C)], symbol = solidcircle, color = red, symbolsize = 15);
display([driehoek, punten], scaling = constrained, title = "Triangle in complex plane", axes = boxed);

It seems that the array notation is not suited for pattern matching in Maple ?

@jalal 
More intuiative with complex numbers ...

corrected code

restart;
with(DEtools);
with(plots);
with(LinearAlgebra);
f := y -> y^2*(1 - y^2);
sys := [diff(x(t), t) = -x(t), diff(y(t), t) = f(y(t))];
trajectories := [[x(0) = 1, y(0) = 1.5], [x(0) = -1, y(0) = 0.5], [x(0) = 0.5, y(0) = -1.5]];
phase_plot := DEplot(sys, [x(t), y(t)], t = 0 .. 10, trajectories, x = -2 .. 2, y = -2 .. 2, arrows = medium, dirfield = [20, 20], linecolor = blue, title = "Phase Portrait with Equilibrium Points");
equilibrium_points := pointplot([[0, 0], [0, 1], [0, -1]], symbol = solidcircle, color = black, symbolsize = 15);
display([phase_plot, equilibrium_points], scaling = constrained);
print("\n### DETAILED STABILITY ANALYSIS ###");
F := [-x, -y^4 + y^2];
J := Matrix([[diff(F[1], x), diff(F[1], y)], [diff(F[2], x), diff(F[2], y)]]);
print("\n1. Analysis for (0,0):");
J0 := eval(J, {x = 0, y = 0});
print("Jacobian:", J0);
print("Eigenvalues:", Eigenvalues(J0));
print("Conclusion:");
print("   - Eigenvalues: -1 and 0");
print("   - Non-hyperbolic point");
print("   - dy/dt ≈ y^2 > 0 for y ≈ 0");
print("   - ⇒ (0,0) is UNSTABLE");
print("\n2. Analysis for (0,1):");
J1 := eval(J, {x = 0, y = 1});
print("Jacobian:", J1);
print("Eigenvalues:", Eigenvalues(J1));
print("Conclusion:");
print("   - Eigenvalues: -1 and -2");
print("   - Both negative ⇒ STABLE NODE");
print("   - All nearby trajectories converge to this point");
print("\n3. Analysis for (0,-1):");
Jm1 := eval(J, {x = 0, y = -1});
print("Jacobian:", Jm1);
print("Eigenvalues:", Eigenvalues(Jm1));
print("Conclusion:");
print("   - Eigenvalues: -1 and +2");
print("   - Mixed eigenvalues ⇒ SADDLE POINT");
print("   - Stable in x-direction, unstable in y-direction");
print("   - ⇒ (0,-1) is UNSTABLE");
print("\n### VISUAL INTERPRETATION ###");
print("1. (0,0): Arrows point away in y-direction - unstable");
print("2. (0,1): All arrows point toward this point - stable");
print("3. (0,-1): Arrows approach in x-direction but diverge in y-direction - saddle point");
print("\n### SYSTEM BEHAVIOR SUMMARY ###");
print("The system exhibits:");
print("- One stable equilibrium at (0,1)");
print("- One unstable equilibrium at (0,0)");
print("- One saddle point at (0,-1)");
print("- Bistability between y=1 and y=-1 states");
print("- All x-values decay to 0 over time");
print("- y-direction determines long-term behavior");

Never trust ai , because node ( 0,-1) is not stable , when i examine it 

@salim-barzani 
You need help from a specialist , i don't know what you are after for.? 

@salim-barzani 

 

restart;
expr := abs(U[i](x, t))^n*diff(U[i](x, t), x);
expr_rewritten := subs(abs(U[i](x, t))^n = (U[i](x, t)*conjugate(U[i](x, t)))^(n/2), expr);
print(expr_rewritten);

"in here i want to seperate abs(U[i](x,t))^n=U[i](x,t)^n/2*conjugate(U[i](x,t))"   
I am guessing here, no direction where you are after for?

 


=======================================================================






 

 

 

 

@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

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