janhardo

885 Reputation

12 Badges

11 years, 287 days
B. Ed math

MaplePrimes Activity


These are answers submitted by janhardo

Interesting topic

This explanation does not cover all derivations; it simply gives an idea of how a rotation matrix is derived

 

 

 

# ============================================================================
# DIDACTIC WORKSHEET: DERIVATION OF THE ROTATION MATRIX ABOUT THE XAXIS
#
# This worksheet guides you through:
#   1. 2D rotation in the yzplane (point on a circle)
#   2. Extension to 3D: rotation of a vector about the xaxis
#   3. Rotation of a cube about the xaxis with a dynamic matrix display
#
# Run each section separately to see the theory and the animations.
# ============================================================================

restart;
with(plots):        # for plots and animations
with(plottools):    # for lines, polygons, spheres
with(LinearAlgebra):# for matrix multiplication

# ----------------------------------------------------------------------------
# PART 1: 2D ROTATION IN THE YZPLANE
# ----------------------------------------------------------------------------
print("============================================================================");
print("PART 1: 2D rotation in the yzplane");
print("We consider a point P = (y, z) in the yzplane.");
print("We want to rotate it counterclockwise by an angle θ.");
print("");

print("Step 1 – Polar coordinates:");
print("   y = r·cos(φ),   z = r·sin(φ)");
print("where r is the distance from the origin and φ is the angle with the positive yaxis.");
print("");

print("Step 2 – Rotation by θ adds θ to the angle:");
print("   y' = r·cos(φ+θ),   z' = r·sin(φ+θ)");
print("");

print("Step 3 – Use the addition formulas:");
print("   cos(φ+θ) = cosφ·cosθ - sinφ·sinθ");
print("   sin(φ+θ) = sinφ·cosθ + cosφ·sinθ");
print("");

print("Step 4 – Multiply by r and substitute y = r·cosφ, z = r·sinφ:");
print("   y' = y·cosθ - z·sinθ");
print("   z' = y·sinθ + z·cosθ");
print("");

print("Step 5 – Write as a matrix multiplication:");
print("   [ y' ]   [ cosθ  -sinθ ] [ y ]");
print("   [ z' ] = [ sinθ   cosθ ] [ z ]");
print("The 2×2 matrix is the 2D rotation matrix R_2D(θ).");
print("============================================================================");
print("");

print("Animation: A point starting at (1,0) rotates through a full circle.");
print("Below the plot you see the numerical matrix R_2D(θ).");
print("");

N := 32;  # number of frames
frames_2d := []:
for i from 0 to N do
    theta := i * (2*Pi/N);
    R2 := Matrix([[cos(theta), -sin(theta)], [sin(theta), cos(theta)]]);
    rotated := convert(R2 . Vector([1,0]), list);
    
    # Graphical elements
    p := pointplot([rotated], symbol=solidcircle, symbolsize=20, color="red");
    l := line([0,0], rotated, color="blue", linestyle=dot);
    circ := plot([cos(t), sin(t), t=0..2*Pi], color="gray", thickness=1);
    y_axis := plot([[-1.5,0],[1.5,0]], color="black", thickness=1);
    z_axis := plot([[0,-1.5],[0,1.5]], color="black", thickness=1);
    y_label := textplot([1.6,0.1, "y"], font=["Times",12]);
    z_label := textplot([0.1,1.6, "z"], font=["Times",12]);
    matrix_text := sprintf("R_2D = [%7.3f  %7.3f]\n        [%7.3f  %7.3f]",
                           cos(theta), -sin(theta), sin(theta), cos(theta));
    mat_plot := textplot([-1.2, -1.3, matrix_text], font=["Courier",10]);
    
    frames_2d := [op(frames_2d),
                  display(p, l, circ, y_axis, z_axis, y_label, z_label, mat_plot,
                          scaling=constrained, view=[-1.5..1.5,-1.5..1.5],
                          title=cat("θ = ", sprintf("%.2f", theta), " rad"))];
end do:
anim_2d := display(frames_2d, insequence=true):
print(anim_2d);
print("Click the play button. The point rotates and the matrix updates.");
print("");

# ----------------------------------------------------------------------------
# PART 2: EXTENSION TO 3D – ROTATION ABOUT THE XAXIS
# ----------------------------------------------------------------------------
print("============================================================================");
print("PART 2: From 2D to 3D – rotation about the xaxis");
print("In 3D we have coordinates (x, y, z).");
print("When rotating about the xaxis:");
print("  - The xcoordinate remains unchanged (the axis is the xaxis).");
print("  - The y and z coordinates rotate exactly as in the yzplane.");
print("Therefore:");
print("   x' = x");
print("   y' = y·cosθ - z·sinθ");
print("   z' = y·sinθ + z·cosθ");
print("");

print("Step 6 – Write as a 3×3 matrix:");
print("   [ x' ]   [ 1    0     0 ] [ x ]");
print("   [ y' ] = [ 0  cosθ -sinθ ] [ y ]");
print("   [ z' ]   [ 0  sinθ  cosθ ] [ z ]");
print("This is the rotation matrix R_x(θ).");
print("============================================================================");
print("");

print("Animation: A red vector initially at (0,1,0) rotates about the xaxis.");
print("The vector stays in the yzplane; its xcoordinate remains 0.");
print("");

Rx := theta -> Matrix([[1,0,0],[0,cos(theta),-sin(theta)],[0,sin(theta),cos(theta)]]):
frames_vec := []:
N := 32;
for i from 0 to N do
    theta := i * (2*Pi/N);
    v0 := Vector([0,1,0]);
    v_rot := Rx(theta) . v0;
    tip := convert(v_rot, list);
    # Draw vector as a line + a small sphere at the tip
    line_vec := line([0,0,0], tip, color="red", thickness=3);
    tip_sphere := sphere(tip, 0.08, color="red");
    # Coordinate axes as lines
    x_axis := line([-1.5,0,0], [3,0,0], color="black", thickness=1);
    y_axis := line([0,-1.5,0], [0,3,0], color="black", thickness=1);
    z_axis := line([0,0,-1.5], [0,0,3], color="black", thickness=1);
    axis_text := textplot3d([[3.2,0,0,"x"],[0,3.2,0,"y"],[0,0,3.2,"z"]], font=["Times",12]);
    frames_vec := [op(frames_vec),
                   display(line_vec, tip_sphere, x_axis, y_axis, z_axis, axis_text,
                           scaling=constrained, view=[-1.5..3,-1.5..3,-1.5..3],
                           orientation=[70,60], title=cat("θ = ", sprintf("%.2f", theta), " rad"))];
end do:
anim_vec := display(frames_vec, insequence=true):
print(anim_vec);
print("Click the play button. The red vector rotates in the yzplane.");
print("");

# ----------------------------------------------------------------------------
# PART 3: ROTATING A CUBE ABOUT THE XAXIS
# ----------------------------------------------------------------------------
print("============================================================================");
print("PART 3: Rotating a cube about the xaxis");
print("We apply the matrix R_x(θ) to every vertex of a cube.");
print("The cube has side length 2 and its centre at the origin.");
print("A dynamic caption below the plot shows the current numerical matrix.");
print("============================================================================");
print("");

# Cube definition
cube_vertices := [
    [-1,-1,-1], [ 1,-1,-1], [ 1, 1,-1], [-1, 1,-1],  # bottom face (z = -1)
    [-1,-1, 1], [ 1,-1, 1], [ 1, 1, 1], [-1, 1, 1]   # top face (z =  1)
];
edges := [
    [1,2],[2,3],[3,4],[4,1],  # bottom
    [5,6],[6,7],[7,8],[8,5],  # top
    [1,5],[2,6],[3,7],[4,8]   # vertical
];

draw_cube := proc(vertices)
    local edge, lines, faces;
    lines := seq( line(vertices[edge[1]], vertices[edge[2]], color="Black", thickness=2), edge in edges );
    faces := [
        polygon([vertices[1],vertices[2],vertices[3],vertices[4]], color="Red", transparency=0.5),
        polygon([vertices[5],vertices[6],vertices[7],vertices[8]], color="Green", transparency=0.5),
        polygon([vertices[1],vertices[2],vertices[6],vertices[5]], color="Blue", transparency=0.5),
        polygon([vertices[2],vertices[3],vertices[7],vertices[6]], color="Yellow", transparency=0.5),
        polygon([vertices[3],vertices[4],vertices[8],vertices[7]], color="Cyan", transparency=0.5),
        polygon([vertices[4],vertices[1],vertices[5],vertices[8]], color="Magenta", transparency=0.5)
    ];
    return display(lines, faces);
end:

frames_cube := []:
N := 32;
for i from 0 to N do
    theta := i * (2*Pi/N);
    rotated_vertices := map(v -> convert(Rx(theta) . Vector(v), list), cube_vertices);
    M := Rx(theta);
    matrix_caption := cat(
        "R_x(θ) = \n",
        sprintf("[%7.3f  %7.3f  %7.3f]", M[1,1], M[1,2], M[1,3]), "\n",
        sprintf("[%7.3f  %7.3f  %7.3f]", M[2,1], M[2,2], M[2,3]), "\n",
        sprintf("[%7.3f  %7.3f  %7.3f]", M[3,1], M[3,2], M[3,3])
    );
    frames_cube := [op(frames_cube),
                    display(draw_cube(rotated_vertices),
                            title = cat("θ = ", sprintf("%.2f", theta), " rad"),
                            orientation = [45,45,0],
                            lightmodel = light4,
                            scaling = constrained,
                            axes = normal,
                            labels = ["x","y","z"],
                            view = [-2.5..2.5, -2.5..2.5, -2.5..2.5],
                            caption = matrix_caption
                           )]:
end do:
anim_cube := display(frames_cube, insequence=true):
print(anim_cube);
print("Click the play button. The cube rotates about the xaxis.");
print("The caption shows the matrix R_x(θ) with current numerical values.");
print("============================================================================");
print("");

print("END OF WORKSHEET.");
print("You have now seen step by step how the rotation matrix about the xaxis is derived,");
print("from a 2D point rotation, through a 3D vector, to a full cube.");

"============================================================================"

 

"PART 1: 2D rotation in the yz‑plane"

 

"We consider a point P = (y, z) in the yz‑plane."

 

"We want to rotate it counter‑clockwise by an angle θ."

 

""

 

"Step 1 – Polar coordinates:"

 

"   y = r·cos(φ),   z = r·sin(φ)"

 

"where r is the distance from the origin and φ is the angle with the positive y‑axis."

 

""

 

"Step 2 – Rotation by θ adds θ to the angle:"

 

"   y' = r·cos(φ+θ),   z' = r·sin(φ+θ)"

 

""

 

"Step 3 – Use the addition formulas:"

 

"   cos(φ+θ) = cosφ·cosθ - sinφ·sinθ"

 

"   sin(φ+θ) = sinφ·cosθ + cosφ·sinθ"

 

""

 

"Step 4 – Multiply by r and substitute y = r·cosφ, z = r·sinφ:"

 

"   y' = y·cosθ - z·sinθ"

 

"   z' = y·sinθ + z·cosθ"

 

""

 

"Step 5 – Write as a matrix multiplication:"

 

"   [ y' ]   [ cosθ  -sinθ ] [ y ]"

 

"   [ z' ] = [ sinθ   cosθ ] [ z ]"

 

"The 2×2 matrix is the 2D rotation matrix R_2D(θ)."

 

"============================================================================"

 

""

 

"Animation: A point starting at (1,0) rotates through a full circle."

 

"Below the plot you see the numerical matrix R_2D(θ)."

 

""

 

32

 

 

"Click the play button. The point rotates and the matrix updates."

 

""

 

"============================================================================"

 

"PART 2: From 2D to 3D – rotation about the x‑axis"

 

"In 3D we have coordinates (x, y, z)."

 

"When rotating about the x‑axis:"

 

"  - The x‑coordinate remains unchanged (the axis is the x‑axis)."

 

"  - The y and z coordinates rotate exactly as in the yz‑plane."

 

"Therefore:"

 

"   x' = x"

 

"   y' = y·cosθ - z·sinθ"

 

"   z' = y·sinθ + z·cosθ"

 

""

 

"Step 6 – Write as a 3×3 matrix:"

 

"   [ x' ]   [ 1    0     0 ] [ x ]"

 

"   [ y' ] = [ 0  cosθ -sinθ ] [ y ]"

 

"   [ z' ]   [ 0  sinθ  cosθ ] [ z ]"

 

"This is the rotation matrix R_x(θ)."

 

"============================================================================"

 

""

 

"Animation: A red vector initially at (0,1,0) rotates about the x‑axis."

 

"The vector stays in the yz‑plane; its x‑coordinate remains 0."

 

""

 

32

 

 

"Click the play button. The red vector rotates in the yz‑plane."

 

""

 

"============================================================================"

 

"PART 3: Rotating a cube about the x‑axis"

 

"We apply the matrix R_x(θ) to every vertex of a cube."

 

"The cube has side length 2 and its centre at the origin."

 

"A dynamic caption below the plot shows the current numerical matrix."

 

"============================================================================"

 

""

 

[[-1, -1, -1], [1, -1, -1], [1, 1, -1], [-1, 1, -1], [-1, -1, 1], [1, -1, 1], [1, 1, 1], [-1, 1, 1]]

 

[[1, 2], [2, 3], [3, 4], [4, 1], [5, 6], [6, 7], [7, 8], [8, 5], [1, 5], [2, 6], [3, 7], [4, 8]]

 

32

 

 

"Click the play button. The cube rotates about the x‑axis."

 

"The caption shows the matrix R_x(θ) with current numerical values."

 

"============================================================================"

 

""

 

"END OF WORKSHEET."

 

"You have now seen step by step how the rotation matrix about the x‑axis is derived,"

 

"from a 2D point rotation, through a 3D vector, to a full cube."

(1.1)
 

 

Download rotatienmatrices_mprimes31-3-2026.mw

@Mapleliquid 
Hello , yes Heineken a fouvorite beer of  mine :-)

There is a complete guide  in Maple, so thi s make sense :
 

A Complete Guide for performing Tensors computations using Physics via maple help

A Complete Guide for Tensor computations using Physics - MaplePrimes

Tensors in Maple – definition and index actions (PDF)

with(Physics):
Setup();

@salim-barzani 

restart;
with(plots):

# Definieer de functie voor de 3D plot met parameters en componentkeuze
energie_3d_keuze := proc(comp, m, p, q, r, theta, w, v, t, alpha1, alpha2, alpha3, alpha4)
    local Delta, xi, Knum, Pnum, Hnum, plot_expressie, plot_kleur, plot_titel;
    # Bereken Delta
    Delta := sqrt(4*alpha1*w^2 + (4*theta*alpha3 - 4)*w + 3*alpha4*m^2 + 4*theta^2*alpha2 - 4*r) / 
             (2*sqrt(p^2*alpha1 + p*q*alpha3 + q^2*alpha2));
    # Definieer xi
    xi := p*x + q*y - t*v;
    # Bereken energie componenten
    Knum := - (m^2/(16*p^2*alpha1 + 16*p*q*alpha3 + 16*q^2*alpha2)) * 
            (3*m^2*alpha4 + 4*theta^2*alpha2 + 4*theta*w*alpha3 + 4*w^2*alpha1 - 4*r - 4*w) * 
            (-1 + cos(2*Delta*xi));
     Pnum := (1/(4*p^2*alpha1 + 4*p*q*alpha3 + 4*q^2*alpha2)) * cos(Delta*xi)^2 * 
            (alpha4*m^2*cos(Delta*xi)^2 + 2*alpha1*w^2 + (2*theta*alpha3 - 2)*w + 2*theta^2*alpha2 - 2*r) * m^2;
     Hnum := (m^2/(8*p^2*alpha1 + 8*p*q*alpha3 + 8*q^2*alpha2)) * 
            (2*alpha4*m^2*cos(Delta*xi)^4 - 3*alpha4*m^2*cos(Delta*xi)^2 + 
             3*alpha4*m^2 + 4*theta*w*alpha3 + 4*alpha1*w^2 + 4*theta^2*alpha2 - 4*r - 4*w);
    
    # Kies welke component geplot wordt
    if comp = 1 then
        plot_expressie := Knum;
        plot_kleur := red;
        plot_titel := "Kinetische Energie (Knum)";
    elif comp = 2 then
        plot_expressie := Pnum;
        plot_kleur := blue;
        plot_titel := "Potentiële Energie (Pnum)";
    else
        plot_expressie := Hnum;
        plot_kleur := green;
        plot_titel := "Totale Energie (Hnum)";
    end if;
    
    # Maak de 3D plot
    plot3d(plot_expressie, x = -5..5, y = -5..5, 
           view = [-5..5, -5..5, 0..0.35], color = plot_kleur,
           title = sprintf("%s (m=%.2f, p=%.2f, q=%.2f, t=%.2f)", plot_titel, m, p, q, t),
           labels = ["x", "y", "energie"],
           style = patchcontour, axes = boxed);
end proc:

# Maak de Explore versie met componentkeuze (zonder controller optie)
Explore(energie_3d_keuze(comp, m, p, q, r, theta, w, v, t, alpha1, alpha2, alpha3, alpha4),      
        parameters = [
            comp = [1, 2, 3],
            m = 0.1..5.0, p = 0.1..5.0, q = 0.1..5.0,
            r = 0.1..5.0, theta = 0.1..5.0, w = 0.1..5.0,
            v = 0.1..5.0, t = 0.1..5.0,
            alpha1 = 0.1..5.0, alpha2 = 0.1..5.0,
            alpha3 = 0.1..5.0, alpha4 = 0.1..5.0
        ],      
        initialvalues = [
            comp = 1, m = 1, p = 1, q = 1, r = 1, theta = 1, w = 1, v = 1, t = 1,
            alpha1 = 1, alpha2 = 1, alpha3 = 1, alpha4 = 1
        ],    
        placement = right);

Maybe this gui ?

Beta cannot be 0 , as a quick test, not symbolic , but numerically 

# Choose random numerical values for the parameters
#params := {beta = 0.5, eta1 = 1.2, eta2 = 0.8, gamma1 = 0.3, gamma2 = -0.4, N = 2};

# Evaluate both expressions with these values
eval(G0, params);
eval(G01, params);

# Check if they are (approximately) equal
evalb(eval(G0 - G01, params) = 0);
# Or use a tolerance
is(abs(eval(G0 - G01, params)) < 1e-10);




 

t := 5*Pi/9:
L := [-tan(4*Pi/9) + 4*sin(4*Pi/9)];
evalf~(L,20)[];

identify(-1.7320508075688772935);

A more practical approach ,well done..Maple, for recognizing a root form from the decimal form.

oneliner..( a long line ) 

toPrefix := e -> `if`(type(e,atomic), e,[op(0,e), seq(toPrefix(op(i,e)), i=1..nops(e))]):

ex := (a+b*c)^2:
toPrefix(ex);


exUltra :=
subs(a=b+c,
    expand(
        int(
            diff((x+y)^5*sin(exp(x^2+y^2)),x)
            /(1+sum(k*z^k,k=1..4)),
            x=0..1
        )
    )
):

toPrefix(exUltra );

exInsane :=
((f@g)@@3)(a+b*c)
+
(exp@@2)(sin@@3(x+y))
+
((a&*b)&+c)^5;

 exInsane := f(g(f(g(f(g(b c + a)))))) + @@(exp, 2)(@@(sin, 3))

                   5
    + (a &* b) &+ c 

toPrefix(exInsane );

A name is  a variable when there is a valued assigned to it. 


Used seq command here instead  a loop construction
Note: how fast the trees are growing :-) 

NULL

 

 

restart;
with(Fractals[LSystem]):
with(plots):

# Define the L-system generator
LGenerator := proc(n, Init, Angle0, Param, Rules, Color)
    local Iteration;
    
    # Use try-catch to avoid errors
    try
        if n = 0 then
            Iteration := Init;
        else
            Iteration := Iterate(Init, Rules, n);
        end if;
    catch:
        # If there's an error, use the initial string
        Iteration := Init;
    end try;
    
    # Draw the L-system
    LSystemPlot(
        Iteration,
        Param,
        initialangle = Angle0,
        color = Color,
        scaling = constrained,
        axes = none,
        thickness = 2
    );
end proc:

# First L-system (number 17)
Init17 := "X":
Angle17 := 90:

Param17 := [
  "F" = "draw:1",
  "+" = "turn:-25.7",
  "-" = "turn:25.7",
  "[" = "push:position;push:angle",
  "]" = "pop:position;pop:angle"
]:

Rules17 := [
  "F" = "FF",
  "X" = "F[+X][-X]FX"
]:

# Second L-system (number 18)
Init18 := "X":
Angle18 := 90:

Param18 := [
  "F" = "draw:1",
  "+" = "turn:20",
  "-" = "turn:-20",
  "[" = "push:position;push:angle",
  "]" = "pop:position;pop:angle"
]:

Rules18 := [
  "F" = "FF",
  "X" = "F[+X]F[-X]+X"
]:

# Test both L-systems without animation
print("L-system 17, iteration 4:");
display(LGenerator(4, Init17, Angle17, Param17, Rules17, "Red"));

print("L-system 18, iteration 4:");
display(LGenerator(4, Init18, Angle18, Param18, Rules18, "DarkGreen"));

# Create smoother animations with more frames
print("Smooth animation of L-system 17 (iterations 0-7):");
display([seq(LGenerator(i, Init17, Angle17, Param17, Rules17, "Red"), i = 0 .. 7)],
        insequence = true,
        frames = 64);  # More frames for smoother animation

print("Smooth animation of L-system 18 (iterations 0-7):");
display([seq(LGenerator(i, Init18, Angle18, Param18, Rules18, "DarkGreen"), i = 0 .. 7)],
        insequence = true,
        frames = 64);  # More frames for smoother animation

# Optional: Show all iterations side by side in a grid
print("All iterations of L-system 17 (0-7):");
display(Matrix(2, 4, [seq(LGenerator(i, Init17, Angle17, Param17, Rules17, "Red"), i = 0 .. 7)]));

print("All iterations of L-system 18 (0-7):");
display(Matrix(2, 4, [seq(LGenerator(i, Init18, Angle18, Param18, Rules18, "DarkGreen"), i = 0 .. 7)]));

# Even smoother version with interpolation (more iterations shown)
print("Extra smooth animation of L-system 17 (more frames):");
display([seq(LGenerator(i, Init17, Angle17, Param17, Rules17, "Red"), i = 0 .. 7)],
        insequence = true,
        frames = 128);  # Even more frames for extra smoothness

print("Extra smooth animation of L-system 18 (more frames):");
display([seq(LGenerator(i, Init18, Angle18, Param18, Rules18, "DarkGreen"), i = 0 .. 7)],
        insequence = true,
        frames = 128);

"L-system 17, iteration 4:"

 

 

"L-system 18, iteration 4:"

 

 

"Smooth animation of L-system 17 (iterations 0-7):"

 

 

"Smooth animation of L-system 18 (iterations 0-7):"

 

 

"All iterations of L-system 17 (0-7):"

 

 

 

 

 

 

 

"All iterations of L-system 18 (0-7):"

 

 

 

 

 

 

 

"Extra smooth animation of L-system 17 (more frames):"

 

 

"Extra smooth animation of L-system 18 (more frames):"

 

 

NULL


 

Download fractal_animatie_mprimes_26-1-2026.mw

@jalal 
Some experiment, but needs more thought 
I do need more math background/information for this figure in order to get this as a plot in Maple 

restart;
with(plots):

# parameters
p := 54.62;           # exponent
N := 120;             # number  rotaties
tmin := -1;
tmax := 1;

curves := []:

for k from 0 to N do
    theta := 2*Pi*k/N;

    x := t*cos(theta) - t^p*sin(theta);
    y := t*sin(theta) + t^p*cos(theta);

    curves := [op(curves),
        plot([x, y, t = tmin .. tmax],
             color = ColorTools:-Color([sin(theta)^2,
                                         cos(theta)^2,
                                         abs(sin(2*theta))]))];
end do:

display(curves,
        scaling = constrained,
        axes = none,
        background = white);

 

 

 

 

restart

with(PDEtools)

undeclare(prime, quiet)

declare(u(x, t), quiet); declare(U(xi), quiet); declare(V(xi), quiet); declare(Omega(x, t), quiet); declare(Q(x, t), quiet); declare(R(x, t), quiet)



# --- Symbols ---
declare(R(xi), phi(xi)):
#assume(alpha::real, beta::real, v::real):  ?????????????????

# --- Imaginary part Eq. (2.4) ---
ImEq :=
alpha*R(xi)*diff(phi(xi),xi$2)
+ 2*alpha*diff(R(xi),xi)*diff(phi(xi),xi)
- v*diff(R(xi),xi)
+ beta*(2*n+1)*R(xi)^(2*n)*diff(R(xi),xi):

# --- Chirp ansatz (Eq. 2.5) ---
phip  := eta_1*R(xi)^(2*n) + eta_2:
phipp := diff(phip, xi):

# --- Substitute ansatz ---
ImEq2 := subs(
  diff(phi(xi),xi)=phip,
  diff(phi(xi),xi$2)=phipp,
  ImEq
):

# --- Divide out R' ---
ImEq3 := factor(ImEq2/diff(R(xi),xi)):

# --- Helper symbol ---
Z := 'Z':
ImEq4 := subs(R(xi)^(2*n)=Z, ImEq3):

# --- Collect ---
C := collect(ImEq4, Z):

# --- Coefficients ---
C_Z := coeff(C, Z, 1):
C_0 := coeff(C, Z, 0):

# --- Solve ---
eta[1] := solve(C_Z = 0, eta_1);
eta[2] := solve(C_0 = 0, eta_2);

#eta1_sol, eta2_sol;

 

R(xi)*`will now be displayed as`*R

 

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

 

-(1/2)*beta*(2*n+1)/(alpha*(n+1))

 

(1/2)*v/alpha

(1.1)
 

``

Download chirped_parameter_eta1_eneta_2_mprimes_11-1-2026.mw

@salim-barzani 

HirotaTau :=
proc(N::posint, xi, A)
    local mu, f0, mus, muvals, f, i, j, mui, muval;

    # binaire variabelen mu[1]..mu[N]
    mu := array(1..N):

    # generieke subset-term
    f0 :=
    exp(
        add(mu[i]*xi[i], i=1..N)
      + add(
            add(mu[i]*mu[j]*ln(A[i,j]),
                i=1..j-1),
            j=1..N
        )
    );

    # alle binaire combinaties van mu (Gray code)
    mus := Iterator:-BinaryGrayCode(N);

    # vervangingen mu[i]=0/1
    muvals :=
    seq(
        { seq(mu[i], i=1..N) =~ seq(mui) },
        mui in mus
    );

    # subset-som
    f := add( eval(f0, muval), muval in muvals );

    return simplify(f);
end proc:

#restart;

N := 3:

xi := table():
A  := table():

f3 := HirotaTau(N, xi, A);

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