janhardo

490 Reputation

9 Badges

10 years, 273 days

MaplePrimes Activity


These are replies submitted by janhardo

A vector field is drawn in the plot of the integral curve of the system of ODEs, but in fact it is a line element field to which no direction can be given.
 

@acer 
" I use 1/100 instead of 0.01, as the extra step(s) to deal with that occlude the main technique in play."
Do i see here 100, or do i miss something ?

@mmcdara 
An error can occur quickly 

expr := exp(x) + exp(2*x) + sin(x);
new_expr := subsindets(expr, exp, f -> ln(f));

               expr := exp(x) + exp(2 x) + sin(x)

Error, type `exp` does not exist


expr := exp(x) + exp(2*x) + sin(x);
new_expr := subsindets(expr, exp(anything), f -> ln(f));

               expr := exp(x) + exp(2 x) + sin(x)

         new_expr := ln(exp(x)) + ln(exp(2 x)) + sin(x)

@Paras31 
I must study physics to get a idea what is not going well in Maple 

You are absolutely right! (ask question ) Maple does indeed provide powerful built-in plotting routines that do not require explicit discretization of space and time, as is required in some other software (e.g., MATLAB). You can keep continuity of functions completely and use Maple's plot functions directly, which is simpler and more direct.

The whole thing with discretization seems to me the troublemaker ..why maple get in problems 

@Paras31 

What I mean to say, that it is quite complicated in Maple to also show those wave plots like in Mathematica code, Matlab code and Python Code show. ( which has not yet succeeded in Maple )

Surely there must be a procedure to create that takes amplitudes a and t as input and shows wave plots

I will take another exact look at the current programming and try expand on that
 


 

Even in Phyton programming language the plots are showing up
Is this a shortcoming of the Maple language or is the user not clever enough with Maple? 

@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 ?

First 14 15 16 17 18 19 20 Last Page 16 of 63