janhardo

695 Reputation

12 Badges

11 years, 39 days

MaplePrimes Activity


These are answers submitted by janhardo

complexe_ber_mprimes-8-6-2025.mw

Check it , if you can use it , good luck

more friendly version
complexe_ber_mprimesDeel2met_nummering-8-6-2025.mw

@salim-barzani 
 

restart;
with(inttrans);
with(PDEtools);
with(DEtools);
with(Physics);
declare(u(x, t), quiet);
declare(v(x, t), quiet);
undeclare(prime);
pde := u(x, t) + Physics:-`*`(diff(u(x, t), x $ 2), I) + Physics:-`*`(2, I, diff(Physics:-`*`(u(x, t), conjugate(u(x, t))), x), u(x, t)) + Physics:-`*`(Physics:-`^`(u(x, t), 2), Physics:-`^`(conjugate(u(x, t)), 2), I, u(x, t));
pde_linear, pde_nonlinear := selectremove(term -> not has(eval(term, u(x, t) = T*u(x, t))*1/T, T), expand(pde));
B[0] := -Physics:-`*`(I, Physics:-`^`(u[0], 3), Physics:-`^`(conjugate(u[0]), 2));
B1[0] := -Physics:-`*`(2, I, Physics:-`^`(u[0], 2), diff(u[0](x), x));
T[0] := -Physics:-`*`(2, I, u[0], diff(u[0](x), x), conjugate(u[0]));
P[0] := B[0];
Q[0] := B1[0];
R[0] := T[0];
A[0] := P[0] + Q[0] + R[0];
u[0] := Physics:-`*`(beta, exp(Physics:-`*`(I, x)));
u_conj[0] := Physics:-`*`(beta, exp(-Physics:-`*`(I, x)));
A_eval := subs(conjugate(u[0]) = u_conj[0], A[0]);
uxx := diff(u[0](x), x $ 2);
expr := -Physics:-`*`(I, uxx) + A_eval;
u[1] := invlaplace(Physics:-`*`(laplace(expr, t, s), Physics:-`^`(s, -1)), s, t);
print("u[0] =", simplify(u[0]));
print("u[1] =", simplify(u[1]));

 



The first odetest as example 

restart;
with(PDEtools);
with(LinearAlgebra);
with(SolveTools);
undeclare(prime);
declare(G(xi));
declare(U(xi));
ode := diff(G(xi), xi) = ln(d)*(A + B*G(xi) + C*G(xi)^2);
G1 := G(xi) = -B/(2*C) + sqrt(4*A*C - B^2)*tan(1/2*sqrt(4*A*C - B^2)*xi)/(2*C);
H := unapply(rhs(G1), xi);
Hscaled := unapply(H(xi*ln(d)), xi);
Gscaled := G(xi) = Hscaled(xi);
(odetest(Gscaled, ode) assuming (-4*A*C + B^2 < 0, 0 < d, d <> 1, C <> 0));



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

@Alfred_F 

NULL

restart:
with(NumberTheory):

# Step 1: Define symbolic variables
s := 's';
m := 'm';
n := 'n';
k := 'k';
mp := 'mp';  # m' replaced with mp
np := 'np';  # n' replaced with np

# Step 2: Expand ζ(s)^2 into a double sum
zeta_sq := Zeta(s)^2 = sum(sum(1/(m*n)^s, n=1..infinity), m=1..infinity);

# Step 3: Substitute m = k*mp, n = k*np with gcd(mp,np)=1
# We make the summation conditional
subst_sum := sum(sum(sum(1/(k*mp*k*np)^s, np=1..infinity), mp=1..infinity), k=1..infinity)
             assuming igcd(mp,np)=1;

# Step 4: Simplify the expression
simp_sum := sum(1/k^(2*s), k=1..infinity) *
            sum(sum(1/(mp*np)^s, np=1..infinity), mp=1..infinity)
            assuming igcd(mp,np)=1;

# Step 5: Express in terms of zeta functions
ident := Zeta(s)^2 = Zeta(2*s) * sum(sum(1/(mp*np)^s, np=1..infinity), mp=1..infinity)
          assuming igcd(mp,np)=1;

# Step 6: Solve for the coprime sum
coprime_sum_value := Zeta(s)^2/Zeta(2*s);

# For s = 2
exact_val := eval(coprime_sum_value, s=2);
simplify(exact_val);  # Returns 5/2

 

s

 

m

 

n

 

k

 

mp

 

np

 

Zeta(s)^2 = sum(sum(1/(m*n)^s, n = 1 .. infinity), m = 1 .. infinity)

 

sum(sum(sum(1/(k^2*mp*np)^s, np = 1 .. infinity), mp = 1 .. infinity), k = 1 .. infinity)

 

(sum(1/k^(2*s), k = 1 .. infinity))*(sum(sum(1/(mp*np)^s, np = 1 .. infinity), mp = 1 .. infinity))

 

Zeta(s)^2 = Zeta(2*s)*(sum(sum(1/(mp*np)^s, np = 1 .. infinity), mp = 1 .. infinity))

 

Zeta(s)^2/Zeta(2*s)

 

5/2

 

5/2

(1)

NULL

Download how_to_use_ggd-mprimes19-5-2025.mw

@Alfred_F 
In complexe analyse the limit is ?

restart;

# Definieer j als positief
assume(j > 0):

# Definieer de som over k
S := sum(1 / (j^2 + k^2), k = 1 .. n):

# Neem de limiet als n → ∞
limit(S, n = infinity);

               1                                
               - I (Psi(1 - I j) - Psi(1 + I j))
               2                                
               ---------------------------------
                               j                

# restart;

# Definieer de uitdrukking na binnenlimiet
a := j -> (Pi/2 - arctan(1/j)):

# Buitensom van j = 1 .. n
S := sum(a(j), j = 1 .. n):

# Buitenlimiet (deel door n)
limit(S/n, n = infinity);

                              1   
                              - Pi
                              2   

@JaneCherrytree 
Symbolic integral seems to problematic to get 
ntegral_of_long_expression_mprimesDEFA_7-5-2025_(2).mw

restart; with(PDEtools); with(LinearAlgebra); with(plots); with(SolveTools); undeclare(prime); ModulationInstabilityAnalysis_CompleteAllSteps := proc (a_value::positive, l_range::range, show_details::boolean := true, show_plots::boolean := true) local a, phi, w, eq1, eq19, Pfun, eq21_1, eq21_2, M, det_eq, msols, G, G_plot, G_3d_plot, Overlay_plot, a_param, G_formula, plot1, plot2, plot3; description 2; a := 'a'; Pfun := r1*exp(I*(l*x-m*t))+r2*(modulename = Typesetting)(-I*(l*x-m*t)); phi := a*t; w := (sqrt(a)+Pfun)*(modulename = Typesetting)(I*phi); eq1 := I*(diff(w, t))+diff(w, `$`(x, 2))+abs(w)^2*w = 0; eq19 := eval(Typesetting, abs(w)^2 = a+sqrt(a)*(Pfun+conjugate(Pfun))); eq19 := simplify(expand(eq19/(modulename = Typesetting)(I*phi))); eq21_1 := (-m-l^2+a)*r2+a*r1 = 0; eq21_2 := (m-l^2+a)*r1+a*r2 = 0; M := Matrix([[-m-l^2+a, a], [a, m-l^2+a]]); det_eq := simplify(Determinant(M) = 0); msols := solve(det_eq, m); G := 2*Im(msols[1]); G_formula := "G(l) = 2 * Im( &plusmn; sqrt(l^4 - 2*a*l^2) )"; if show_details then print("? Eq. (1): NLSE:Fdo-Fj"); Typesetting; print("? Eq. (18): Steady-state veld w:Fdo-Fj"); protected, _syslib; print("? Eq. (19): Gelinieariseerde vergelijking:Fdo-Fj"); eq19; print("? Eq. (20): Perturbatie-ansatz:Fdo-Fj"); Pfun; print("? Eq. (21): Lineair systeem:Fdo-Fj"); eq21_1; print(); print("? Eq. (22): Matrix:Fdo-Fj"); M; print("? Eq. (23): Dispersierelatie:Fdo-Fj"); det_eq; print("? Eq. (24): m-oplossingen:Fdo-Fj"); msols; print("? Eq. (25): Instabiliteit als: l^4 - 2*a*l^2 < 0Fdo-Fj"); "? Eq. (26): Groei G(l):Fdo-Fj"; G_formula; print("G(l) =", G) end if; if show_plots then G_plot := print(plot(eval(G, a = a_value), l = l_range, labels = ["Wave number l", "Growth rate G(l)"], title = cat("G(l) for a = ", a_value), thickness = 2, color = blue)); G_3d_plot := print(plot3d(2*Im(sqrt(l^4-2*a_param*l^2)), l = l_range, a_param = .1 .. 2*a_value, labels = ["l", "a", "G(l)"], title = "3D MI Gain Spectrum")); plot1 := plot(2*Im(sqrt(l^4+(-2)*1.0*l^2)), l = l_range, color = red, thickness = 2); plot2 := plot(2*Im(sqrt(l^4+(-2)*.5*l^2)), l = l_range, color = blue, thickness = 2); plot3 := plot(2*Im(sqrt(l^4+(-2)*.3*l^2)), l = l_range, color = green, thickness = 2); Overlay_plot := print(display([plot1, plot2, SolveTools], labels = ["Wave number l", "Growth rate G(l)"], legend = ["a = 1", "a = 0.5", "a = 0.3"], title = "Overlay G(l) for a = 1, 0.5, 0.3")); print("? Explore G(l) versus a:Fdo-%(e"); return ['eq1_nlse' = Typesetting, 'steady_state_eq18' = w, 'linearized_eq19' = eq19, 'ansatz_eq20' = Pfun, 'eq21_system' = [eq21_1, ], 'matrix_eq22' = M, 'dispersion_eq23' = det_eq, 'm_solutions_eq24' = msols, 'growth_rate_eq26' = G, 'stability_condition_eq25' = "l^4 - 2*a*l^2 < 0"]; ;  end if;  end proc

`There is no more prime differentiation variable; all derivatives will be displayed as indexed functions`

(1)

NULL

a := 1.0; l_range := -3 .. 3; result := ModulationInstabilityAnalysis_CompleteAllSteps(a, l_range, show_details = true, show_plots = true)

"? Eq. (1): NLSE:6""

 

I*((-I*r1*m*exp(I*(l*x-m*t))+I*r2*m*exp(-I*(l*x-m*t)))*exp(I*a*t)+I*(sqrt(a)+r1*exp(I*(l*x-m*t))+r2*exp(-I*(l*x-m*t)))*a*exp(I*a*t))+(-r1*l^2*exp(I*(l*x-m*t))-r2*l^2*exp(-I*(l*x-m*t)))*exp(I*a*t)+abs(sqrt(a)+r1*exp(I*(l*x-m*t))+r2*exp(-I*(l*x-m*t)))^2*(exp(-Im(a*t)))^2*(sqrt(a)+r1*exp(I*(l*x-m*t))+r2*exp(-I*(l*x-m*t)))*exp(I*a*t) = 0

 

"? Eq. (18): Steady-state veld w:6""

 

(sqrt(a)+r1*exp(I*(l*x-m*t))+r2*exp(-I*(l*x-m*t)))*exp(I*a*t)

 

"? Eq. (19): Gelinieariseerde vergelijking:6""

 

(exp(-2*Im(a*t))*sqrt(a)+r2*exp(-I*l*x+I*m*t-2*Im(a*t))+r1*exp(I*l*x-I*m*t-2*Im(a*t)))*abs(sqrt(a)+r1*exp(I*(l*x-m*t))+r2*exp(-I*(l*x-m*t)))^2-r2*(l^2+a+m)*exp(-I*(l*x-m*t))-r1*(l^2+a-m)*exp(I*(l*x-m*t))-a^(3/2) = 0

 

"? Eq. (20): Perturbatie-ansatz:6""

 

r1*exp(I*(l*x-m*t))+r2*exp(-I*(l*x-m*t))

 

"? Eq. (21): Lineair systeem:6""

 

(-l^2+a-m)*r2+r1*a = 0

 

(-l^2+a+m)*r1+r2*a = 0

 

"? Eq. (22): Matrix:6""

 

Matrix(2, 2, {(1, 1) = -l^2+a-m, (1, 2) = a, (2, 1) = a, (2, 2) = -l^2+a+m})

 

"? Eq. (23): Dispersierelatie:6""

 

l^4-2*a*l^2-m^2 = 0

 

"? Eq. (24): m-oplossingen:6""

 

sqrt(l^2-2*a)*l, -sqrt(l^2-2*a)*l

 

"? Eq. (25): Instabiliteit als: l^4 - 2*a*l^2 < 06""

 

"? Eq. (26): Groei G(l):6""

 

"G(l) = 2 * Im( &plusmn; sqrt(l^4 - 2*a*l^2) )"

 

"G(l) =", 2*Im(sqrt(l^2-2*a)*l)

 

 

 

 

"? Explore G(l) versus a:6""

 

"?? Explore 3D G(l,a):"

 

[eq1_nlse = (I*((-I*r1*m*exp(I*(l*x-m*t))+I*r2*m*exp(-I*(l*x-m*t)))*exp(I*a*t)+I*(a^(1/2)+r1*exp(I*(l*x-m*t))+r2*exp(-I*(l*x-m*t)))*a*exp(I*a*t))+(-r1*l^2*exp(I*(l*x-m*t))-r2*l^2*exp(-I*(l*x-m*t)))*exp(I*a*t)+abs(a^(1/2)+r1*exp(I*(l*x-m*t))+r2*exp(-I*(l*x-m*t)))^2*(exp(-Im(a*t)))^2*(a^(1/2)+r1*exp(I*(l*x-m*t))+r2*exp(-I*(l*x-m*t)))*exp(I*a*t) = 0), steady_state_eq18 = (a^(1/2)+r1*exp(I*(l*x-m*t))+r2*exp(-I*(l*x-m*t)))*exp(I*a*t), linearized_eq19 = ((exp(-2*Im(a*t))*a^(1/2)+r2*exp(-I*l*x+I*m*t-2*Im(a*t))+r1*exp(I*l*x-I*m*t-2*Im(a*t)))*abs(a^(1/2)+r1*exp(I*(l*x-m*t))+r2*exp(-I*(l*x-m*t)))^2-r2*(l^2+a+m)*exp(-I*(l*x-m*t))-r1*(l^2+a-m)*exp(I*(l*x-m*t))-a^(3/2) = 0), ansatz_eq20 = r1*exp(I*(l*x-m*t))+r2*exp(-I*(l*x-m*t)), eq21_system = [(-l^2+a-m)*r2+r1*a = 0, (-l^2+a+m)*r1+r2*a = 0], matrix_eq22 = Matrix(%id = 36893490539730111892), dispersion_eq23 = (l^4-2*a*l^2-m^2 = 0), m_solutions_eq24 = ((l^2-2*a)^(1/2)*l, -(l^2-2*a)^(1/2)*l), growth_rate_eq26 = 2*Im((l^2-2*a)^(1/2)*l), stability_condition_eq25 = "l^4 - 2*a*l^2 < 0"]

(2)

Download ModulationInstabilityAnalysis_CompleteAllSteps_mprimes-4-5-2025.mw

Comparing A2 and A2  , shows that they are equal and simplify and is  is not neccessary 

restart;

 

A := -x*(x - 4*exp(x/2) + 2);
B := x*sqrt((-8*x - 16)*exp(x/2) + x^2 + 4*x + 16*exp(x) + 4);

-x*(x-4*exp((1/2)*x)+2)

 

x*((-8*x-16)*exp((1/2)*x)+x^2+4*x+16*exp(x)+4)^(1/2)

(1)

simplify(A-B) assuming x::real;
 

0

(2)

 

A2 := expand(A^2);
B2 := expand(B^2);

x^4-8*x^3*exp((1/2)*x)+4*x^3+16*x^2*(exp((1/2)*x))^2-16*x^2*exp((1/2)*x)+4*x^2

 

-8*x^3*exp((1/2)*x)-16*x^2*exp((1/2)*x)+x^4+4*x^3+16*x^2*exp(x)+4*x^2

(3)

A2 := expand(A^2)assuming x::real;
B2 := expand(B^2)assuming x::real;

x^4-8*x^3*(exp(x))^(1/2)+4*x^3+16*x^2*exp(x)-16*x^2*(exp(x))^(1/2)+4*x^2

 

x^4-8*x^3*(exp(x))^(1/2)+4*x^3+16*x^2*exp(x)-16*x^2*(exp(x))^(1/2)+4*x^2

(4)

 

 

simplify(A2 - B2);

0

(5)

is(simplify(A2) = simplify(B2)) ;

true

(6)

solve ( x^4 - 8*x^3*exp(x/2) + 4*x^3 + 16*x^2*exp(x/2)^2 - 16*x^2*exp(x/2) + 4*x^2, x) assuming x::real;

0, -2-2*LambertW(-2*exp(-1))

(7)

solve( -8*x^3*exp(x/2) - 16*x^2*exp(x/2) + x^4 + 4*x^3 + 16*x^2*exp(x) + 4*x^2,x)assuming x::real;

0, -2-2*LambertW(-2*exp(-1))

(8)

 

NULL

Download gelijkheid_expressie_mpries_3-5-2025_A.mw

see under

1 2 3 4 5 6 Page 2 of 6