janhardo

690 Reputation

12 Badges

11 years, 37 days

MaplePrimes Activity


These are replies submitted by janhardo

@Paras31 
Some progress , well done  but it must be  for t=3000 :-) 
You can get a analyse of the matlab code from Maple ai 

Can command Explore not be a help for the parameters of a complex function ? 
As help example from  Maple ,see ... 
 

Explore(plot3d(sin(a*x)*b*y, x = -Pi .. Pi, y = 1 .. sqrt(5), view = -5 .. 5), orientation = vertical, parameters = [[a = 1 .. 4.0, placement = left], [b = 1.0 .. sqrt(5), placement = right]])

 

@janhardo 
Its a tough problem, because the system of odes in this code is not the usual systems of odes  

What advantage does the editor have ?

@janhardo 
there is one plot what is showing up, but don't know yet for the other plots 


 

"maple.ini in users"

(1)

with(plots):

# Systeemparameters
L := 200:  # Lengte van het systeem
K := 99:  # Aantal ruimtelijke punten
j := 2:  # Modusnummer
omega_d := 1:  # Kenmerkende frequentie
beta := 1:  # Niet-lineariteit parameter
delta := 0.05:  # Dempingscoëfficiënt

# Ruimtelijke raster
h := L / (K + 1):  # Stapgrootte
n := Vector(1..K+2, k -> -L/2 + (k-1)*h):  # Ruimtelijke punten
N := K + 2:  # Aantal punten inclusief randen

# Geschaalde parameters
omegaDScaled := h * omega_d:
deltaScaled := h * delta:

# Tijdparameters
dt := 1:  # Tijdstap
tmax := 3000:  # Maximale tijd
tspan := [seq(0, tmax, dt)]:  # Tijdvector


# Definieer de differentiaalvergelijkingsfunctie (odefun)
odefun := proc(t, Y, N, h, omegaDScaled, deltaScaled, beta)
    local U, Udot, Uddot, dUdt, dUdotdt, dYdt, k;
    
    U := Vector(1..N, k -> Y[k]):  # Verplaatsingen U
    Udot := Vector(1..N, k -> Y[k+N]):  # Snelheden Udot
    
    Uddot := Vector(1..N):  # Tweede afgeleiden (Laplaciaan)
    
    # Laplacian (discrete second derivative) voor interne punten
    for k from 2 to N-1 do
        Uddot[k] := (U[k+1] - 2*U[k] + U[k-1]);
    end do;
    
    # Randvoorwaarden
    Uddot[1] := 0;
    Uddot[N] := 0;
    
    # Stelsel van vergelijkingen
    dUdt := Udot;
    dUdotdt := Uddot - deltaScaled * Udot + omegaDScaled^2 * (U - beta * U^~3);
    
    # Pack afgeleiden in één vector dYdt
    dYdt := Vector(2*N):
    for k from 1 to N do
        dYdt[k] := dUdt[k]:
        dYdt[k+N] := dUdotdt[k]:
    end do:

    
    return dYdt;
end proc:

###########################################################################################
# Begincondities voor initieel amplitude a = 2
#a_init := 2:
#U0_init := Vector(1..N, k -> a_init * sin((j * Pi * h * n[k]) / L)):  # Beginverplaatsing
#U0_init[1] := 0:  # Randvoorwaarde aan de linkerzijde
#U0_init[N] := 0:  # Randvoorwaarde aan de rechterzijde
#Udot0_init := Vector(1..N, k -> 0):  # Begin snelheid = 0

# Plot de beginverplaatsing U0_init
#plot(U0_init, n, color=red, linestyle=solid, title="t=0, a=2", labels=["x_n", "U_n"]);
# Begincondities voor initieel amplitude a = 2
a_init := 2:
U0_init := Vector(1..N, k -> a_init * sin((j * Pi * h * n[k]) / L)):  # Beginverplaatsing blijft hetzelfde
U0_init[1] := 0:  # Randvoorwaarde aan de linkerzijde
U0_init[N] := 0:  # Randvoorwaarde aan de rechterzijde
Udot0_init := Vector(1..N, k -> 0):  # Begin snelheid = 0

# Plot de beginverplaatsing U0_init zonder de fysische betekenis te veranderen
plot(n, U0_init, color=red, linestyle=solid, title="t=0, a=2 (ongewijzigde fysische betekenis)", labels=["x_n", "U_n"],
     view=[-100..100, -3..3]);


#############################################################################################
# Waarden van amplitude 'a' om over te itereren
a_values := [2, 1.95, 1.9, 1.85, 1.82]:

# Loop over elke waarde van 'a'
for i to numelems(a_values) do
    a := a_values[i]:
    
    # Begincondities voor verplaatsing en snelheid
    U0 := Vector(1..N, k -> a * sin((j * Pi * h * n[k]) / L)):
    U0[1] := 0:  # Randvoorwaarde aan de linkerzijde
    U0[N] := 0:  # Randvoorwaarde aan de rechterzijde
    Udot0 := Vector(1..N, k -> 0):  # Beginsnelheid = 0

    # Pack begincondities
    Y0 := <U0 | Udot0>:

    # Oplossen van de ODE's
    sol := dsolve({seq(diff(Y[k](t), t$2) = odefun(t, [seq(Y[j](t), j = 1..2*N)], N, h, omegaDScaled, deltaScaled, beta)[k], k = 1..2*N),
                   seq(Y  = Y0[k], k = 1..2*N)}, numeric, output=listprocedure):

    # Extract de oplossing voor verplaatsing
    Usol := eval([seq(sol(t)[k], k=1..N)], t=tmax):
    
    # Plot de eindverplaatsing
    plot(Usol, n, color=blue, linestyle=solid, title=sprintf("t=%d, a=%.2f", tmax, a), labels=["x_n", "U_n"]);
end do;

 

 

a := 2

 

_rtable[36893491189700486676]

 

U0[1] := 0

 

U0[101] := 0

 

_rtable[36893491189700480404]

 

_rtable[36893491189700474388]

 

Error, Matrix index out of range

 

 


 

Download 13-9-2024_gordon_klei_n_maple_primes_.mw

@Paras31 
 a standard ode or a pde differential equation ...
Seems to me that the second order pdv is now become a system of 1order pdvs 

@Paras31 
It seems to be difficult to get this code in Maple. 
In Mathematica i get within some minutes, the wanted plots. 
Its a wave pde equation , what is simplified to a systeem of two ode's, that's  your equation.
Going back to the basics of a pde wave equation and from there to the klein- gordon wave equation ?

@Paras31 , Well done , for that you must have good knowledge of the code and of the subject you are working on 
Only then can AI work more effectively and both conditions are not met by me unfortunately. 

Is the matlab code working what is showed here  giving the desired output ?

@Paras31 , Thanks, maybe i can it translate it with AI to Maple ? 

@Paras31 
Is there matlab code from the numeric simulation ?  

Maybey  its usable ?
The simulation for 5 cases , so you need one procedure for one case to start with

klein-gordon_eg_-_8-9-2024-mprimes.mw

@Paras31,  If you have the maple code that represents a situation for parameter alpha , then you could basically start making it generic 

@salim-barzani 

restart;

# Step 1: Define the simplified differential equation
# This assumes the right-hand side form is: C / (lambda * (C * zeta + D))
eq_case3 := diff(G(zeta), zeta) / G(zeta)^2 = C / (lambda * (C*zeta + D));

# Step 2: Rearrange the equation to isolate G'(zeta)
eq_case3_rearranged := diff(G(zeta), zeta) = C * G(zeta)^2 / (lambda * (C*zeta + D));

# Step 3: Solve the differential equation using Maple's dsolve
sol_case3 := dsolve(eq_case3_rearranged, G(zeta));

# Step 4: Simplify the solution, if necessary
simplified_sol_case3 := simplify(sol_case3);

# Display the final solution
simplified_sol_case3;
odeadvisor(diff(G(zeta), zeta)/G(zeta)^2 = C/(lambda*(C*zeta + D))):
                          [_separable]

In the beginning with the first photo printout with the colored indicated formulas and the 1st and 2nd corrected response from @mmcdara I could still follow what was happening. 
What happened next in the thread is not clear to me with multiple photo printouts of information. 
Has any feedback come from @salim-barzani that each code solution step of @mmcdara's elaborations are clear to him ( understood so )? 
If not, that needs to be worked on first as a basis to proceed. 

@salim-barzani 
IIt didn't cross my mind that you wouldn't know algebra, no way. 
Someone else brought it up 
Oh, yes I'm not an expert, so don't expect anything from me 
 

First 24 25 26 27 28 29 30 Last Page 26 of 73