janhardo

700 Reputation

12 Badges

11 years, 59 days

MaplePrimes Activity


These are replies submitted by janhardo

@mmcdara 
Is A=B ? 

diff(G(xi), xi) = A+B*G(xi)+C*G(xi)^2; Delta := 4*A*C-B^2; assume(C <> 0); assume(Delta > 0); G1 := (sqrt(Delta)*tan((1/2)*sqrt(Delta)*(d[0]+xi))-B)/(2*C); check1 := simplify(diff(G1, xi)-C*G1^2-B*G1-A); G2 := -(sqrt(Delta)*cot((1/2)*sqrt(Delta)*(d[0]+xi))+B)/(2*C); check2 := simplify(diff(G2, xi)-C*G2^2-B*G2-A); forget(Delta); assume(Delta < 0); G3 := -(sqrt(-Delta)*tanh((1/2)*sqrt(-Delta)*(d[0]+xi))+B)/(2*C); check3 := simplify(diff(G3, xi)-C*G3^2-B*G3-A)

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

 

4*A*C-B^2

 

(1/2)*((4*A*C-B^2)^(1/2)*tan((1/2)*(4*A*C-B^2)^(1/2)*(d[0]+xi))-B)/C

 

0

 

-(1/2)*((4*A*C-B^2)^(1/2)*cot((1/2)*(4*A*C-B^2)^(1/2)*(d[0]+xi))+B)/C

 

0

 

-(1/2)*((-4*A*C+B^2)^(1/2)*tanh((1/2)*(-4*A*C+B^2)^(1/2)*(d[0]+xi))+B)/C

 

0

(1)

restart; with(PDEtools); E := diff(G(xi), xi) = A+B*G(xi)+C*G(xi)^2; Delta := 4*A*C-B^2; assume(C <> 0); assume(Delta > 0); G1 := (sqrt(Delta)*tan((1/2)*sqrt(Delta)*(d[0]+xi))-B)/(2*C); odetest(G(xi) = G1, E); G2 := -(sqrt(Delta)*cot((1/2)*sqrt(Delta)*(d[0]+xi))+B)/(2*C); odetest(G(xi) = G2, E); forget(Delta); assume(Delta < 0); G3 := -(sqrt(-Delta)*tanh((1/2)*sqrt(-Delta)*(d[0]+xi))+B)/(2*C); odetest(G(xi) = G3, E)

(1/2)*((4*A*C-B^2)^(1/2)*tan((1/2)*(4*A*C-B^2)^(1/2)*(d[0]+xi))-B)/C

 

0

 

-(1/2)*((4*A*C-B^2)^(1/2)*cot((1/2)*(4*A*C-B^2)^(1/2)*(d[0]+xi))+B)/C

 

0

 

-(1/2)*((-4*A*C+B^2)^(1/2)*tanh((1/2)*(-4*A*C+B^2)^(1/2)*(d[0]+xi))+B)/C

 

0

(2)
 

Download ricatti_ode_3_oplossingen_mprimes_30-4-2025.mw

solve(x^2 = a, x); sqrt(a), -sqrt(a)


restart:
with(DEtools):

printf("📘 Step 1: Define the nonlinear ODE in Q(zeta):\n");
ode := (diff(Q(zeta), zeta))^2 - r^2*Q(zeta)^2*(a - b*Q(zeta) - l*Q(zeta)^2) = 0;

printf("\n📘 Step 2: Substitute Q = 1/u(zeta) to simplify the ODE:\n");
ode_u := simplify(eval(ode, Q(zeta) = 1/u(zeta)) * u(zeta)^4);

printf("\n📘 Step 3: Result after substitution and simplification:\n");
print(ode_u);

printf("\n📘 Step 4: Take the square root on both sides. Here, the ± symbol appears because (du/dzeta)^2 = ...:\n");
printf("When solving a square equation, you must take ± sqrt(...)\n");
printf("→ du/dzeta = ± r * sqrt(a*u^2 - b*u - l)\n");

printf("\n📘 Step 5: Separate variables and integrate, leading to a tanh-type solution:\n");
printf("∫ du / sqrt(a*u^2 - b*u - l) = ± r ∫ dzeta\n");

printf("\n📘 Step 6: After integration, you obtain a tanh-expression for u(zeta):\n");

# Specific solutions for + and -
u_specific_plus := b/(2*a) + sqrt(4*a*l + b^2)/(2*a)*tanh(r*sqrt(a)*zeta/2);
u_specific_minus := b/(2*a) - sqrt(4*a*l + b^2)/(2*a)*tanh(r*sqrt(a)*zeta/2);

printf("u_specific_plus (with + square root):\n");
print(u_specific_plus);
printf("u_specific_minus (with - square root):\n");
print(u_specific_minus);

printf("\n📘 Step 7: Solve for Q(zeta) = 1/u(zeta) for both cases:\n");

Q_sol_plus := simplify(1/u_specific_plus);
Q_sol_minus := simplify(1/u_specific_minus);

printf("Q_sol_plus (plus solution):\n");
print(Q_sol_plus);
printf("Q_sol_minus (minus solution):\n");
print(Q_sol_minus);

printf("\n📘 Step 8: Transform to exponential form using the tanh identity:\n");
printf("tanh(x) = (exp(x) - exp(-x)) / (exp(x) + exp(-x))\n");

Q_exp_plus := 4*a/((4*a*l + b^2)*exp(r*sqrt(a)*zeta) - exp(-r*sqrt(a)*zeta) + 2*b);
Q_exp_minus := 4*a/((4*a*l + b^2)*exp(r*sqrt(a)*zeta) + exp(-r*sqrt(a)*zeta) + 2*b);

printf("Q_exp_plus (minus between exponentials):\n");
print(Q_exp_plus);
printf("Q_exp_minus (plus between exponentials):\n");
print(Q_exp_minus);

printf("\n📘 Step 9: Summary: the ± sign appears when taking the square root of (du/dzeta)^2.\n");
printf("Taking a square root always yields two solutions: +sqrt(...) and -sqrt(...).\n");
printf("Thus, there are two solution families for Q(zeta).\n");

printf("\n✅ Full derivation completed.\n");

Needs further be enhanced..

ContourVolledigFlexibelDynamisch := proc(R::numeric, r::numeric, centrum::list, polen::list)
    local theta, t, plotslist, pol, x, y, lbl, cx, cy, x_min, x_max, y_min, y_max, marge;
    uses plots, plottools;

    plotslist := []:

    # Centrum grote cirkel
    cx := centrum[1]:
    cy := centrum[2]:

    # Grote volledige cirkel
    theta := [seq(t, t=0..2*evalf(Pi), evalf(Pi/200))]:
    plotslist := [op(plotslist), curve([seq([R*cos(t)+cx, R*sin(t)+cy], t in theta)], color=blue, thickness=2)];

    # Rechte lijnen op assen
    plotslist := [op(plotslist),
                  line([-R-0.5+cx,0+cy],[R+0.5+cx,0+cy],color=black,thickness=1),
                  line([0+cx,-R-0.5+cy],[0+cx,R+0.5+cy],color=black,thickness=1)];

    # Kleine cirkels en labels toevoegen
    for pol in polen do
        x := pol[1]:
        y := pol[2]:
        lbl := pol[3]:

        plotslist := [op(plotslist),
                      circle([x,y], r, thickness=2, color=green),
                      textplot([x+0.2,y+0.2,lbl], font=[TIMES,12])];
    end do:

    # Labels voor Re en Im (assen)
    plotslist := [op(plotslist),
                  textplot([R+cx+0.5, 0+cy, "Re"], font=[TIMES,14]),
                  textplot([0+cx, R+cy+0.5, "Im"], font=[TIMES,14])];

    # Dynamisch venster instellen
    marge := max(1, R/5):
    x_min := cx - R - marge:
    x_max := cx + R + marge:
    y_min := cy - R - marge:
    y_max := cy + R + marge:

    # Alles tonen met automatisch schaal
    display(plotslist, scaling=constrained, axes=boxed, labels=["",""], view=[x_min..x_max, y_min..y_max], gridlines=true);
end proc:

ContourVolledigFlexibelDynamisch(2, 0.5, [0,0], [[0,1,"z=i"], [0,-1,"z=-i"]]);

 

ContourVolledigFlexibelDynamisch(2, 0.5, [1,1], [[2,2,"z=2+2i"], [0,1,"z=i"]]);

 
 

 

Download contourdiagram_cirkel_-2cirkels_mprimes_28-4-2025.mw

@dharr 
Of course to fill in as function type the procedure input

I also thought of it , only it didn't occur to me to do the function call with lowercase ...

Well done!, and it the procedure outcome exactly matches what I cumbersomely did in another procedure : ToLowerFunc := proc(expr), but maybe this one is still of use ?

 

@salim-barzani 

 

Use ND procedure than output as expression ,then procedure ToLowerFunc , then

restart;

ToLowerFunc := proc(expr)
    local replacements, vars, v, f_lower;
    
    replacements := {};
    vars := indets(expr, 'function');
    
    for v in vars do
        if type(op(0,v), name) then
            f_lower := parse(StringTools:-LowerCase(convert(op(0,v), string)));
            replacements := replacements union { op(0,v) = f_lower };
        end if;
    end do;
    
    return subs(replacements, expr);
end proc:


 

expr2:= diff(diff(F(x, y, z, t), x), y)*G(x, y, z, t) - diff(F(x, y, z, t), x)*diff(G(x, y, z, t), y) - diff(F(x, y, z, t), y)*diff(G(x, y, z, t), x) + F(x, y, z, t)*diff(diff(G(x, y, z, t), x), y);

(diff(diff(F(x, y, z, t), x), y))*G(x, y, z, t)-(diff(F(x, y, z, t), x))*(diff(G(x, y, z, t), y))-(diff(F(x, y, z, t), y))*(diff(G(x, y, z, t), x))+F(x, y, z, t)*(diff(diff(G(x, y, z, t), x), y))

(1)

ToLowerFunc(expr2);

(diff(diff(f(x, y, z, t), x), y))*g(x, y, z, t)-(diff(f(x, y, z, t), x))*(diff(g(x, y, z, t), y))-(diff(f(x, y, z, t), y))*(diff(g(x, y, z, t), x))+f(x, y, z, t)*(diff(diff(g(x, y, z, t), x), y))

(2)

restart;
with(PDEtools):
with(LinearAlgebra):
with(SolveTools):
undeclare(prime):
alias(F=F(x,y,z,t), G=G(x,y,z,t)):

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

(3)

diff(f(x, y, z, t), x, y)*g(x, y, z, t) - diff(f(x, y, z, t), x)*diff(g(x, y, z, t), y) - diff(f(x, y, z, t), y)*diff(g(x, y, z, t), x) + f(x, y, z, t)*diff(g(x, y, z, t), x, y);

(diff(diff(f(x, y, z, t), x), y))*g(x, y, z, t)-(diff(f(x, y, z, t), x))*(diff(g(x, y, z, t), y))-(diff(f(x, y, z, t), y))*(diff(g(x, y, z, t), x))+f(x, y, z, t)*(diff(diff(g(x, y, z, t), x), y))

(4)

 

 


 

Download kleine_letters_procedurND_uitvoer_omzettingmprines27-4-2025.mw

@salim-barzani 
It seems simple, but Maple processes these lowercase letters differently from the uppercase letters again as it seems?

A question for the maple specialists here

@salim-barzani 
To find  , a expression for  : L2, L3, L4, L5?..

@salim-barzani 
i substituted (32) into pde and it seems be correct. 
Substitute in L2  :after a11, a4, a9 are expressed in the other variables a
Substitute the numeric values , then we get ...

{a11 = -3*(a1^2 + a6^2)*(a1^3*a2 + a1^2*a6*a7 + a1*a2*a6^2 + a6^3*a7)/(a1^2*a7^2 - 2*a1*a2*a6*a7 + a2^2*a6^2), a4 = -(a1^3*alpha + a1^2*a2*beta + a1^2*a3*gamma + a1*a6^2*alpha + a2*a6^2*beta + a3*a6^2*gamma - 5*a1*a2^2 + 5*a1*a7^2 - 10*a2*a6*a7)/(9*(a1^2 + a6^2)), a9 = -(a1^2*a6*alpha + a1^2*a7*beta + a1^2*a8*gamma + a6^3*alpha + a6^2*a7*beta + a6^2*a8*gamma - 10*a1*a2*a7 + 5*a2^2*a6 - 5*a6*a7^2)/(9*(a1^2 + a6^2))}

now a3,a8 ,.....?

The countour must be around the path .. to be continued 

restart:

PlotParametricCurveWithContourLite := proc(r::procedure, a::numeric, b)
    local xfunc, yfunc, i, t, step, ytvals, ymax, A, B, M, p, s, contour, path, txt, labeltxt, totalPlot, N, e, n;
    
    uses plots, plottools, CurveFitting;   

    N := 30:        # aantal punten voor de contour
    e := 0.2:       # rimpelamplitude

    # Coördinaten
    xfunc := t -> r(t)[1]:
    yfunc := t -> r(t)[2]:

    step := (b - a)/100:
    ytvals := [seq(yfunc(a + i*step), i = 0 .. 100)]:
    ymax := max(ytvals) * 1.1:

    # Willekeurige contour
    A := [1, 1]:
    B := [N+2, 1]:
    M := seq([n+1, A[2] + rand(-e .. e)()], n=1..N):
    p := [A, M, B]:
    s := unapply(Spline(p, t, endpoints='periodic'), t):

    contour := plot(s(1 + t*(N+1)/(2*Pi)), t=0..2*Pi, coords=polar, color=red, thickness=2):

    # Curve tekenen
    path := plot([xfunc(t), yfunc(t), t = a .. b], color = black, thickness = 1, linestyle = dash):
    labeltxt := cat("Curve: r(t) = [x(t), y(t)],  t 2 [", a, ", ", b, "]"):
    txt := textplot([0, ymax, labeltxt], align = {above}, font = [Times, Bold, 12]):

    totalPlot := display([contour, path, txt], scaling = constrained):
    return totalPlot;
end proc:

r := t -> [t, t^2]:  # Parabool
PlotParametricCurveWithContourLite(r, 0, 2);

 

r := t -> [t*cos(t), t*sin(t)]:
PlotParametricCurveWithContourLite(r, 0, Pi);

 

Download pad_generator_mprimes_25-4-2025_versieA.mw


 

ChaoticCircle := proc(r::positive, factor_x::positive, factor_y::positive, k::positive, delta::numeric, n::posint)
    local i, j, N, t, theta, x_vals, y_vals, points, plot, freqs, phases, wobblefactor;
    uses plots, plottools, RandomTools;

    N := 500;
    theta := [seq(2*Pi*i/N, i = 0..N)];

    # Generate random frequencies and phases
    freqs := [seq(rand(3..7)(), i=1..n)];
    phases := [seq(rand(0.0..evalf(2*Pi))(), i=1..n)];

    # Function to compute wobble factor at t
    wobblefactor := t -> 1 + delta * add(sin(freqs[j]*t + phases[j]), j=1..n);

    # Coordinates with random contour wobble
    x_vals := [seq(k*factor_x*r*wobblefactor(t)*cos(t), t in theta)];
    y_vals := [seq(k*factor_y*r*wobblefactor(t)*sin(t), t in theta)];

    points := [seq([x_vals[i], y_vals[i]], i=1..N+1)];

    # Plot the chaotic shape
    plot := plottools[curve](points, color=orange, thickness=3):
    plots[display](plot,
      axes = none,
        title=sprintf("Chaotic Circle  �� (n=%d waves)", n));
end proc:

ChaoticCircle(1, 5, 2, 4, 0.07, 5);

 


 

Download chaotic_circle_proc_24-42025.mw

@salim-barzani 
it's ai style , so ?
i tried different versions to get for r2 , as close as the paper 
Probably it can be better , but how you can derive r2 is clear

restart:

# Step 1: Define parameters
assume(a, real): assume(b, real): assume(lambda > 0):
assume(k1, real): assume(k2, real):
assume(r1, real): assume(r2, real):
assume(s1, real): assume(s2, real):

# Step 2: Condition A_12 = 0 → set numerator equal to 0
numerator := -(k1 - k2)^2 + 3*(s1 - s2)^2 + lambda*(r1 - r2)^2 + (a^4 - 6*a^2*b^2 + b^4):
eq := numerator = 0:

# Step 3: Solve the equation for r2
sol := solve(eq, r2):

# Step 4: Look at the difference r2 - r1 (for ± structure)
expr := sol[1] - r1:
expr_simplified := simplify(expr):

# Step 5: Rewrite the result in the same form as equation (14)
A := (a^4 - 6*a^2*b^2 + b^4):
factorized_expr := simplify(sqrt(3)/(4*lambda) * sqrt(-lambda*(k2 - k1)^2*A + 4*lambda*(r1 + s1 - s2))):

# Step 6: Display the final solution
r2_final := r1 + factorized_expr;
r2_alternate := r1 - factorized_expr;

# Display both ± solutions
[r2_final, r2_alternate];

# Replace expanded terms by original factor form
A := a^4 - 6*a^2*b^2 + b^4:
DeltaK := (k1 - k2)^2:
expr_compact := simplify(sqrt(3)/(4*lambda) * sqrt(-lambda*DeltaK*A + 4*lambda*(r1 + s1 - s2))):

# Show the final clean formula
r2_nice := [r1 + expr_compact, r1 - expr_compact];


A := (a^4 - 6*a^2*b^2 + b^4):
DeltaK := (k1 - k2)^2:
B := 4*(r1 + s1 - s2):
r2_compact := [r1 + sqrt(3)/(4*sqrt(lambda))*sqrt(-DeltaK*A + B),
               r1 - sqrt(3)/(4*sqrt(lambda))*sqrt(-DeltaK*A + B)];

 

Warning, solve may be ignoring assumptions on the input variables.

 

r1+(1/4)*3^(1/2)*(-(k1-k2)^2*a^4+6*b^2*(k1-k2)^2*a^2-(k1-k2)^2*b^4+4*r1+4*s1-4*s2)^(1/2)/lambda^(1/2)

 

r1-(1/4)*3^(1/2)*(-(k1-k2)^2*a^4+6*b^2*(k1-k2)^2*a^2-(k1-k2)^2*b^4+4*r1+4*s1-4*s2)^(1/2)/lambda^(1/2)

 

[r1+(1/4)*3^(1/2)*(-(k1-k2)^2*a^4+6*b^2*(k1-k2)^2*a^2-(k1-k2)^2*b^4+4*r1+4*s1-4*s2)^(1/2)/lambda^(1/2), r1-(1/4)*3^(1/2)*(-(k1-k2)^2*a^4+6*b^2*(k1-k2)^2*a^2-(k1-k2)^2*b^4+4*r1+4*s1-4*s2)^(1/2)/lambda^(1/2)]

 

[r1+(1/4)*3^(1/2)*(-(k1-k2)^2*a^4+6*b^2*(k1-k2)^2*a^2-(k1-k2)^2*b^4+4*r1+4*s1-4*s2)^(1/2)/lambda^(1/2), r1-(1/4)*3^(1/2)*(-(k1-k2)^2*a^4+6*b^2*(k1-k2)^2*a^2-(k1-k2)^2*b^4+4*r1+4*s1-4*s2)^(1/2)/lambda^(1/2)]

 

[r1+(1/4)*3^(1/2)*(-(a^4-6*a^2*b^2+b^4)*(k1-k2)^2+4*r1+4*s1-4*s2)^(1/2)/lambda^(1/2), r1-(1/4)*3^(1/2)*(-(a^4-6*a^2*b^2+b^4)*(k1-k2)^2+4*r1+4*s1-4*s2)^(1/2)/lambda^(1/2)]

(1)

restart:

# Parameters definition
assume(a, real): assume(b, real): assume(lambda > 0):
assume(k1, real): assume(k2, real):
assume(r1, real): assume(s1, real): assume(s2, real):

# Compact terms as in the paper
DeltaK := (k2 - k1)^2:
A := a^4 - 6*a^2*b^2 + b^4:
B := 4*lambda*(r1 + s1 - s2):

# Root term as it appears in equation (14)
Root := -lambda*DeltaK*A + B:

# Final solution in ± form
r2_nice := [ + sqrt(3)/(4*lambda)*sqrt(Root),
             - sqrt(3)/(4*lambda)*sqrt(Root) ];

 

[(1/4)*3^(1/2)*(-(a^4-6*a^2*b^2+b^4)*(k2-k1)^2*lambda+4*lambda*(r1+s1-s2))^(1/2)/lambda, -(1/4)*3^(1/2)*(-(a^4-6*a^2*b^2+b^4)*(k2-k1)^2*lambda+4*lambda*(r1+s1-s2))^(1/2)/lambda]

(2)

restart;

# Simplification assuming lambda > 0
assume(lambda > 0):

DeltaK := (k2 - k1)^2:
A := a^4 - 6*a^2*b^2 + b^4:
B := 4*(r1 + s1 - s2):  # No lambda in this term anymore

# Extract lambda from the square root
r2_nice := r1 + sqrt(3)/(4*sqrt(lambda)) * sqrt(-DeltaK*A + B),
            r1 - sqrt(3)/(4*sqrt(lambda)) * sqrt(-DeltaK*A + B);

r1+(1/4)*3^(1/2)*(-(a^4-6*a^2*b^2+b^4)*(k2-k1)^2+4*r1+4*s1-4*s2)^(1/2)/lambda^(1/2), r1-(1/4)*3^(1/2)*(-(a^4-6*a^2*b^2+b^4)*(k2-k1)^2+4*r1+4*s1-4*s2)^(1/2)/lambda^(1/2)

(3)
 

 

Download berekinhg_mprimes_vraag_formule_bereekn_in_pde_engelse_versie19-14-2025.mw

First 7 8 9 10 11 12 13 Last Page 9 of 74