janhardo

715 Reputation

12 Badges

11 years, 101 days

MaplePrimes Activity


These are replies submitted by janhardo

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);


 

Seems to be in the good direction ...need some more adjustments
 

restart;
with(combinat):
f := proc(N)
    local M, coeff, all_terms, subsets, s, matchings, matching, B_product, pair, theta_indices, theta_product, term, i, k;
    all_terms := 0;
    for M from 0 to floor(N/2) do
        coeff := 1/(M! * 2^M);
        if M = 0 then
            all_terms := all_terms + coeff * mul(theta[i], i=1..N);
        else
            subsets := choose([$1..N], 2*M);
            for s in subsets do
                matchings := setpartition(s, 2);
                if matchings = [] then
                    matchings := [s];
                end if;
                for matching in matchings do
                    B_product := 1;
                    for pair in matching do
                        B_product := B_product * B[min(pair), max(pair)];
                    end do;
                    theta_indices := {$1..N} minus {op(s)};
                    theta_product := mul(theta[k], k in theta_indices);
                    term := coeff * B_product * theta_product;
                    all_terms := all_terms + term;
                end do;
            end do;
        end if;
    end do;
    return expand(all_terms);
end proc:
# Voorbeeld voor N=4
f(4);

 

@dharr Thanks, This application of diff_table goes beyond the declare mechanism than 
Let me summarise..
Note:  U [ ]  =  u 


 

@Carl Love  Thanks , now using it on the right way...

@dharr Thanks, the next ai code is also a example what needs correction

restart; 

# Definieer de parameters als symbolische variabelen
R1 := 'R1';  
R2 := 'R2';

# Definieer de variabelen en afgeleiden
U := 'U(xi)';      # Functie U(xi) blijft symbolisch
Phi := 'diff(U(xi), xi)';  # Definieer Phi als de eerste afgeleide van U

# Differentiaalvergelijking
eq := diff(Phi, xi) = R1 * U + R2 * U^3;

A solution seems to be 
example : declare(u(xi), Phi(xi));  # Declare functions with PDEtools to prevent recursion 

For solving this reduced louiville pde there were 2 solutions, both by using a substitution (ansatz?) in the liouville pde
- reducing pde to a ode 
- bring pde in a polynomial form 

@dharr Thanks, From the looks of it , it makes quite a difference which substitution you use.  

This solution Sol11 can be derived.
PDE2 is transformed to a new pde and this form suggests that there is  solution possible is for a rational function  or a power function
Some analyse is needed, but done by Maple  



The HINT has this form: HINT = 1/(A*x + B*t + C)^2 * F() 
F() ? 




restart;
with(PDEtools):
declare(u(x,t), w(x,t));  # Declareer afhankelijke variabelen

# Definieer de substitutie: u(x,t) = (1/beta) * ln(w(x,t)/beta)
tr := u(x,t) = ln(w(x,t)/beta)/beta;

# Originele PDE: a^2 u_{xx} + b e^{beta u} - u_{tt} = 0
PDE1 := a^2*diff(u(x,t), x, x) + b*exp(beta*u(x,t)) - diff(u(x,t), t, t) = 0;

# Voer de substitutie uit en vereenvoudig
PDE2 := dchange(tr, PDE1, [w], params={beta}, simplify(normal));

# Los PDE2 op met een HINT voor de vorm (A x + B t + C)^{-2}
sol_w := pdsolve(PDE2, HINT = 1/(A*x + B*t + C)^2 * F());

# Substitueer terug naar u(x,t)
sol_u := eval(tr, sol_w);

# Vereenvoudig de oplossing en hernoem constanten
sol_u := simplify(sol_u, {2*F()/(beta*b) = 2*(B^2 - a^2*A^2)/(beta*b)});
sol_u := subs(A = _C1, B = _C2, C = _C3, sol_u);  # Optioneel: hernoem constanten

# Test de oplossing
Test11 := pdetest(sol_u, PDE1);

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

 

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

 

u(x, t) = ln(w(x, t)/beta)/beta

 

a^2*(diff(diff(u(x, t), x), x))+b*exp(beta*u(x, t))-(diff(diff(u(x, t), t), t)) = 0

 

((diff(diff(w(x, t), x), x))*w(x, t)*a^2+b*w(x, t)^3-(diff(w(x, t), x))^2*a^2-(diff(diff(w(x, t), t), t))*w(x, t)+(diff(w(x, t), t))^2)/(w(x, t)^2*beta) = 0

 

w(x, t) = (-2*A^2*a^2+2*B^2)/(A^2*b*x^2+2*A*B*b*t*x+B^2*b*t^2+2*A*C*b*x+2*B*C*b*t+C^2*b)

 

u(x, t) = ln((-2*A^2*a^2+2*B^2)/((A^2*b*x^2+2*A*B*b*t*x+B^2*b*t^2+2*A*C*b*x+2*B*C*b*t+C^2*b)*beta))/beta

 

u(x, t) = ln((-2*A^2*a^2+2*B^2)/(b*(A*x+B*t+C)^2*beta))/beta

 

u(x, t) = ln((-2*_C1^2*a^2+2*_C2^2)/(b*(_C1*x+_C2*t+_C3)^2*beta))/beta

 

0

(1)

 


 

Download gereduceerde_liouvill_pde-opl11_via_HINT_uitzoeken.mw

 

DeepSeek ai seems to be smarter then ChatGPT...
Exploreplot 

By Perform travelling wave substitution using dchange,  the pde transform into a ode (reduction) 
This is working in default notation, but with a diff_table notation ?

default notation
restart;
with(PDEtools):

# Step 1: Define the PDE
declare(u(x,t));
pde := diff(u(x,t), t$2) + a^2*diff(u(x,t), x$2) = b*exp(beta*u(x,t));

# Step 2: Perform travelling wave substitution using dchange
# Transformation to the travelling wave coordinate z = x - c*t
tr := {x = z + c*tau, t = tau, u(x,t) = U(z)};
new_pde := dchange(tr, pde, [z, tau, U(z)]);

# Step 3: Simplify the resulting ODE (derivatives with respect to tau vanish)
ode := simplify(new_pde) assuming tau::constant;

# Step 4: Solve the ODE
sol := dsolve(ode, U(z));

# Display the solution
sol;

Can it ever be solved  exact ?
Finding real valued parameters for this function and and at the same time a solution for a npde 

Get rid of the sqrt ?..take the inverse  operation for this.

It's not yet clear to me exactly what you want to do.
- there is a plane. 
- there is a placevector( in Dutch :plaatsvector)  ( start in origin). 
The place vector intersects the plane and an intersection point should be calculated from it?

L4 has a crossterm  x*t  and coeffs command is not working for this ?

Now there is no plot , because k is a unknown




Lets take for k= 1 

First 18 19 20 21 22 23 24 Last Page 20 of 77