janhardo

690 Reputation

12 Badges

11 years, 36 days

MaplePrimes Activity


These are replies submitted by janhardo

@FZ 
Now with hyperbolic and trigionometric functions the expression becomes larger 

Download vraag_mprimes_7-3-2025veeenvoudig_lineaire_algebra.mw

 

 

 

 

The goal is to implement an expression of a discrete scalar plane-wave solution to the Klein-Gordon equation that makes use of the creation and annihilation operators in the Physics package.

NULL

We don't bother solving the Klein-Gordon equation explicitly. Instead, we just take a solution from literature. This approach is sufficient to show the difficulty in defining the the creation and annihilation operators.

 

Klein-Gordon equation explicitly

 

restart; with(PDEtools); with(Physics); with(Physics[Vectors]); declare(phi(X)); KG_eq := Physics[Vectors]:-`+`(Physics:-`*`(diff(d(x), x), Alembertian(phi(X))), Physics:-`*`(Physics:-`^`(m, 2), phi(X))) = 0; KG_solution := pdsolve(KG_eq, phi(X)); phi_classical := Sum(Physics[Vectors]:-`+`(Physics:-`*`(A[k], exp(-Physics:-`*`(Physics:-`*`(I, k), x))), Physics:-`*`(conjugate(A[k]), exp(Physics:-`*`(Physics:-`*`(I, k), x)))), k); Setup(quantumoperators = {a, ad}); phi_quantum := Sum(Physics[Vectors]:-`+`(Physics:-`*`(Physics:-`*`(Physics:-`*`(sqrt(2), exp(-Physics:-`*`(Physics:-`*`(I, k), x))), a[k]), Physics:-`^`(Physics:-`*`(2, sqrt(Physics:-`*`(V, omega[k]))), -1)), Physics:-`*`(Physics:-`*`(Physics:-`*`(sqrt(2), exp(Physics:-`*`(Physics:-`*`(I, k), x))), ad[k]), Physics:-`^`(Physics:-`*`(2, sqrt(Physics:-`*`(V, omega[k]))), -1))), k); Setup(algebrarules = {%Commutator(a[k], ad[kp]) = KroneckerDelta[k, kp]}); commutator_check := Expand(%Commutator(phi_quantum, phi_quantum)); KG_solution, phi_classical, phi_quantum, commutator_check

phi(X)*`will now be displayed as`*phi

 

`d'Alembertian`(phi(X))+m^2*phi(X) = 0

 

Error, (in pdsolve/info) first argument is not a differential equation

 

Sum(A[k]*exp(-I*k*x)+conjugate(A[k])*exp(I*k*x), k)

 

[quantumoperators = {a, ad}]

 

Sum((1/2)*2^(1/2)*exp(-I*k*x)*a[k]/(V*omega[k])^(1/2)+(1/2)*2^(1/2)*exp(I*k*x)*ad[k]/(V*omega[k])^(1/2), k)

 

[algebrarules = {%Commutator(a[k], ad[kp]) = Physics:-KroneckerDelta[k, kp]}]

 

0

 

KG_solution, Sum(A[k]*exp(-I*k*x)+conjugate(A[k])*exp(I*k*x), k), Sum((1/2)*2^(1/2)*exp(-I*k*x)*a[k]/(V*omega[k])^(1/2)+(1/2)*2^(1/2)*exp(I*k*x)*ad[k]/(V*omega[k])^(1/2), k), 0

(1.1.1)

NULL

restart; with(PDEtools); with(Physics); with(Physics[Vectors]); declare(phi(t, x, y, z)); KG_eq := Physics[Vectors]:-`+`(Physics[Vectors]:-`+`(Physics[Vectors]:-`+`(Physics[Vectors]:-`+`(diff(phi(t, x, y, z), t, t), -(diff(phi(t, x, y, z), x, x))), -(diff(phi(t, x, y, z), y, y))), -(diff(phi(t, x, y, z), z, z))), Physics:-`*`(Physics:-`^`(m, 2), phi(t, x, y, z))) = 0; KG_solution := pdsolve(KG_eq, phi(t, x, y, z)); phi_classical := Sum(Physics[Vectors]:-`+`(Physics:-`*`(A[k], exp(-Physics:-`*`(I, Physics[Vectors]:-`+`(Physics[Vectors]:-`+`(Physics[Vectors]:-`+`(Physics:-`*`(k_t, t), -Physics:-`*`(k_x, x)), -Physics:-`*`(k_y, y)), -Physics:-`*`(k_z, z))))), Physics:-`*`(conjugate(A[k]), exp(Physics:-`*`(I, Physics[Vectors]:-`+`(Physics[Vectors]:-`+`(Physics[Vectors]:-`+`(Physics:-`*`(k_t, t), -Physics:-`*`(k_x, x)), -Physics:-`*`(k_y, y)), -Physics:-`*`(k_z, z)))))), k); Setup(quantumoperators = {a, ad}); phi_quantum := Sum(Physics[Vectors]:-`+`(Physics:-`*`(Physics:-`*`(Physics:-`*`(sqrt(2), exp(-Physics:-`*`(I, Physics[Vectors]:-`+`(Physics[Vectors]:-`+`(Physics[Vectors]:-`+`(Physics:-`*`(k_t, t), -Physics:-`*`(k_x, x)), -Physics:-`*`(k_y, y)), -Physics:-`*`(k_z, z))))), a[k]), Physics:-`^`(Physics:-`*`(2, sqrt(Physics:-`*`(V, omega[k]))), -1)), Physics:-`*`(Physics:-`*`(Physics:-`*`(sqrt(2), exp(Physics:-`*`(I, Physics[Vectors]:-`+`(Physics[Vectors]:-`+`(Physics[Vectors]:-`+`(Physics:-`*`(k_t, t), -Physics:-`*`(k_x, x)), -Physics:-`*`(k_y, y)), -Physics:-`*`(k_z, z))))), ad[k]), Physics:-`^`(Physics:-`*`(2, sqrt(Physics:-`*`(V, omega[k]))), -1))), k); Setup(algebrarules = {%Commutator(a[k], ad[kp]) = KroneckerDelta[k, kp]}); commutator_check := Expand(%Commutator(phi_quantum, phi_quantum)); KG_solution, phi_classical, phi_quantum, commutator_check

phi(t, x, y, z)*`will now be displayed as`*phi

 

diff(diff(phi(t, x, y, z), t), t)-(diff(diff(phi(t, x, y, z), x), x))-(diff(diff(phi(t, x, y, z), y), y))-(diff(diff(phi(t, x, y, z), z), z))+m^2*phi(t, x, y, z) = 0

 

PDESolStruc(phi(t, x, y, z) = f__1(t)*f__2(x)*f__3(y)*f__4(z), [{diff(diff(f__1(t), t), t) = _c[1]*f__1(t), diff(diff(f__2(x), x), x) = _c[2]*f__2(x), diff(diff(f__3(y), y), y) = _c[3]*f__3(y), diff(diff(f__4(z), z), z) = _c[1]*f__4(z)-_c[2]*f__4(z)-_c[3]*f__4(z)+m^2*f__4(z)}])

 

Sum(A[k]*exp(-I*(k_t*t-k_x*x-k_y*y-k_z*z))+conjugate(A[k])*exp(I*(k_t*t-k_x*x-k_y*y-k_z*z)), k)

 

[quantumoperators = {a, ad}]

 

Sum((1/2)*2^(1/2)*exp(-I*(k_t*t-k_x*x-k_y*y-k_z*z))*a[k]/(V*omega[k])^(1/2)+(1/2)*2^(1/2)*exp(I*(k_t*t-k_x*x-k_y*y-k_z*z))*ad[k]/(V*omega[k])^(1/2), k)

 

[algebrarules = {%Commutator(a[k], ad[kp]) = Physics:-KroneckerDelta[k, kp]}]

 

0

 

PDESolStruc(phi(t, x, y, z) = f__1(t)*f__2(x)*f__3(y)*f__4(z), [{diff(diff(f__1(t), t), t) = _c[1]*f__1(t), diff(diff(f__2(x), x), x) = _c[2]*f__2(x), diff(diff(f__3(y), y), y) = _c[3]*f__3(y), diff(diff(f__4(z), z), z) = _c[1]*f__4(z)-_c[2]*f__4(z)-_c[3]*f__4(z)+m^2*f__4(z)}]), Sum(A[k]*exp(-I*(k_t*t-k_x*x-k_y*y-k_z*z))+conjugate(A[k])*exp(I*(k_t*t-k_x*x-k_y*y-k_z*z)), k), Sum((1/2)*2^(1/2)*exp(-I*(k_t*t-k_x*x-k_y*y-k_z*z))*a[k]/(V*omega[k])^(1/2)+(1/2)*2^(1/2)*exp(I*(k_t*t-k_x*x-k_y*y-k_z*z))*ad[k]/(V*omega[k])^(1/2), k), 0

(1.1.2)

phi_quantum := Sum(sqrt(2)*exp(-I*(k_t*t-k_x*x-k_y*y-k_z*z))*a[k]/(2*sqrt(V*omega[k]))+sqrt(2)*exp(I*(k_t*t-k_x*x-k_y*y-k_z*z))*ad[k]/(2*sqrt(V*omega[k])), k)

Sum((1/2)*2^(1/2)*exp(-I*(k_t*t-k_x*x-k_y*y-k_z*z))*a[k]/(V*omega[k])^(1/2)+(1/2)*2^(1/2)*exp(I*(k_t*t-k_x*x-k_y*y-k_z*z))*ad[k]/(V*omega[k])^(1/2), k)

(1.1.3)
 

 

Download afleiding_oplossing_pde_Klein-Gordon_equation_2-3-2025_mprimes.mw

Unfortunately,  not yet been able to get a dynamically generated timestamp for a 2 lump wave soliton in a contour plot.
However, adjustable axes are possible in the procedure
 The further the 2-lumps evolve in time , it seems like they become 1 lump solitons ?  


 

restart;
with(PDEtools):
with(plots):
declare(u(x, y, t), quiet);

# Parameters
a[1] := -1:
b[1] := -2:
a[2] := -2/3:
b[2] := -1:
alpha := 1:
beta := 1:

# Definitie van de 2-lump oplossing
u_expr := -2*((9/65 - 18*I/65)*(-(1 + 2*I)*t + (3 - 4*I)*y + t + (1 + 2*I)*x)*(-(2/3 + I)*t + (5/9 - 4*I/3)*y + t + (2/3 + I)*x)*((-2/3 + I)*t + (5/9 + 4*I/3)*y + t + (2/3 - I)*x) + (9/65 + 18*I/65)*(-(2/3 + I)*t + (5/9 - 4*I/3)*y + t + (2/3 + I)*x)*((-1 + 2*I)*t + (3 + 4*I)*y + t + (1 - 2*I)*x)*((-2/3 + I)*t + (5/9 + 4*I/3)*y + t + (2/3 - I)*x) + (7933424/1891125 + 36508832*I/1891125)*(-(1 + 2*I)*t + (3 - 4*I)*y + t + (1 + 2*I)*x) + (6/65 + 9*I/65)*(-(1 + 2*I)*t + (3 - 4*I)*y + t + (1 + 2*I)*x)*((-1 + 2*I)*t + (3 + 4*I)*y + t + (1 - 2*I)*x)*((-2/3 + I)*t + (5/9 + 4*I/3)*y + t + (2/3 - I)*x) + (6/65 - 9*I/65)*(-(1 + 2*I)*t + (3 - 4*I)*y + t + (1 + 2*I)*x)*(-(2/3 + I)*t + (5/9 - 4*I/3)*y + t + (2/3 + I)*x)*((-1 + 2*I)*t + (3 + 4*I)*y + t + (1 - 2*I)*x) + (8059833/1092650 - 84073113*I/2185300)*((-2/3 + I)*t + (5/9 + 4*I/3)*y + t + (2/3 - I)*x) + (7933424/1891125 - 36508832*I/1891125)*((-1 + 2*I)*t + (3 + 4*I)*y + t + (1 - 2*I)*x) + (8059833/1092650 + 84073113*I/2185300)*(-(2/3 + I)*t + (5/9 - 4*I/3)*y + t + (2/3 + I)*x))/(9*(-(1 + 2*I)*t + (3 - 4*I)*y + t + (1 + 2*I)*x)*(-(2/3 + I)*t + (5/9 - 4*I/3)*y + t + (2/3 + I)*x)*((-1 + 2*I)*t + (3 + 4*I)*y + t + (1 - 2*I)*x)*((-2/3 + I)*t + (5/9 + 4*I/3)*y + t + (2/3 - I)*x)/65 + (27783/1625 - 11619*I/1625)*((-1 + 2*I)*t + (3 + 4*I)*y + t + (1 - 2*I)*x)*((-2/3 + I)*t + (5/9 + 4*I/3)*y + t + (2/3 - I)*x) + 135*(-(2/3 + I)*t + (5/9 - 4*I/3)*y + t + (2/3 + I)*x)*((-2/3 + I)*t + (5/9 + 4*I/3)*y + t + (2/3 - I)*x)/52 + (74331/109265 + 118467*I/109265)*(-(2/3 + I)*t + (5/9 - 4*I/3)*y + t + (2/3 + I)*x)*((-1 + 2*I)*t + (3 + 4*I)*y + t + (1 - 2*I)*x) + (74331/109265 - 118467*I/109265)*(-(1 + 2*I)*t + (3 - 4*I)*y + t + (1 + 2*I)*x)*((-2/3 + I)*t + (5/9 + 4*I/3)*y + t + (2/3 - I)*x) + 26*(-(1 + 2*I)*t + (3 - 4*I)*y + t + (1 + 2*I)*x)*((-1 + 2*I)*t + (3 + 4*I)*y + t + (1 - 2*I)*x)/45 + (27783/1625 + 11619*I/1625)*(-(1 + 2*I)*t + (3 - 4*I)*y + t + (1 + 2*I)*x)*(-(2/3 + I)*t + (5/9 - 4*I/3)*y + t + (2/3 + I)*x) + 126229597/50430):

# Trajectorieën
eq1 := y = -beta/((a[1]^2 + b[1]^2)*alpha + 2*a[1]*beta)*(x - (sqrt(3)*sqrt(-a[1]*beta*(a[1]^2 + b[1]^2)^3)/(beta*(a[1]^2 + b[1]^2)*b[1]))):
eq2 := y = -beta/((a[2]^2 + b[2]^2)*alpha + 2*a[2]*beta)*(x - (sqrt(3)*sqrt(-a[2]*beta*(a[2]^2 + b[2]^2)^3)/(beta*(a[2]^2 + b[2]^2)*b[2]))):

MultiLumpPlot2 := proc(tijden::list, kleuren::list, x_range::list, y_range::list, custom_grid::list := [100, 100])
    local contourplots, tijd, i, trajectory_plot1, trajectory_plot2, all_plots, x_min, x_max, y_min, y_max;
    
    x_min, x_max := op(x_range);
    y_min, y_max := op(y_range);
    
    contourplots := [seq(contourplot(eval(u_expr, t = -tijden[i]), x = x_min .. x_max, y = y_min .. y_max, contours = 30, color = kleuren[i], grid = custom_grid, transparency = 0.1), i = 1 .. nops(tijden))];

    trajectory_plot1 := implicitplot(eq1, x = x_min .. x_max, y = y_min .. y_max, color = magenta, thickness = 2);
    trajectory_plot2 := implicitplot(eq2, x = x_min .. x_max, y = y_min .. y_max, color = black, thickness = 2);
    
    return display(op(contourplots), trajectory_plot1, trajectory_plot2, labels = ["x", "y"], scaling = constrained, size = [1200, 800]);
end proc:

MultiLumpPlot2([300], ["blue"], [-200, 200], [-100, 100]);

 

MultiLumpPlot2([100, 200, 300,500, -100, -200,-300 ], ["red", "green", "blue", "black", "red", "green", "blue"], [-350, 350], [-350, 350]);#

 

 

 


 

Download 2-_lump_wave_assenbereik_2-3-2025_mprimes.mw

could be correct, checking time positions


 

" i want do it without textplot in the file tester" 
I am sorry  i don't know yet a solution for text  and is different coding than for a 1 lump soliton.
I must try out different methods ..

@Arya-S-AA 
 

restart;
with(plots):

a := -1;
b := -2;
alpha := 1;
beta := 1;
vx := -3/5;
vy := 1/5;
trajectory_slope := vy/vx;
x0 := 0;
y0 := trajectory_slope*x0;

U := (x, y, t, a, b, alpha, beta) -> 4*beta*((y*a - 2*alpha*t + x)*b^2 + a*(-2*beta*t + a*(y*a - 2*alpha*t + x))*b^2)/
(-b^6*beta*y^2 + (-4*t*y*beta^2 + (-2*a^2*y^2 + (4*alpha*t - 2*x)*a*y - 4*(alpha*t - 1/2*x)^2)*beta + 3*a)*b^4 + 
(-4*t^2*beta^3 + 4*a*t*(y*a - 2*alpha*t + x)*beta^2 - a^2*(y*a - 2*alpha*t + x)^2*beta + 6*a^3)*b^2 + 3*a^5);

MultiLumpPlot := proc(tijden::list, kleuren::list, custom_grid::list := [500, 500]) 
    local contourplots, tijd, pos_shift, xmin, xmax, ymin, ymax, trajectory_plot, text_labels, all_plots, i; 
    
    contourplots := []; 
    text_labels := []; 
    
    if nops(tijden) <> nops(kleuren) then 
        error "Het aantal kleuren moet gelijk zijn aan het aantal tijdstippen."; 
    end if; 
    
    xmin := infinity; xmax := -infinity; 
    ymin := infinity; ymax := -infinity; 
    
    for i to nops(tijden) do 
        tijd := tijden[i]; 
        pos_shift := [x0 + vx*tijd, y0 + vy*tijd]; 
        
        xmin := min(xmin, pos_shift[1] - 30); 
        xmax := max(xmax, pos_shift[1] + 30); 
        ymin := min(ymin, pos_shift[2] - 30); 
        ymax := max(ymax, pos_shift[2] + 30); 
        
        contourplots := [op(contourplots), 
            contourplot(eval(U(x - pos_shift[1], y - pos_shift[2], 0, a, b, alpha, beta)), 
                        x = xmin .. xmax, y = ymin .. ymax, 
                        contours = 40, color = kleuren[i], grid = custom_grid, transparency = 0.05)];
        
        text_labels := [op(text_labels), 
            textplot([pos_shift[1], pos_shift[2] + 3, cat("t=", round(tijd)), 
            'font' = ["Arial", 12, 'bold']])];  # Hier wordt tijd afgerond
    end do; 
    
    trajectory_plot := implicitplot(y = trajectory_slope*x, x = xmin .. xmax, y = ymin .. ymax, color = black, thickness = 2); 
    
    all_plots := display(op(contourplots), trajectory_plot, op(text_labels), 
                         title = "1-Lump Soliton waves", 
                         labels = ["x", "y"], scaling = constrained, 
                         view = [xmin .. xmax, ymin .. ymax]); 
    
    return all_plots; 
end proc:

MultiLumpPlot([-100, 200, 0, 100], ["blue", "green", "purple", "red"], [100, 100]);    

@Arya-S-AA 
This is a 1 lump soliton code :from line-with-t-test.mw
What exactly do you want to write down in this plot ?
Note : the title of the plot should be corrected to 1-lump soliton

@salim-barzani 
I don't know what the availability is worIdwide for the two ai platforms ?
I use a paid chatgpt of 20 usd per month.  

@salim-barzani 
i did already, but you remove this information on th eforum

@Arya-S-AA 

Becomes already a trickier task to plot a fourth 2-lump soliton at t= 100
A procedure that will randomly draw numbers of 2 -lump wave at a given time is even more complicated

 

restart:
with(plots):
with(PDEtools):
declare(u(x, y, t), quiet);

# ✅ Parameters
a[1] := -1: b[1] := -2:
a[2] := -2/3: b[2] := -1:
a[3] := -4/5: b[3] := -3/2:  # Extra lump toegevoegd
alpha := 1: beta := 1:
vx := -3/5: vy := 1/5:

# ✅ Tijdstippen per 2-lump soliton
t1 := -50:  # Tijdstip voor eerste soliton
t2 := 0:    # Tijdstip voor tweede soliton
t3 := 50:   # Tijdstip voor derde soliton

# ✅ 2-lump wave functie
u_expr := -2*((9/65 - 18*I/65)*(-(1 + 2*I)*t + (3 - 4*I)*y + t + (1 + 2*I)*x)*(-(2/3 + I)*t + (5/9 - 4*I/3)*y + t + (2/3 + I)*x)*((-2/3 + I)*t + (5/9 + 4*I/3)*y + t + (2/3 - I)*x) + (9/65 + 18*I/65)*(-(2/3 + I)*t + (5/9 - 4*I/3)*y + t + (2/3 + I)*x)*((-1 + 2*I)*t + (3 + 4*I)*y + t + (1 - 2*I)*x)*((-2/3 + I)*t + (5/9 + 4*I/3)*y + t + (2/3 - I)*x) + (7933424/1891125 + 36508832*I/1891125)*(-(1 + 2*I)*t + (3 - 4*I)*y + t + (1 + 2*I)*x) + (6/65 + 9*I/65)*(-(1 + 2*I)*t + (3 - 4*I)*y + t + (1 + 2*I)*x)*((-1 + 2*I)*t + (3 + 4*I)*y + t + (1 - 2*I)*x)*((-2/3 + I)*t + (5/9 + 4*I/3)*y + t + (2/3 - I)*x) + (6/65 - 9*I/65)*(-(1 + 2*I)*t + (3 - 4*I)*y + t + (1 + 2*I)*x)*(-(2/3 + I)*t + (5/9 - 4*I/3)*y + t + (2/3 + I)*x)*((-1 + 2*I)*t + (3 + 4*I)*y + t + (1 - 2*I)*x) + (8059833/1092650 - 84073113*I/2185300)*((-2/3 + I)*t + (5/9 + 4*I/3)*y + t + (2/3 - I)*x) + (7933424/1891125 - 36508832*I/1891125)*((-1 + 2*I)*t + (3 + 4*I)*y + t + (1 - 2*I)*x) + (8059833/1092650 + 84073113*I/2185300)*(-(2/3 + I)*t + (5/9 - 4*I/3)*y + t + (2/3 + I)*x))/(9*(-(1 + 2*I)*t + (3 - 4*I)*y + t + (1 + 2*I)*x)*(-(2/3 + I)*t + (5/9 - 4*I/3)*y + t + (2/3 + I)*x)*((-1 + 2*I)*t + (3 + 4*I)*y + t + (1 - 2*I)*x)*((-2/3 + I)*t + (5/9 + 4*I/3)*y + t + (2/3 - I)*x)/65 + (27783/1625 - 11619*I/1625)*((-1 + 2*I)*t + (3 + 4*I)*y + t + (1 - 2*I)*x)*((-2/3 + I)*t + (5/9 + 4*I/3)*y + t + (2/3 - I)*x) + 135*(-(2/3 + I)*t + (5/9 - 4*I/3)*y + t + (2/3 + I)*x)*((-2/3 + I)*t + (5/9 + 4*I/3)*y + t + (2/3 - I)*x)/52 + (74331/109265 + 118467*I/109265)*(-(2/3 + I)*t + (5/9 - 4*I/3)*y + t + (2/3 + I)*x)*((-1 + 2*I)*t + (3 + 4*I)*y + t + (1 - 2*I)*x) + (74331/109265 - 118467*I/109265)*(-(1 + 2*I)*t + (3 - 4*I)*y + t + (1 + 2*I)*x)*((-2/3 + I)*t + (5/9 + 4*I/3)*y + t + (2/3 - I)*x) + 26*(-(1 + 2*I)*t + (3 - 4*I)*y + t + (1 + 2*I)*x)*((-1 + 2*I)*t + (3 + 4*I)*y + t + (1 - 2*I)*x)/45 + (27783/1625 + 11619*I/1625)*(-(1 + 2*I)*t + (3 - 4*I)*y + t + (1 + 2*I)*x)*(-(2/3 + I)*t + (5/9 - 4*I/3)*y + t + (2/3 + I)*x) + 126229597/50430):

# ✅ Contourplots voor de drie tijdstippen
contour1 := contourplot(eval(u_expr, t = t1), x = -200..200, y = -100..100, contours = 30, color = red):
contour2 := contourplot(eval(u_expr, t = t2), x = -200..200, y = -100..100, contours = 30, color = green):
contour3 := contourplot(eval(u_expr, t = t3), x = -200..200, y = -100..100, contours = 30, color = blue):

# ✅ Tijdsaanduiding op de figuur
time_labels := textplot([[0, 50, cat("t=", t1)], [0, 0, cat("t=", t2)], [0, -50, cat("t=", t3)]], font=["Arial", 12, 'bold']):

# ✅ Combineer de plots
display(contour1, contour2, contour3, time_labels, labels = ["x", "y"], title="Drie 2-Lump Solitons bij Verschillende Tijdstippen", scaling=constrained);

 

@Arya-S-AA 
A procedure can also be made for the ‘2 lump waves’ I think with time indications? 

Its about combining animations 

@Arya-S-AA 

Like this, as a list input   
This option is  [100, 100] is for minimising plotdrawing time?  

 

restart:
with(plots):

### Lump Parameters ###
a := -1; b := -2; alpha := 1; beta := 1;
vx := -3/5; vy := 1/5;
trajectory_slope := vy/vx;  # automatisch bepaald

# ✅ Startpositie van de 2-lump golf als één geheel op t=0
x0 := 0;
y0 := trajectory_slope * x0;  # Bewegingslijn y = -1/3 * x

U := (x, y, t, a, b, alpha, beta) ->
    4*beta*((a*y - 2*alpha*t + x)*b^2 + a*(-2*beta*t + a*(a*y - 2*alpha*t + x))*b^2) /
    (-b^6*beta*y^2 
    + (-4*t*y*beta^2 + (-2*a^2*y^2 + (4*alpha*t - 2*x)*a*y - 4*(alpha*t - x/2)^2)*beta + 3*a)*b^4 
    + (-4*t^2*beta^3 + 4*a*t*(a*y - 2*alpha*t + x)*beta^2 - a^2*(a*y - 2*alpha*t + x)^2*beta + 6*a^3)*b^2 
    + 3*a^5);

### 🚀 Multi-Tijdstip 2-Lump Plot met Kleurenoptie 🚀 ###
MultiLumpPlot := proc(tijden::list, kleuren::list, custom_grid::list := [500,500])
  local contourplots, tijd, pos_shift, xmin, xmax, ymin, ymax, trajectory_plot, text_labels, all_plots, i;
  
  contourplots := [];
  text_labels := [];

  # ✅ Controle of het aantal kleuren overeenkomt met het aantal tijden
  if nops(tijden) <> nops(kleuren) then
      error "Het aantal kleuren moet gelijk zijn aan het aantal tijdstippen.";
  end if;

  # ✅ Bepaal globale minima en maxima van alle lumps
  xmin := +infinity; xmax := -infinity;
  ymin := +infinity; ymax := -infinity;

  for i from 1 to nops(tijden) do
      tijd := tijden[i];
      pos_shift := [x0 + vx*tijd, y0 + vy*tijd];

      # ✅ Bepaal de uiterste grenzen zodat alle lumps in beeld blijven
      xmin := min(xmin, pos_shift[1] - 30);
      xmax := max(xmax, pos_shift[1] + 30);
      ymin := min(ymin, pos_shift[2] - 30);
      ymax := max(ymax, pos_shift[2] + 30);
      
      # ✅ Contourplot van de lump **op het juiste tijdstip** met de juiste kleur
      contourplots := [op(contourplots), 
          contourplot(
              eval(U(x - pos_shift[1], y - pos_shift[2], 0, a, b, alpha, beta)),  
              x = xmin..xmax, y = ymin..ymax, contours = 40, color = kleuren[i], 
              grid = custom_grid, transparency = 0.05
          )
      ];

      # ✅ Label toevoegen met tijd
      text_labels := [op(text_labels), 
          textplot([pos_shift[1], pos_shift[2] + 3, cat("t=", evalf[2](tijd)), 'font'=["Arial",12,'bold']])
      ];
  end do;

  # ✅ Traject van de 2-lump golf (referentielijn)
  trajectory_plot := implicitplot(y = trajectory_slope*x, x=xmin..xmax, y=ymin..ymax, color=black, thickness=2):

  # ✅ Combineer alle contourplots, het traject en de labels
  all_plots := display(op(contourplots), trajectory_plot, op(text_labels), 
    title = "2-Lump Soliton Golven op meerdere tijdstippen",
    labels = ["x", "y"], scaling = constrained, view=[xmin..xmax, ymin..ymax]
  );

  return all_plots;
end proc:

# ✅ Voorbeeld aanroepen: een lijst van tijdstippen met een lijst van bijbehorende kleuren
MultiLumpPlot([100, 75, 50, 25, 0, -25, -50, -75, -100], ["red", "blue", "green", "purple", "yellow", "red", "blue", "green", "purple"], [100,100]);

@Arya-S-AA 

restart:
with(plots):

### Lump Parameters ###
a := -1; b := -2; alpha := 1; beta := 1;
vx := -3/5; vy := 1/5;
trajectory_slope := vy/vx;  # automatisch bepaald

# ✅ Startpositie van de 2-lump golf als één geheel op t=0
x0 := 0;
y0 := trajectory_slope * x0;  # Bewegingslijn y = -1/3 * x

U := (x, y, t, a, b, alpha, beta) ->
    4*beta*((a*y - 2*alpha*t + x)*b^2 + a*(-2*beta*t + a*(a*y - 2*alpha*t + x))*b^2) /
    (-b^6*beta*y^2 
    + (-4*t*y*beta^2 + (-2*a^2*y^2 + (4*alpha*t - 2*x)*a*y - 4*(alpha*t - x/2)^2)*beta + 3*a)*b^4 
    + (-4*t**2*beta**3 + 4*a*t*(a*y - 2*alpha*t + x)*beta**2 - a**2*(a*y - 2*alpha*t + x)**2*beta + 6*a**3)*b**2 
    + 3*a**5);

### 🚀 Dynamische 2-Lump-Plot: Exacte Verplaatsing 🚀 ###
DynamicLumpPlot := proc(tijd::numeric)
  local contour, trajectory_plot, text_label, pos_shift, xmin, xmax, ymin, ymax;

  # ✅ Bereken de correcte positie van de 2-lump golf
  pos_shift := [x0 + vx*tijd, y0 + vy*tijd];

  # ✅ Controle: Toon de correcte positie in de console
  printf("Lump op t=%.1f bevindt zich exact op (%.2f, %.2f)\n", tijd, pos_shift[1], pos_shift[2]);

  # ✅ Dynamisch plotbereik dat altijd rond de lump gecentreerd is
  xmin := pos_shift[1] - 30; xmax := pos_shift[1] + 30;
  ymin := pos_shift[2] - 30; ymax := pos_shift[2] + 30;

  # ✅ Contourplot die exact zoals bij t=0 wordt weergegeven, maar **verplaatst**
  contour := contourplot(
      eval(U(x - pos_shift[1], y - pos_shift[2], 0, a, b, alpha, beta)),  # **Houd U exact zoals bij t=0, maar verschuif x en y!**
      x = xmin..xmax, y = ymin..ymax, contours = 40, color = red, 
      grid = [300,300], transparency = 0.05
  );

  # ✅ Traject van de 2-lump golf (referentielijn)
  trajectory_plot := implicitplot(y = trajectory_slope*x, x=xmin..xmax, y=ymin..ymax, color=black, thickness=2):

  # ✅ Label toevoegen met tijd
  text_label := textplot([pos_shift[1], pos_shift[2] + 3, cat("t=", evalf[2](tijd)), 'font'=["Arial",12,'bold']]):

  # ✅ Plot alles samen
  display(contour, trajectory_plot, text_label, 
    title = cat("2-Lump Soliton Golf op t=", evalf[2](tijd), " seconden"),
    labels = ["x", "y"], scaling = constrained
  );
end proc:

# ✅ Voorbeeld aanroepen: time t in DynamicLumpPlot(t)
DynamicLumpPlot(0);   # ✅ Correcte startpositie van de 2-lump golf
DynamicLumpPlot(50);  # ✅ Exacte 2-lump golf op (-30, 10), zonder vervorming
DynamicLumpPlot(-50); # ✅ Exacte 2-lump golf op (30, -10), zonder vervorming
DynamicLumpPlot(-25); # ✅ Exacte 2-lump golf op (15, -5), zonder vervorming

@Arya-S-AA 
Maybe I can still help you with your question, but it is not clear to me what exactly you want for a designation?

First 9 10 11 12 13 14 15 Last Page 11 of 73