janhardo

700 Reputation

12 Badges

11 years, 42 days

MaplePrimes Activity


These are replies submitted by janhardo

@salim-barzani 
Now with this checking to get  the equation for the 3 1-lump solitons ?

restart;
with(LinearAlgebra):

# Definieer de procedure
CollectiveMotion := proc(m, params)
    local i, x, y, t, a, b, alpha, beta, vx, vy, avg_vx, avg_vy, avg_a, eqn, collective_line:
    
    avg_vx := 0:
    avg_vy := 0:
    avg_a := 0:
    
    for i from 1 to m do
        # Extraheer parameters voor de i-de lump
        a := params[i][1]:
        b := params[i][2]:
        alpha := params[i][3]:
        beta := params[i][4]:
        
        # Bereken individuele snelheden
        vx := (a*a^2 + 2*beta*a + alpha*b^2) / (a^2 + b^2):
        vy := beta / (a^2 + b^2):
        
        # Gemiddelde snelheden en a-waarden accumuleren
        avg_vx := avg_vx + vx:
        avg_vy := avg_vy + vy:
        avg_a := avg_a + a:
    end do:
    
    # Gemiddelden nemen
    avg_vx := avg_vx / m:
    avg_vy := avg_vy / m:
    avg_a := avg_a / m:

    # Definieer de gezamenlijke bewegingslijn
    eqn := (x - avg_vx * t) + avg_a * (y - avg_vy * t) = 0:
    
    # Oplossen naar y
    collective_line := solve(eqn, y):
    
    return collective_line:
end proc:

# Voorbeeld: 3 lumps met verschillende parameters
CollectiveMotion(3, [[1, 1, 1, 1], [2, 1, 1, 2], [1, 2, 2, 1]]);


 

New updated procedure odegeniter () 4-3-2025 
- specify a parameter list to the procedure.
- if the ode is not defined, it is not shown in the Dataframe list

 

 

 

 


    

odegeniter := proc(V, t, y, differential_eq, param_list, solve_all, range)
    local params, eq, numrows, i, single_row, dataframe, param_names;
    local param_values, param_combination, p, generate_combinations, param_combinations, j, solution, all_zero, invalid_combination, total_combinations, valid_combinations;
    local rows, row_eqs, max_combinations, num_params;
    uses PDEtools;

    if not has(differential_eq, diff(y(t), t)) then
        error "The input must contain a differential equation with diff(y(t), t).";
    end if;

    if not (solve_all = true or solve_all = false) then
        error "solve_all must be true or false.";
    end if;

    if not (range = "all" or range = 'all' or type(range, nonnegint) or type(range, range)) then
        error "range must be 'all', a non-negative integer, or a valid range (e.g., 0..5).";
    end if;

    # Controleer of de parameterlijst correct is
    if not (type(param_list, list) and nops(param_list) > 0) then
        error "The parameter list must be a list containing at least one parameter name.";
    end if;

    # Zoek de parameters in de differentiaalvergelijking
    params := select(p -> member(p, param_list), indets(differential_eq));
    param_names := convert(params, list);
    num_params := nops(param_names);

    if num_params = 0 then
        error "No parameters from the given list were found in the differential equation.";
    end if;

    generate_combinations := proc(variables, values)
        local result, i, sub_combinations, v;
        if nops(variables) = 0 then
            return [[]];
        end if;
        result := [];
        for v in values do
            sub_combinations := generate_combinations(variables[2..-1], values);
            for i to nops(sub_combinations) do
                result := [op(result), [v, op(sub_combinations[i])]];
            end do;
        end do;
        return result;
    end proc;

    param_combinations := generate_combinations(param_names, V);
    max_combinations := nops(param_combinations);

    if max_combinations = 0 then
        error "No parameter combinations generated. Check the input values.";
    end if;

    printf("�� Expected total rows before filtering: %d\n", max_combinations);

    valid_combinations := 0;
    rows := Array(1..max_combinations, 1..(num_params + 3), datatype=anything);
    row_eqs := Array(1..max_combinations, datatype=anything);

    for i from 1 to max_combinations do
        param_combination := param_combinations[i];
        eq := differential_eq;

        # Controleer op ongeldige parameter combinaties
        all_zero := true;
        invalid_combination := false;

        for j to num_params do
            if param_combination[j] <> 0 then
                all_zero := false;
            end if;
            # **Voorkom deling door nul in de differentiaalvergelijking**
            if (param_names[j] = xi and param_combination[j] = 0) or
               (param_names[j] = omega and param_combination[j] = 0) then
                invalid_combination := true;
            end if;
        end do;

        if all_zero then
            printf("⚠️ Row %d skipped: Differential equation is undefined (all parameters = 0).\n", i-1);
            next;
        end if;

        if invalid_combination then
            printf("⚠️ Row %d skipped: Invalid parameter combination (division by zero detected).\n", i-1);
            next;
        end if;

        # **Voer substitutie uit als de combinatie geldig is**
        for j to num_params do
            p := param_names[j];
            eq := subs(p = param_combination[j], eq);
        end do;

        eq := simplify(eq);

        valid_combinations := valid_combinations + 1;
        rows[valid_combinations, 1] := valid_combinations - 1;
        for j to num_params do
            rows[valid_combinations, j+1] := param_combination[j];
        end do;
        rows[valid_combinations, num_params + 2] := eq;
        rows[valid_combinations, num_params + 3] := "";  
        row_eqs[valid_combinations] := eq;
    end do;

    numrows := valid_combinations;
    printf(" Valid rows after filtering: %d\n", numrows);

    if numrows = 0 then
        error "No valid parameter combinations remain after filtering out undefined ODE cases.";
    end if;

    if solve_all = true and (range = "all" or range = 'all') then
        printf("�� Generating full DataFrame...\n");
        for i from 1 to numrows do
            try
                solution := simplify(rhs(dsolve(row_eqs[i], y(t))));
                rows[i, num_params + 3] := solution;
            catch:
                rows[i, num_params + 3] := "No explicit solution";
            end try;
        end do;

        dataframe := DataFrame(
            Matrix(rows[1..numrows, 1..(num_params + 3)], datatype=anything),
            columns = ['Row', op(param_names), 'Equation', 'Solution']
        );
        return dataframe;

    elif solve_all = true and type(range, nonnegint) then
        printf("�� Fetching row %d...\n", range);
        if range >= numrows then
            error "Index out of range: There are only " || numrows || " valid rows (indices 0.." || (numrows-1) || ").";
        end if;

        single_row := rows[range+1, 1..(num_params + 3)];

        dataframe := DataFrame(
            Matrix([single_row], datatype=anything),
            columns = ['Row', op(param_names), 'Equation', 'Solution']
        );
        return dataframe;

    else
        error "Invalid combination of solve_all and range.";
    end if;
end proc:

V :=[1];
differential_eq := diff(y(t), t) = alpha * y(t) + beta * t + delta + sin(t)/xi - 2/omega;
param_list := [alpha, beta, delta, xi, omega];

result := odegeniter(V, t, y, differential_eq, param_list, true, all);

V := [1]

 

differential_eq := diff(y(t), t) = alpha*y(t)+beta*t+delta+sin(t)/xi-2/omega

 

param_list := [alpha, beta, delta, xi, omega]

 

�� Expected total rows before filtering: 1
Valid rows after filtering: 1
�� Generating full DataFrame...

 

module DataFrame () description "two-dimensional rich data container"; local columns, rows, data, binder; option object(BaseDataObject); end module

(1)

V := [ Pi, exp(1), 1/2, sqrt(2)];

differential_eq := diff(y(t), t) = alpha * y(t) + beta * t + delta + sin(t)/xi - 2/omega;
param_list := [alpha, beta, delta, xi, omega];

result := odegeniter(V, t, y, differential_eq, param_list, true, all);
 

V := [Pi, exp(1), 1/2, sqrt(2)]

 

differential_eq := diff(y(t), t) = alpha*y(t)+beta*t+delta+sin(t)/xi-2/omega

 

param_list := [alpha, beta, delta, xi, omega]

 

�� Expected total rows before filtering: 1024
Valid rows after filtering: 1024
�� Generating full DataFrame...

 

module DataFrame () description "two-dimensional rich data container"; local columns, rows, data, binder; option object(BaseDataObject); end module

(2)

 


 

Download odegeniter_proc-lijst_var_keuze_en_ongedefinieerd_4-3-2025.mw

@salim-barzani 
Hadn't you already asked this in an earlier question on the forum ?
Aren't you mixing up two questions now ?
That will go wrong then .

Compared to my solution with that other solution via @dharr, this is simple.
It is not yet fully understood...


 

restart

with(PDEtools)

with(LinearAlgebra)

NULL

with(SolveTools)

undeclare(prime)

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

(1)

declare(u(x, t))

u(x, t)*`will now be displayed as`*u

(2)

declare(w(x, t))

w(x, t)*`will now be displayed as`*w

(3)


 

KdV := diff(u(x, t), t)+u(x, t)*(diff(u(x, t), x))+delta*(diff(u(x, t), x, x, x)) = 0

 

diff(u(x, t), t)+u(x, t)*(diff(u(x, t), x))+delta*(diff(diff(diff(u(x, t), x), x), x)) = 0

(4)

u_sol := a20*(diff(ln(w(x, t)), x, x))+a10*(diff(ln(w(x, t)), x))+a00

a20*((diff(diff(w(x, t), x), x))/w(x, t)-(diff(w(x, t), x))^2/w(x, t)^2)+a10*(diff(w(x, t), x))/w(x, t)+a00

(5)

u_t := diff(u_sol, t); u_x := diff(u_sol, x); u_xxx := diff(u_sol, x, x, x)

 

a20*((diff(diff(diff(w(x, t), t), x), x))/w(x, t)-(diff(diff(w(x, t), x), x))*(diff(w(x, t), t))/w(x, t)^2-2*(diff(w(x, t), x))*(diff(diff(w(x, t), t), x))/w(x, t)^2+2*(diff(w(x, t), x))^2*(diff(w(x, t), t))/w(x, t)^3)+a10*(diff(diff(w(x, t), t), x))/w(x, t)-a10*(diff(w(x, t), x))*(diff(w(x, t), t))/w(x, t)^2

 

a20*((diff(diff(diff(w(x, t), x), x), x))/w(x, t)-3*(diff(diff(w(x, t), x), x))*(diff(w(x, t), x))/w(x, t)^2+2*(diff(w(x, t), x))^3/w(x, t)^3)+a10*(diff(diff(w(x, t), x), x))/w(x, t)-a10*(diff(w(x, t), x))^2/w(x, t)^2

 

a20*((diff(diff(diff(diff(diff(w(x, t), x), x), x), x), x))/w(x, t)-5*(diff(diff(diff(diff(w(x, t), x), x), x), x))*(diff(w(x, t), x))/w(x, t)^2+20*(diff(diff(diff(w(x, t), x), x), x))*(diff(w(x, t), x))^2/w(x, t)^3-10*(diff(diff(diff(w(x, t), x), x), x))*(diff(diff(w(x, t), x), x))/w(x, t)^2-60*(diff(diff(w(x, t), x), x))*(diff(w(x, t), x))^3/w(x, t)^4+30*(diff(diff(w(x, t), x), x))^2*(diff(w(x, t), x))/w(x, t)^3+24*(diff(w(x, t), x))^5/w(x, t)^5)+a10*(diff(diff(diff(diff(w(x, t), x), x), x), x))/w(x, t)-4*a10*(diff(diff(diff(w(x, t), x), x), x))*(diff(w(x, t), x))/w(x, t)^2+12*a10*(diff(diff(w(x, t), x), x))*(diff(w(x, t), x))^2/w(x, t)^3-3*a10*(diff(diff(w(x, t), x), x))^2/w(x, t)^2-6*a10*(diff(w(x, t), x))^4/w(x, t)^4

(6)

substituted_KdV := eval(KdV, [u(x, t) = u_sol, diff(u(x, t), t) = u_t, diff(u(x, t), x) = u_x, diff(u(x, t), x, x, x) = u_xxx])

 

a20*((diff(diff(diff(w(x, t), t), x), x))/w(x, t)-(diff(diff(w(x, t), x), x))*(diff(w(x, t), t))/w(x, t)^2-2*(diff(w(x, t), x))*(diff(diff(w(x, t), t), x))/w(x, t)^2+2*(diff(w(x, t), x))^2*(diff(w(x, t), t))/w(x, t)^3)+a10*(diff(diff(w(x, t), t), x))/w(x, t)-a10*(diff(w(x, t), x))*(diff(w(x, t), t))/w(x, t)^2+(a20*((diff(diff(w(x, t), x), x))/w(x, t)-(diff(w(x, t), x))^2/w(x, t)^2)+a10*(diff(w(x, t), x))/w(x, t)+a00)*(a20*((diff(diff(diff(w(x, t), x), x), x))/w(x, t)-3*(diff(diff(w(x, t), x), x))*(diff(w(x, t), x))/w(x, t)^2+2*(diff(w(x, t), x))^3/w(x, t)^3)+a10*(diff(diff(w(x, t), x), x))/w(x, t)-a10*(diff(w(x, t), x))^2/w(x, t)^2)+delta*(a20*((diff(diff(diff(diff(diff(w(x, t), x), x), x), x), x))/w(x, t)-5*(diff(diff(diff(diff(w(x, t), x), x), x), x))*(diff(w(x, t), x))/w(x, t)^2+20*(diff(diff(diff(w(x, t), x), x), x))*(diff(w(x, t), x))^2/w(x, t)^3-10*(diff(diff(diff(w(x, t), x), x), x))*(diff(diff(w(x, t), x), x))/w(x, t)^2-60*(diff(diff(w(x, t), x), x))*(diff(w(x, t), x))^3/w(x, t)^4+30*(diff(diff(w(x, t), x), x))^2*(diff(w(x, t), x))/w(x, t)^3+24*(diff(w(x, t), x))^5/w(x, t)^5)+a10*(diff(diff(diff(diff(w(x, t), x), x), x), x))/w(x, t)-4*a10*(diff(diff(diff(w(x, t), x), x), x))*(diff(w(x, t), x))/w(x, t)^2+12*a10*(diff(diff(w(x, t), x), x))*(diff(w(x, t), x))^2/w(x, t)^3-3*a10*(diff(diff(w(x, t), x), x))^2/w(x, t)^2-6*a10*(diff(w(x, t), x))^4/w(x, t)^4) = 0

(7)

simplified_KdV := simplify(substituted_KdV); numerator_KdV := numer(lhs(simplified_KdV))

 

((diff(diff(diff(diff(diff(w(x, t), x), x), x), x), x))*w(x, t)^4*a20*delta+delta*w(x, t)^3*(a10*w(x, t)-5*a20*(diff(w(x, t), x)))*(diff(diff(diff(diff(w(x, t), x), x), x), x))+(a20*w(x, t)*(a20-10*delta)*(diff(diff(w(x, t), x), x))-a20*(a20-20*delta)*(diff(w(x, t), x))^2+a10*w(x, t)*(a20-4*delta)*(diff(w(x, t), x))+a00*a20*w(x, t)^2)*w(x, t)^2*(diff(diff(diff(w(x, t), x), x), x))+(diff(diff(diff(w(x, t), t), x), x))*w(x, t)^4*a20+w(x, t)^2*(-3*a20*(a20-10*delta)*(diff(w(x, t), x))+a10*w(x, t)*(a20-3*delta))*(diff(diff(w(x, t), x), x))^2+(5*a20*(a20-12*delta)*(diff(w(x, t), x))^3-5*a10*(a20-(12/5)*delta)*w(x, t)*(diff(w(x, t), x))^2+(-3*a00*a20+a10^2)*w(x, t)^2*(diff(w(x, t), x))+w(x, t)^2*(a00*a10*w(x, t)-a20*(diff(w(x, t), t))))*w(x, t)*(diff(diff(w(x, t), x), x))+(a10*w(x, t)^4-2*a20*w(x, t)^3*(diff(w(x, t), x)))*(diff(diff(w(x, t), t), x))-(2*a20*(a20-12*delta)*(diff(w(x, t), x))^4-3*a10*w(x, t)*(a20-2*delta)*(diff(w(x, t), x))^3+(-2*a00*a20+a10^2)*w(x, t)^2*(diff(w(x, t), x))^2+w(x, t)^2*(a00*a10*w(x, t)-2*a20*(diff(w(x, t), t)))*(diff(w(x, t), x))+a10*w(x, t)^3*(diff(w(x, t), t)))*(diff(w(x, t), x)))/w(x, t)^5 = 0

 

-w(x, t)^2*(diff(w(x, t), x))^3*a10^2+24*(diff(w(x, t), x))^5*a20*delta+(diff(diff(diff(diff(diff(w(x, t), x), x), x), x), x))*w(x, t)^4*a20*delta-a10*(diff(w(x, t), x))*(diff(w(x, t), t))*w(x, t)^3-2*(diff(w(x, t), x))^5*a20^2-5*w(x, t)^3*(diff(w(x, t), x))*(diff(diff(diff(diff(w(x, t), x), x), x), x))*a20*delta-3*w(x, t)^3*(diff(w(x, t), x))*(diff(diff(w(x, t), x), x))*a00*a20+w(x, t)^3*(diff(w(x, t), x))*(diff(diff(diff(w(x, t), x), x), x))*a10*a20-4*w(x, t)^3*(diff(w(x, t), x))*(diff(diff(diff(w(x, t), x), x), x))*a10*delta-10*w(x, t)^3*(diff(diff(w(x, t), x), x))*(diff(diff(diff(w(x, t), x), x), x))*a20*delta-5*w(x, t)^2*(diff(w(x, t), x))^2*(diff(diff(w(x, t), x), x))*a10*a20+12*w(x, t)^2*(diff(w(x, t), x))^2*(diff(diff(w(x, t), x), x))*a10*delta+20*w(x, t)^2*(diff(w(x, t), x))^2*(diff(diff(diff(w(x, t), x), x), x))*a20*delta+30*w(x, t)^2*(diff(w(x, t), x))*(diff(diff(w(x, t), x), x))^2*a20*delta-60*w(x, t)*(diff(w(x, t), x))^3*(diff(diff(w(x, t), x), x))*a20*delta-3*w(x, t)^3*(diff(diff(w(x, t), x), x))^2*a10*delta+w(x, t)^3*(diff(diff(w(x, t), x), x))*(diff(diff(diff(w(x, t), x), x), x))*a20^2+2*w(x, t)^2*(diff(w(x, t), x))^3*a00*a20-w(x, t)^2*(diff(w(x, t), x))^2*(diff(diff(diff(w(x, t), x), x), x))*a20^2-3*w(x, t)^2*(diff(w(x, t), x))*(diff(diff(w(x, t), x), x))^2*a20^2+3*w(x, t)*(diff(w(x, t), x))^4*a10*a20-6*w(x, t)*(diff(w(x, t), x))^4*a10*delta+5*w(x, t)*(diff(w(x, t), x))^3*(diff(diff(w(x, t), x), x))*a20^2-2*w(x, t)^3*(diff(w(x, t), x))*(diff(diff(w(x, t), t), x))*a20-w(x, t)^3*(diff(diff(w(x, t), x), x))*(diff(w(x, t), t))*a20+2*w(x, t)^2*(diff(w(x, t), x))^2*(diff(w(x, t), t))*a20+w(x, t)^4*(diff(diff(diff(diff(w(x, t), x), x), x), x))*a10*delta+w(x, t)^4*(diff(diff(w(x, t), x), x))*a00*a10+w(x, t)^4*(diff(diff(diff(w(x, t), x), x), x))*a00*a20-w(x, t)^3*(diff(w(x, t), x))^2*a00*a10+w(x, t)^3*(diff(w(x, t), x))*(diff(diff(w(x, t), x), x))*a10^2+w(x, t)^3*(diff(diff(w(x, t), x), x))^2*a10*a20+(diff(diff(diff(w(x, t), t), x), x))*w(x, t)^4*a20+a10*(diff(diff(w(x, t), t), x))*w(x, t)^4

(8)

temp_sub := {diff(w(x, t), x) = Wx, w(x, t) = w_temp}; numerator_sub := subs(temp_sub, numerator_KdV)

 

{diff(w(x, t), x) = Wx, w(x, t) = w_temp}

 

-5*w_temp^3*Wx*(diff(diff(diff(Wx, x), x), x))*a20*delta-3*w_temp^3*Wx*(diff(Wx, x))*a00*a20+w_temp^3*Wx*(diff(diff(Wx, x), x))*a10*a20-4*w_temp^3*Wx*(diff(diff(Wx, x), x))*a10*delta-10*w_temp^3*(diff(Wx, x))*(diff(diff(Wx, x), x))*a20*delta-5*w_temp^2*Wx^2*(diff(Wx, x))*a10*a20+12*w_temp^2*Wx^2*(diff(Wx, x))*a10*delta+20*w_temp^2*Wx^2*(diff(diff(Wx, x), x))*a20*delta+30*w_temp^2*Wx*(diff(Wx, x))^2*a20*delta-60*w_temp*Wx^3*(diff(Wx, x))*a20*delta-2*Wx^5*a20^2+a10*(diff(diff(w_temp, t), x))*w_temp^4+(diff(diff(diff(w_temp, t), x), x))*w_temp^4*a20+24*Wx^5*a20*delta-w_temp^2*Wx^3*a10^2+(diff(diff(diff(diff(Wx, x), x), x), x))*w_temp^4*a20*delta-a10*Wx*(diff(w_temp, t))*w_temp^3-3*w_temp^3*(diff(Wx, x))^2*a10*delta+w_temp^3*(diff(Wx, x))*(diff(diff(Wx, x), x))*a20^2+2*w_temp^2*Wx^3*a00*a20-w_temp^2*Wx^2*(diff(diff(Wx, x), x))*a20^2-3*w_temp^2*Wx*(diff(Wx, x))^2*a20^2+3*w_temp*Wx^4*a10*a20-6*w_temp*Wx^4*a10*delta+5*w_temp*Wx^3*(diff(Wx, x))*a20^2-2*w_temp^3*Wx*(diff(diff(w_temp, t), x))*a20-w_temp^3*(diff(Wx, x))*(diff(w_temp, t))*a20+2*w_temp^2*Wx^2*(diff(w_temp, t))*a20+w_temp^4*(diff(diff(diff(Wx, x), x), x))*a10*delta+w_temp^4*(diff(Wx, x))*a00*a10+w_temp^4*(diff(diff(Wx, x), x))*a00*a20-w_temp^3*Wx^2*a00*a10+w_temp^3*Wx*(diff(Wx, x))*a10^2+w_temp^3*(diff(Wx, x))^2*a10*a20

(9)

coeff5 := coeff(numerator_sub, Wx, 5)*w_temp^5; coeff4 := coeff(numerator_sub, Wx, 4)*w_temp^4

 

(-2*a20^2+24*a20*delta)*w_temp^5

 

(3*a10*a20*w_temp-6*a10*delta*w_temp)*w_temp^4

(10)

equations := {coeff4 = 0, coeff5 = 0}; solutions := solve(equations, {a10, a20})

 

{(-2*a20^2+24*a20*delta)*w_temp^5 = 0, (3*a10*a20*w_temp-6*a10*delta*w_temp)*w_temp^4 = 0}

 

{a10 = 0, a20 = 0}, {a10 = 0, a20 = 12*delta}

(11)

valid_solution := select(has, [solutions], a20 = 12*delta)[1]
NULL
 

{a10 = 0, a20 = 12*delta}

(12)

u_final := eval(u_sol, valid_solution)

 

12*delta*((diff(diff(w(x, t), x), x))/w(x, t)-(diff(w(x, t), x))^2/w(x, t)^2)+a00

(13)

 


 

Download mprimes_16-2-2025_How_collect_a_fraction_which_contain_derivative_And_finding_parameters.mw

Is this 
equation (11) ?

@salim-barzani 
 "Dr.David did a great job about finding this parameter but didn't give any outcome"
I don't know this maple code, so i can not analyse it for new ideas   

@salim-barzani 
Of course not, it means that the code is not complete, i could not find quickly the desired to derived expression.for a[12]

@salim-barzani ,maybe this can give a direction?

 

restart;
with(PDEtools):
with(LinearAlgebra):
declare(u(x, y, t), f(x, y, t));

# Definieer de PDE
pde := diff(u(x,y,t),t) + kappa*beta(t)*diff(u(x,y,t),x$3) 
       - beta(t)*diff(u(x,y,t)*Int(diff(u(x,y,t),x),y),x);

# Lineair en niet-lineair deel splitsen
pde_nonlinear, pde_linear := selectremove(has, pde, u(x,y,t)^2);

# Eén-solitonoplossing
theta__i := k[i]*(x + r[i]*y - kappa*k[i]^2*Int(beta(tau), tau=0..t)) + eta[i];

sol1 := u(x, y, t) = -6*kappa*diff(diff(ln(1 + exp(theta__i)), x), y);

# Test de oplossing
pdetest(sol1, pde);  # Moet 0 geven als het correct is

# Twee-soliton ansatz
theta1 := eval(theta__i, i=1);
theta2 := eval(theta__i, i=2);
f_ansatz := 1 + exp(theta1) + exp(theta2) + a__12*exp(theta1 + theta2);
u_ansatz := -6*kappa*diff(diff(ln(f_ansatz), x), y);

# Substitueer in PDE en vereenvoudig
pde_substituted := eval(pde, u=u_ansatz);

# Vervang integralen door tijdsafhankelijke fase
pde_substituted := subs({
    Int(beta(tau), tau=0..t) = B(t),
    k[1]^3*B(t) = B1(t), 
    k[2]^3*B(t) = B2(t)
}, pde_substituted);

# Groepeer exponentiële termen
terms := collect(pde_substituted, [exp(theta1), exp(theta2), exp(theta1 + theta2)]); 

# Extraheer coëfficiënten voor verschillende exponentiële combinaties
eq1 := coeff(terms, exp(theta1 + theta2));
eq2 := coeff(terms, exp(2*theta1 + theta2));
eq3 := coeff(terms, exp(theta1 + 2*theta2));

# Los op voor a__12
solution := solve({eq1, eq2, eq3}, {a__12});
a__12_solution := simplify(eval(a__12, solution));

# Resultaat
a__12_solution := ((k[1] - k[2])^2 - (r[1] - r[2])^2)/((k[1] + k[2])^2 - (r[1] - r[2])^2);

 

@salim-barzani ..make this sense ?

"I need to find parameter a[12] any one have any vision for finding parameter"

A expression for parameter a[12]  or a value ? 

@dds  That happens more often that a package is not publicly available.
Concerned me for a moment to look into the contents of the package.
As @acer wrote the package is part of the DEtools package.
But the original package seems user-friendly given the detailed manual.

@acer thanks, yes I had seen it too..
But this code snippet connects to the worksheet demo_question.mw and was specifically about the use of infolevel command.

Is this old package to download somewhere ?, thanks.

sys := [PDE1, PDE2, PDE3, PDE4]:
infolevel[rifsimp]:=3
                    infolevel[rifsimp] := 3

rif := rifsimp(sys, [[w], [z]], indep = [x,y]);
Well done your programming...

restart;

# Load required packages
with(plots): 
with(geometry):

Fig := proc(t)
    local a, b, c, A, B, C, Oo, P, NorA, NorB, NorC, locus, Locus, dr, tx, p, points_coords, points_plot;

    # Constants
    a := 11; 
    b := 7;
    c := sqrt(a^2 - b^2);

    # Define points on the ellipse
    point(A, [a*cos(t), b*sin(t)]):
    point(B, [a*cos(t + 2/3*Pi), b*sin(t + 2/3*Pi)]):
    point(C, [a*cos(t + 4/3*Pi), b*sin(t + 4/3*Pi)]):
    point(Oo, [0,0]):

    # Equation of the locus
    locus := a^2*x^2 + b^2*y^2 - c^4/4 = 0:
    Locus := implicitplot(locus, x = -a .. a, y = -b .. b, color = green):

    # Correct definition of lines
    line(NorA, y - coordinates(A)[2] = ((a^2 * coordinates(A)[2])/(b^2 * coordinates(A)[1]))*(x - coordinates(A)[1]), [x, y]):
    line(NorB, y - coordinates(B)[2] = ((a^2 * coordinates(B)[2])/(b^2 * coordinates(B)[1]))*(x - coordinates(B)[1]), [x, y]):
    line(NorC, y - coordinates(C)[2] = ((a^2 * coordinates(C)[2])/(b^2 * coordinates(C)[1]))*(x - coordinates(C)[1]), [x, y]):

    # Intersection of lines NorA and NorB (the centroid)
    intersection(P, NorA, NorB):

    # Draw ellipse
    p := implicitplot(x^2/a^2 + y^2/b^2 - 1, x = -a .. a, y = -b .. b, color = blue):

    # Text labels
    tx := textplot([
        [coordinates(A)[], "A"],
        [coordinates(B)[], "B"],
        [coordinates(C)[], "C"],
        [coordinates(Oo)[], "O"],
        [coordinates(P)[], "P"]
    ], font = [times, bold, 16], align = [above, left]):

    # Convert geometry lines and points to plot structures
    points_coords := [coordinates(A), coordinates(B), coordinates(C), coordinates(Oo), coordinates(P)]:
    points_plot := pointplot(points_coords, symbol = solidcircle, symbolsize = 8, color = black):

    # Graphical display
    dr := display([
        p, 
        draw(NorA, color=red), draw(NorB, color=red), draw(NorC, color=red), 
        points_plot,
        Locus
    ]):

    return display(dr, tx, scaling=constrained, axes=none, 
        title = "Les triangles inscrits dans une ellipse ont leur centre de gravité en son centre. Lieu du point de concours des perpendiculaires issues des sommets/
                 Triangles inscribed in an ellipse have their centroid at its center. Locus of the intersection point of perpendiculars from the vertices", 
        titlefont = [HELVETICA, 14]):
end proc:

# Animate the figure
plots:-animate(Fig, [t], t=0.1..2*Pi, frames=150);

variants


 

restart;
 

 

H := proc(expr, S) local K,SS,temp;
  K := typefunc(identical(S[]),name);
  SS := freeze~(indets(expr, K)) union S;
  temp := subsindets(expr, K, freeze);
  ormap(s->type(expr, linear(s)), SS)
   and
  andmap(s->type(temp, And(polynom(anything,s),
                           satisfies(t->degree(t,s)<2))), SS);
end proc:
 

H := proc(expr, S)
  local K, SS, temp;
  
  K := typefunc(identical(S[]), name);  # Bepaal de variabelen in S
  SS := indets(expr, K) union S;        # Alle relevante variabelen
  SS := freeze~(SS);                    # Optimaliseer door alles in één keer te "freezen"
  
  temp := subsindets(expr, K, freeze);   # Bevroren versie van de expressie
  
  return ormap(s -> type(expr, linear(s)), SS)
          and andmap(s -> type(temp, And(polynom(anything, s), satisfies(t -> degree(t, s) < 2))), SS);
end proc:

 

H := proc(expr, S)
  local SS, temp;
  SS := freeze~(indets(expr, typefunc(identical(S[]), name)) union S);
  temp := subsindets(expr, typefunc(identical(S[]), name), freeze);
  return ormap(s -> type(expr, linear(s)), SS)
         and andmap(s -> type(temp, polynom(anything, s)) and degree(temp, s) < 2, SS);
end proc:
 

H := proc(expr, S)
  local SS := freeze~(indets(expr, typefunc(identical(S[]), name)) union S);
  return ormap(s -> type(expr, linear(s)), SS)
         and andmap(s -> type(subsindets(expr, typefunc(identical(S[]), name), freeze), polynom(anything, s))
         and degree(subsindets(expr, typefunc(identical(S[]), name), freeze), s) < 2, SS);
end proc:
 

H := (e, S) -> ormap(s -> type(e, linear(s)), freeze~(indets(e, typefunc(identical(S[]), name)) union S))
       and andmap(s -> type(subsindets(e, typefunc(identical(S[]), name), freeze), polynom(anything, s))
       and degree(subsindets(e, typefunc(identical(S[]), name), freeze), s) < 2,
       freeze~(indets(e, typefunc(identical(S[]), name)) union S)):

 

H( a*f(X1, X2)*g(X4) + b*X3*g(X4) + c*X1 + d*X1*X2,
   {X1,X2,X3,X4} );
                             
H( a*b + c,
   {X1,X2,X3,X4} );
                             

H( a*f(X1, X2)*g(X4)^2 + b*X3*g(X4) + c*X1 + d*X1*X2,
   {X1,X2,X3,X4} );
                            

H( a*f(X1, X2)*g(X4) + b*X3^4*g(X4) + c*X1 + d*X1*X2,
   {X1,X2,X3,X4} );
                            

H( a*f(X1, X2)*g(X4) + b*X3*g(X4) + c^2*X1 + d*X1*X2*X3*X4,
   {X1,X2,X3,X4} );

H( a*b*X3 + c^2*X1 + d*X1*X2*X3*X4,
   {X1,X2,X3,X4} );
                              

H( a*b*X3^4 + c^2*X1 + d*X1*X2*X3*X4,
   {X1,X2,X3,X4} );
                             

H( a*b + c^2*X1,
   {X1,X2,X3,X4} );
                             
 

 


 

Download typefunctie_11-2-2025_mprimes.mw


 
First 13 14 15 16 17 18 19 Last Page 15 of 73