janhardo

445 Reputation

8 Badges

10 years, 239 days

MaplePrimes Activity


These are replies submitted by janhardo

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


 

What happens when you simplify  ? 

Make this sense?, type is not aware of  commutativity and associativity of addition and multiplication.

Shouldn't you perform a pdetest when checking a solution of a pde and not do this with an odetest ?
Well, pde3 is a ode as it seems ,confusing naming  , i regocnise it because there is only one variable 

ode := simplify(expand(ode/exp((k*x - t*w)*I))) assuming exp((k*x - t*w)*I) <> 0;
odeadvisor(ode);
infolevel[dsolve]:=3;
Sol1 := dsolve(ode, U(xi));
#############
 Sol_n1 := dsolve(eval(ode_final, n=1), U(xi));

By matrix en determinant calculation and this can b eused for polynomial functions 
- for a parabole is needed 3 points , and degree 2 as example 
 

PolynomialFit := proc(P::list, d::integer := 2)
    uses LinearAlgebra, VectorCalculus, plots;
    local n, M, b, coeffs, poly, f, x_range, y_range, 
          x_min, x_max, y_min, y_max, x_padding, y_padding,
          plot_poly, plot_points, final_plot, i;

    # Controleer of er voldoende punten zijn voor de gevraagde graad
    n := nops(P);
    if n < d + 1 then
        error "Er zijn minimaal (d+1) punten nodig om een polynoom van graad d te passen.";
    end if;

    # Constructeer de matrix en vector voor de polynomial fit
    M := Matrix(n, d+1, (i, j) -> P[i][1]^(j-1));  # Elke rij is [1, x, x^2, ..., x^d]
    b := Vector(n, i -> P[i][2]);  # De y-waarden

    # Controleer of de matrix een inverse heeft (geen verticale lijn als alle x gelijk zijn)
    if Determinant(M) = 0 then
        error "Kan geen polynoom vinden: punten zijn niet lineair onafhankelijk of x-waarden zijn identiek.";
    end if;

    # Los het systeem op: M * coeffs = b
    coeffs := LinearSolve(M, b);

    # Constructeer het polynoom op basis van de gevonden coëfficiënten
    poly := add(coeffs[i+1] * x^i, i = 0..d);

    # Maak de functie f(x) in operator-notation
    f := unapply(poly, x);

    # Dynamisch plotbereik bepalen
    x_min := min(seq(P[i][1], i = 1..n));
    x_max := max(seq(P[i][1], i = 1..n));
    y_min := min(seq(P[i][2], i = 1..n));
    y_max := max(seq(P[i][2], i = 1..n));

    x_padding := 0.2 * (x_max - x_min);
    y_padding := 0.2 * (y_max - y_min);
    x_range := x_min - x_padding .. x_max + x_padding;
    y_range := y_min - y_padding .. y_max + y_padding;

    # Plot het polynoom
    plot_poly := plot(poly, x = x_range, y = y_range, color = "Blue", thickness = 3);

    # Plot de gegeven punten
    plot_points := plots:-pointplot(P, symbol = solidcircle, 
                                    color = "Red", symbolsize = 20);

    # Combineer de plots
    final_plot := plots:-display(plot_poly, plot_points,
                                 labels = ["x", "y"], title = cat("Fit met polynoom van graad ", d));

    # Eerst de plot weergeven
    print(final_plot);

    # Daarna de functie printen als operatorfunctie in Maple-notatie
    eval(f);
end proc:

P := [[-1, 1], [0, 0], [1, 1], [2, 8]];
PolynomialFit(P, 3);


 

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