mmcdara

7601 Reputation

22 Badges

8 years, 324 days

MaplePrimes Activity


These are replies submitted by mmcdara

@brian bovril 

Using permutation and brute force proves itself to be simpler and most reliable than trying to randomize everything.

 

restart
 

N := 10:
L := [$1..N];

[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

(1)

Lex      := [ L[], L[1] ]:
sits_out := [ seq([Lex[i], Lex[i+1]], i=1..N) ]:
Lremain  := [ seq(subsop(sits_out[i][1] = NULL, sits_out[i][2] = NULL, L), i=1..N) ]:

tt := proc(S, M)
  local T, t, m:
  T := combinat:-randperm(S)[1]:
  for m from 2 to M do
    t := combinat:-randperm( remove(has, S, op~([T])) )[1]:
    T := T, t
  end do:
  return {T}
end proc:

found := false:

while not found do
  S        := { seq(seq([Lremain[1][i], Lremain[1][i+j]], j=1..N-2-i), i=1..N-3) };
  Round[1] := tt(S, (N-2)/2);
  perm     := L =~ ListTools:-Rotate(L, 1);

  for k from 2 to N do
    Round[k] := eval(Round[k-1], perm)
  end do:

  if numelems(`union`(seq(convert~(Round[k], set), k=1..N))) = N*(N-2)/2 then
    found := true:
  end if:
end do:

Matrix(N, 2, (i, j) -> `if`(j=1, Round[i], sits_out[i]));

Matrix([[{[3, 4], [5, 8], [6, 10], [7, 9]}, [1, 2]], [{[4, 5], [6, 9], [7, 1], [8, 10]}, [2, 3]], [{[5, 6], [7, 10], [8, 2], [9, 1]}, [3, 4]], [{[6, 7], [8, 1], [9, 3], [10, 2]}, [4, 5]], [{[1, 3], [7, 8], [9, 2], [10, 4]}, [5, 6]], [{[1, 5], [2, 4], [8, 9], [10, 3]}, [6, 7]], [{[1, 4], [2, 6], [3, 5], [9, 10]}, [7, 8]], [{[2, 5], [3, 7], [4, 6], [10, 1]}, [8, 9]], [{[1, 2], [3, 6], [4, 8], [5, 7]}, [9, 10]], [{[2, 3], [4, 7], [5, 9], [6, 8]}, [10, 1]]])

(2)

# Check each game appears only once

numelems(`union`(seq(convert~(Round[k], set), k=1..N))) ,  N*(N-2)/2

40, 40

(3)

for n from 1 to N do
  printf("Round %d\n", n):
  printf("  byes %a\n", sits_out[n]):
  for j from 1 to (N-2)/2 do
    printf("  game %d vs %d\n", op(Round[n][j])):
  end do:
  print():
end do:

Round 1

  byes [1, 2]
  game 3 vs 4
  game 5 vs 8
  game 6 vs 10
  game 7 vs 9

 

 

Round 2
  byes [2, 3]
  game 4 vs 5
  game 6 vs 9
  game 7 vs 1
  game 8 vs 10

 

 

Round 3
  byes [3, 4]
  game 5 vs 6
  game 7 vs 10
  game 8 vs 2
  game 9 vs 1

 

 

Round 4
  byes [4, 5]
  game 6 vs 7
  game 8 vs 1
  game 9 vs 3
  game 10 vs 2

 

 

Round 5
  byes [5, 6]
  game 1 vs 3
  game 7 vs 8
  game 9 vs 2
  game 10 vs 4

 

 

Round 6
  byes [6, 7]
  game 1 vs 5
  game 2 vs 4
  game 8 vs 9
  game 10 vs 3

 

 

Round 7
  byes [7, 8]
  game 1 vs 4
  game 2 vs 6
  game 3 vs 5
  game 9 vs 10

 

 

Round 8
  byes [8, 9]
  game 2 vs 5
  game 3 vs 7
  game 4 vs 6
  game 10 vs 1

 

 

Round 9
  byes [9, 10]
  game 1 vs 2
  game 3 vs 6
  game 4 vs 8
  game 5 vs 7

 

 

Round 10
  byes [10, 1]
  game 2 vs 3
  game 4 vs 7
  game 5 vs 9
  game 6 vs 8

 

(4)

 


 

Download Round_Robin_mmcdara.mw

 

@segfault 

Just to be clear, the "list of arguments" are the independent routines to be calculated in parallel right ?

Not at all.

Explanation:
when I run all the simulations on a single node I use a procedure SIMULER_OneProc whose call is basically this one

res := SIMULER_OneProc(Ver_plan_exp, Drag_sol, tps_decollement, Ver_piecewise_va, mur, tps_max):

Next, for obvious computational reasons, I want to distribute the same simulations over multiple nodes.
The idea is to split the matrix Ver_plan_exp which defines the simulation conditions into several blocks that are indepently ran in parallel on several nodes, and to repeat this operation until all the simulation conditions are used.

To do this I built a new procedure SIMULER_MP from  procedure  SIMULER_OneProc.
Procedure SIMULER_MP has exactly the same body of commands than SIMULER_OneProc,  except for one thing: for the reasons I explained previously I decided to save the simulation results in a file instead of return the corresponding matrix.

Then these two procedures end this way:

SIMULER_OneProc := proc(....)
.
.
# loop over the simulation conditions (build some matrix RESULT)
.
.
return RESULT
end proc



SIMULER_MP := proc(....)
.
.
# loop over the simulation conditions (build some matrix RESULT)
.
.
save RESULT Some_m_File
end proc

So  SIMULER_MP must have extra arguments, comparer to  SIMULER_OneProc's) to manage the name of the file where the partial results are saved.
Those two arguments are:

  • the number num_bloc of the Ver_plan_exp block currently simulated,
  • the absolute path ICI of the folder where the file is saved.

Then a direct call of SIMULER_MP is

SIMULER_MP(num_bloc, plan_bloc, [1], eval(Drag_sol), tps_decollement, [Ver_piecewise_va], 
           mur, tps_max, ICI)   

Compare the command above to this one:

Grid:-Run(
      noeud,              
      SIMULER_MP,            
      [                        
        num_bloc,              
        plan_bloc,            
        [1],                  
        eval(Drag_sol),       
        tps_decollement,      
        [Ver_piecewise_va],   
        mur,                  
        tps_max               
        ICI                   
      ]                       
    ):

You see that I do not write (which could seem more natural) this

Grid:-Run(
      noeud,              
      SIMULER_MP(num_bloc, plan_bloc, [1], eval(Drag_sol), tps_decollement, [Ver_piecewise_va],
                 mur, tps_max, ICI     
    ):

Using Grid:-Run imposes using three arguments: 

  1. the node on which execute the task,
  2. the name of the procedure to execute,
  3. the list of its parameters (thus the sequence of the names its definition contents...that is what is called parameterSequence in help(procedure) ).

What is arround Grid:-Run is nothing but a double loop over all the  Ver_plan_exp blocks: indeed you may observe that the second argument of SIMULER_MP is  not  Ver_plan_exp but plan_bloc which is nothing but the block to simulate. 

So what I do here is 
asking several nodes to run exactly the same process (task) with different data 
NOT
asking several nodes to run each a different process included in a single task.



(sorry I don't have Maple right now)

The pentagon is concave equilateral pentagon... hard to cop with.
The classical trick is to used its convex counterpart: define point B'  as the symetric of point B wrt line AC.
Then AB'CDE is a convex equilateral pentagon.
Solving it is quite easy by considering the three isoceles triangles AB'E, EB'D and DB'C.
The method can found here

To get the angles of the original concave pentagon observe that angle <A, B', C> = 2*Pi-b, and that the 4 angles on the figure below are equal

@salim-barzani 

I'm honestly a very far cry from that.

@salim-barzani 

restart

Error,

restart

 

with(PDEtools):

with(LinearAlgebra):

with(SolveTools):

undeclare(prime)

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

(1)

PDEtools:-declare(Omega(x, t)); 1; PDEtools:-declare(U(xi)); 1; PDEtools:-declare(u(x, y, z, t)); 1; PDEtools:-declare(Q(xi))

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

 

U(xi)*`will now be displayed as`*U

 

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

 

Q(xi)*`will now be displayed as`*Q

(2)

tr := {t = tau, x = (-ZETA*c[3]-tau*c[4]-`&Upsilon;`*c[2]+xi)/c[1], y = `&Upsilon;`, z = ZETA, u(x, y, z, t) = U(xi)}:

pde1 := diff(u(x, y, z, t), `$`(x, 3), z)-4*(diff(u(x, y, z, t), x, t))+4*(diff(u(x, y, z, t), x))*(diff(u(x, y, z, t), x, z))+2*(diff(u(x, y, z, t), `$`(x, 2)))*(diff(u(x, y, z, t), z))+3*(diff(u(x, y, z, t), `$`(y, 2))) = 0:

``

L1 := PDEtools:-dchange(tr, pde1, [xi, `&Upsilon;`, ZETA, tau, U]):

map(int, L1, xi):

ode := %:

F := sum(a[i]*(m+1/(diff(G(xi), xi)))^i, i = -1 .. 1):

D1 := diff(F, xi):

S := diff(G(xi), `$`(xi, 2)) = -(2*m*mu+lambda)*(diff(G(xi), xi))-mu:

E1 := subs(S, D1):

D2 := diff(E1, xi):

E2 := subs(S, D2):

D3 := diff(E2, xi):

E3 := subs(S, D3):

NULL

K := U(xi) = F:

K1 := diff(U(xi), xi) = E1:

K2 := diff(U(xi), `$`(xi, 2)) = E2:

K3 := diff(U(xi), `$`(xi, 3)) = E3:

NULL

L := eval(ode, {K, K1, K2, K3}):

# rewritting rule

RR := isolate(m+1/(diff(G(xi), xi))=Phi, diff(G(xi), xi));

diff(G(xi), xi) = 1/(Phi-m)

(3)

# Apply RR and collect wrt Phi

subs(RR, L):
normal(%):
PhiN := collect(numer(lhs(%)), Phi):
PhiD := denom(lhs(%%));

Phi^4

(4)



with(LargeExpressions):

LLE := collect(PhiN, Phi, Veil[phi] ):
LLE / PhiD = 0;

(3*Phi^8*phi[1]+6*Phi^7*phi[2]+Phi^6*phi[3]+Phi^5*phi[4]-Phi^4*phi[5]-Phi^3*phi[6]+Phi^2*phi[7]-6*Phi*phi[8]+3*phi[9])/Phi^4 = 0

(5)

# phi[i] coefficients


phis := [ seq( phi[i] = simplify(Unveil[phi](phi[i]), size), i=1..LastUsed[phi] ) ]:

print~( phis ):

phi[1] = mu^2*a[1]*c[1]^2*c[3]*(2*mu*c[1]+a[1])

 

phi[2] = lambda*mu*a[1]*c[1]^2*c[3]*(2*mu*c[1]+a[1])

 

phi[3] = -8*(mu*c[3]*(m^2*mu^2+m*mu*lambda-(7/8)*lambda^2)*c[1]^3+(3/4)*c[3]*((m^2*a[1]+a[-1])*mu^2+m*mu*lambda*a[1]-(1/2)*lambda^2*a[1])*c[1]^2+(1/2)*mu*c[1]*c[4]-(3/8)*mu*c[2]^2)*a[1]

 

phi[4] = -8*(c[3]*(m^2*mu^2+m*mu*lambda-(1/8)*lambda^2)*c[1]^3+(3/4)*c[3]*(m*lambda*a[1]+mu*(m^2*a[1]+2*a[-1]))*c[1]^2+(1/2)*c[1]*c[4]-(3/8)*c[2]^2)*lambda*a[1]

 

phi[5] = -2*(m^2*mu^2+m*mu*lambda-(1/2)*lambda^2)*c[3]*((m^2*a[1]+a[-1])*mu+m*lambda*a[1])*c[1]^3-3*c[3]*((m^4*a[1]^2+4*m^2*a[-1]*a[1]+a[-1]^2)*mu^2+2*m*lambda*a[1]*(m^2*a[1]+2*a[-1])*mu+lambda^2*a[1]*(m^2*a[1]-2*a[-1]))*c[1]^2-4*((m^2*a[1]+a[-1])*mu+m*lambda*a[1])*c[4]*c[1]+3*((m^2*a[1]+a[-1])*mu+m*lambda*a[1])*c[2]^2

 

phi[6] = -8*a[-1]*lambda*(c[3]*(m^2*mu^2+m*mu*lambda-(1/8)*lambda^2)*c[1]^3+(3/2)*c[3]*(m*lambda*a[1]+mu*(m^2*a[1]+(1/2)*a[-1]))*c[1]^2+(1/2)*c[1]*c[4]-(3/8)*c[2]^2)

 

phi[7] = -8*a[-1]*(mu^2*c[1]^2*c[3]*(mu*c[1]+(3/4)*a[1])*m^4+2*c[3]*mu*c[1]^2*(mu*c[1]+(3/4)*a[1])*lambda*m^3+((1/8)*mu*c[3]*c[1]^3*lambda^2+(3/4)*c[3]*(lambda^2*a[1]+mu^2*a[-1])*c[1]^2+(1/2)*mu*c[1]*c[4]-(3/8)*mu*c[2]^2)*m^2+(3/4)*(-(7/6)*c[1]^3*c[3]*lambda^2+mu*a[-1]*c[1]^2*c[3]+(2/3)*c[1]*c[4]-(1/2)*c[2]^2)*lambda*m-(3/8)*lambda^2*a[-1]*c[1]^2*c[3])

 

phi[8] = (m*mu+lambda)*a[-1]*c[3]*(2*m^2*mu*c[1]+2*lambda*m*c[1]+a[-1])*m*lambda*c[1]^2

 

phi[9] = (m*mu+lambda)^2*a[-1]*c[3]*(2*m^2*mu*c[1]+2*lambda*m*c[1]+a[-1])*m^2*c[1]^2

(6)

# WATCHOUT: you have 9 coefficients and so its desirable to have the same number of unknowns

unknowns := indets(rhs~(phis), name);

COEFFS := solve(rhs~(phis), unknowns)

{lambda, m, mu, a[-1], a[1], c[1], c[2], c[3], c[4]}

 

{lambda = 0, m = 0, mu = mu, a[-1] = a[-1], a[1] = 0, c[1] = c[1], c[2] = c[2], c[3] = c[3], c[4] = -(3/4)*(mu*a[-1]*c[1]^2*c[3]-c[2]^2)/c[1]}, {lambda = 0, m = m, mu = 0, a[-1] = a[-1], a[1] = a[1], c[1] = c[1], c[2] = c[2], c[3] = c[3], c[4] = c[4]}, {lambda = 0, m = m, mu = mu, a[-1] = a[-1], a[1] = a[1], c[1] = c[1], c[2] = c[2], c[3] = 0, c[4] = (3/4)*c[2]^2/c[1]}, {lambda = 0, m = m, mu = mu, a[-1] = -2*m^2*mu*c[1], a[1] = -2*mu*c[1], c[1] = c[1], c[2] = c[2], c[3] = c[3], c[4] = (1/4)*(16*m^2*mu^2*c[1]^3*c[3]+3*c[2]^2)/c[1]}, {lambda = lambda, m = m, mu = 0, a[-1] = a[-1], a[1] = a[1], c[1] = c[1], c[2] = c[2], c[3] = 0, c[4] = (3/4)*c[2]^2/c[1]}, {lambda = lambda, m = m, mu = mu, a[-1] = 0, a[1] = 0, c[1] = c[1], c[2] = c[2], c[3] = c[3], c[4] = c[4]}, {lambda = lambda, m = m, mu = mu, a[-1] = 0, a[1] = a[1], c[1] = c[1], c[2] = c[2], c[3] = 0, c[4] = (3/4)*c[2]^2/c[1]}, {lambda = lambda, m = m, mu = mu, a[-1] = 0, a[1] = -2*mu*c[1], c[1] = c[1], c[2] = c[2], c[3] = c[3], c[4] = (1/4)*(4*m^2*mu^2*c[1]^3*c[3]+4*lambda*m*mu*c[1]^3*c[3]+lambda^2*c[1]^3*c[3]+3*c[2]^2)/c[1]}, {lambda = lambda, m = m, mu = mu, a[-1] = a[-1], a[1] = a[1], c[1] = (3/4)*c[2]^2/c[4], c[2] = c[2], c[3] = 0, c[4] = c[4]}, {lambda = lambda, m = m, mu = mu, a[-1] = a[-1], a[1] = a[1], c[1] = c[1], c[2] = 0, c[3] = 0, c[4] = 0}, {lambda = lambda, m = m, mu = mu, a[-1] = -2*m^2*mu*c[1]-2*lambda*m*c[1], a[1] = 0, c[1] = c[1], c[2] = c[2], c[3] = c[3], c[4] = (1/4)*(4*m^2*mu^2*c[1]^3*c[3]+4*lambda*m*mu*c[1]^3*c[3]+lambda^2*c[1]^3*c[3]+3*c[2]^2)/c[1]}, {lambda = lambda, m = m, mu = mu, a[-1] = a[-1], a[1] = a[1], c[1] = 0, c[2] = 0, c[3] = c[3], c[4] = c[4]}

(7)
 

 

Download factoring_mmcdara_2.mw

@acer 

Thank you for these clarifications, they give me a picture of the situation that I didn't imagine.  
Hard to find out who's the good guy and who's the bad guy in this story, above all when the good maybe isn't that good and the bad maybe isn't that bad... which is not my concern for I'm not a vigilante.
I can understand your last comment

@salim-barzani 

Might I suggest you to open a new question to ask, with very measured words, why your questions seem to be systematically displaced or deleted, what is the Mapleprimes policy you violate, and how you should proceed in the future for not being subjected any longer to these disagreements?

@salim-barzani 

Do you have any idea where your last question about the Wiener process and the 2D representation of T2 is now?

For the record, here is the solution I proposed you S5_mmcdara-2.mw

@salim-barzani 

... you likely downloaded the initial version of file S5_mmcdara.mw which lasted only a couple of minutes.
Please download the one included in my answer, the coding is simpler.

Concerning your last question, here is a way:
 

restart;

currentdir(kernelopts(':-homedir')):

randomize():

local gamma:

T3 := (B[1]*(tanh(2*n^2*(delta^2-psi)*k*t/((k*n-1)*(k*n+1))+x)-1))^(1/(2*n))*exp(I*(-k*x+psi*t+delta*W(t)-delta^2*t));

(B[1]*(tanh(2*n^2*(delta^2-psi)*k*t/((k*n-1)*(k*n+1))+x)-1))^((1/2)/n)*exp(I*(-k*x+psi*t+delta*W(t)-delta^2*t))

(1)

params := {B[1]=1, n=2, delta=2, psi=1, k=3 }:

insert numerical values

solnum :=subs(params, T3):

N := 400:
use Finance in:
  Wiener := WienerProcess():
  P := PathPlot(Wiener(t), t = 0..10, timesteps = N, replications = 1):
end use:

W__points := plottools:-getdata(P)[1, -1];
t_grid := convert(W__points[..,1], list):
x_grid := [seq(-2..2, 4/N)]:

`#msub(mi("W"),mi("points"))` := Vector(4, {(1) = ` 401 x 2 `*Matrix, (2) = `Data Type: `*float[8], (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order})

(2)

T3_param := eval(T3, params):

STX := Matrix(
         (N+1)$2
         , (it, ix) ->
           evalf(
             eval(
               eval( T3_param, W(t)=W__points[it, 2])
               , {t=t_grid[it], x=x_grid[ix]}
             )
           )
         );

STX := Vector(4, {(1) = ` 401 x 401 `*Matrix, (2) = `Data Type: `*anything, (3) = `Storage: `*rectangular, (4) = `Order: `*Fortran_order})

(3)

plots:-matrixplot(Re~(STX), style=polygon):

P := plots:-matrixplot(Re~(STX), style=polygon, shading=zhue, lightmodel="light1"):
plots:-display(
  P
  , axis[1]=[tickmarks=[seq(i = t_grid[i+1], i=0..N, N/10)]]
  , axis[2]=[tickmarks=[seq(i = nprintf("%1.1f", x_grid[i+1]), i=0..N, N/10)]]
  , labels=[t, x, ""]
  , orientation=[-90, 0, 0]
)

 

 


 

Download S5_mmcdara-2.mw

@Ronan 

Unfortunately I didn't find a simple and direct way, in case IsOnOnject answers true, to get the corresponding value of alpha while using only geom3d functions.
It would have been cool.

@salim-barzani 

By the way: you often refer to a HBFGen Maple's package, why don't you simply use it?

but I can't help you on this specific point.

I guess that one must compile separately procedures X, Y and Z and declare them as external when compiling the second system.
But it is just a guess as I'm not familiar with this.

@janhardo 

Sure, I tried this, but I was using Safari and, for some reason, zooming made the text more fuzzy.
Meanwhile I changed to Firefox and there is no more problem.
Sorry for the inconvenience

@salim-barzani 

I'm sorry but the font is too small and the text too fuzzy for me to see clearly what it's written.
Is the Sawaqa-Kotera equation this one:

SK := diff(u, t) + 45*u^2*diff(u, x) - 15*diff(u, x)*diff(u, x$2) - 15*u*diff(u, x$3) + diff(u, x$5) = 0

Could you sent me something more readable?

Meanwhile here is the KdV equation with arbitrary alpha: 

restart

 

PART ONE

 

alias(F=F(x, t), G=G(x, t))

F, G

(1)

with(PDEtools):
undeclare(prime):

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

(2)

ND := proc(F, G, U)
  local v, w, f, g, a:
  v := op(F):
  if v[1] in U then w := -v[1] else w := v[1] end if:
  if v[2] in U then w := w, -v[2] else w := w, v[2] end if:
  f := op(0, F):
  g := op(0, G):
  a := diff(f(w)*g(v), U);
  convert(subs([w]=~[v], a), diff)
end proc:

 

KdV with w = α ln (F)

PART TWO

A name like KdV__n refers to the equation (n) in the paper you present

 

alias(u=u(x, t), w=w(x, t))

F, G, u, w

(3)

KdV__1 := diff(u, x$3)+6*u*diff(u, x)+diff(u, t) = 0

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

(4)

KdV__3 := eval(KdV__1, u=diff(w, x$2))

diff(diff(diff(diff(diff(w, x), x), x), x), x)+6*(diff(diff(w, x), x))*(diff(diff(diff(w, x), x), x))+diff(diff(diff(w, t), x), x) = 0

(5)

KdV__4 := int~(lhs(KdV__3), x) = 0

diff(diff(diff(diff(w, x), x), x), x)+3*(diff(diff(w, x), x))^2+diff(diff(w, t), x) = 0

(6)

prepa  := eval(KdV__4, w=alpha*ln(F)):
KdV__7 := op(-1, numer(lhs(prepa))) = 0;

3*alpha*(diff(diff(F, x), x))^2*F^2-6*alpha*(diff(diff(F, x), x))*(diff(F, x))^2*F+3*alpha*(diff(F, x))^4+(diff(diff(diff(diff(F, x), x), x), x))*F^3+(diff(diff(F, t), x))*F^3-4*(diff(diff(diff(F, x), x), x))*(diff(F, x))*F^2-(diff(F, t))*(diff(F, x))*F^2-3*(diff(diff(F, x), x))^2*F^2+12*(diff(diff(F, x), x))*(diff(F, x))^2*F-6*(diff(F, x))^4 = 0

(7)

 

PART THREE: express KdV__7 using ND "operators"

 

# As the highest derivation degree wrt x is 4, the D-operator will contain
# ND(F, F, [x$4]):

`#msubsup(mo("D"),mo("x"),mo("4"))` = ND(F, F, [x$4]);

`#msubsup(mo("D"),mo("x"),mo("4"))` = 2*F*(diff(diff(diff(diff(F, x), x), x), x))-8*(diff(diff(diff(F, x), x), x))*(diff(F, x))+6*(diff(diff(F, x), x))^2

(8)

ToRewrite := diff(F, x$4);
RewriteAs := isolate((8), ToRewrite);
Rewritten := simplify(subs(RewriteAs, lhs(KdV__7)));

diff(diff(diff(diff(F, x), x), x), x)

 

diff(diff(diff(diff(F, x), x), x), x) = -(1/2)*(-8*(diff(diff(diff(F, x), x), x))*(diff(F, x))+6*(diff(diff(F, x), x))^2-`#msubsup(mo("D"),mo("x"),mo("4"))`)/F

 

3*alpha*(diff(diff(F, x), x))^2*F^2-6*alpha*(diff(diff(F, x), x))*(diff(F, x))^2*F+3*alpha*(diff(F, x))^4+(diff(diff(F, t), x))*F^3-(diff(F, t))*(diff(F, x))*F^2-6*(diff(diff(F, x), x))^2*F^2+12*(diff(diff(F, x), x))*(diff(F, x))^2*F-6*(diff(F, x))^4+(1/2)*F^2*`#msubsup(mo("D"),mo("x"),mo("4"))`

(9)

# Rewrite the terms containing the second derivative of F wrt x

`#msubsup(mo("D"),mo("x"),mo("2"))` = ND(F, F, [x$2]);

`#msubsup(mo("D"),mo("x"),mo("2"))` = 2*F*(diff(diff(F, x), x))-2*(diff(F, x))^2

(10)

ToRewrite := diff(F, [x$2]);
RewriteAs := isolate((10), ToRewrite);
Rewritten := simplify(subs(RewriteAs, Rewritten));

diff(diff(F, x), x)

 

diff(diff(F, x), x) = -(1/2)*(-2*(diff(F, x))^2-`#msubsup(mo("D"),mo("x"),mo("2"))`)/F

 

(diff(diff(F, t), x))*F^3-(diff(F, t))*(diff(F, x))*F^2+(1/2)*F^2*`#msubsup(mo("D"),mo("x"),mo("4"))`+(3/4)*alpha*`#msubsup(mo("D"),mo("x"),mo("2"))`^2-(3/2)*`#msubsup(mo("D"),mo("x"),mo("2"))`^2

(11)

# Rewrite the terms containing the second derivative of F wrt x and t

`#msubsup(mo("D"),mrow(mo("x"),mo("t")))` = ND(F, F, [x, t]);

`#msubsup(mo("D"),mrow(mo("x"),mo("t")))` = 2*F*(diff(diff(F, t), x))-2*(diff(F, x))*(diff(F, t))

(12)

ToRewrite := diff(F, [x, t]);
RewriteAs := isolate((12), ToRewrite);
Rewritten := collect(simplify(expand(subs(RewriteAs, Rewritten))), [F, `#msubsup(mo("D"),mo("x"),mo("2"))`])

diff(diff(F, t), x)

 

diff(diff(F, t), x) = -(1/2)*(-2*(diff(F, x))*(diff(F, t))-`#msubsup(mo("D"),mrow(mo("x"),mo("t")))`)/F

 

((1/2)*`#msubsup(mo("D"),mrow(mo("x"),mo("t")))`+(1/2)*`#msubsup(mo("D"),mo("x"),mo("4"))`)*F^2+((3/4)*alpha-3/2)*`#msubsup(mo("D"),mo("x"),mo("2"))`^2

(13)

# The alpha=2 case



simplify(eval(Rewritten, alpha=2));

# Operator form of KdV__7

Result(alpha=2) = ``(op(2,%))(F.F)

(1/2)*(`#msubsup(mo("D"),mrow(mo("x"),mo("t")))`+`#msubsup(mo("D"),mo("x"),mo("4"))`)*F^2

 

Result(alpha = 2) = (``(`#msubsup(mo("D"),mrow(mo("x"),mo("t")))`+`#msubsup(mo("D"),mo("x"),mo("4"))`))(F.F)

(14)

# Check:

F^2 * ND(F, F, [x$4]) / 2 +
F^2 * ND(F, F, [x, t]) / 2 +
(3/4 * alpha - 3/2) * ND(F, F, [x$2])^2;
simplify(% - lhs(KdV__7))

(1/2)*F^2*(2*F*(diff(diff(diff(diff(F, x), x), x), x))-8*(diff(diff(diff(F, x), x), x))*(diff(F, x))+6*(diff(diff(F, x), x))^2)+(1/2)*F^2*(2*F*(diff(diff(F, t), x))-2*(diff(F, x))*(diff(F, t)))+((3/4)*alpha-3/2)*(2*F*(diff(diff(F, x), x))-2*(diff(F, x))^2)^2

 

0

(15)

# Operator form of KdV__7

KdV__9 := ``(Rewritten)(F.F)=0

(``(((1/2)*`#msubsup(mo("D"),mrow(mo("x"),mo("t")))`+(1/2)*`#msubsup(mo("D"),mo("x"),mo("4"))`)*F^2+((3/4)*alpha-3/2)*`#msubsup(mo("D"),mo("x"),mo("2"))`^2))(F.F) = 0

(16)

 

"To get a relation closer to equation (9) in your paper we need to prove this;    D[xt] = D[x] @ D[t] = D[t] @ D[x]"

 

`#msub(mo("D"),mrow(mo("x"),mo("t")))` = ND(F, G, [x, t]);


# some algebraic transformations
     relation_x := `#msub(mo("D"),mo("x"))` = ND(F, G, [x]):
     alias(f=f(x, t), g=g(x, t)):
     equivalences := {diff(F, x)=f, diff(G, x)=g}:

     eval(relation_x, equivalences):
     map(z -> sign(z)*ND(op(sign(z)*z), [t]), [op(rhs(%))]):
     add(%):

`#msub(mo("D"),mo("x"))`@`#msub(mo("D"),mo("t"))` = eval(%, (rhs=lhs)~(equivalences));


# some algebraic transformations
     relation_t := `#msub(mo("D"),mo("t"))` = ND(F, G, [t]):
     equivalences := {diff(F, t)=f, diff(G, t)=g}:

     eval(relation_t, equivalences):
     map(z -> sign(z)*ND(op(sign(z)*z), [x]), [op(rhs(%))]):
     add(%):

`#msub(mo("D"),mo("t"))`@`#msub(mo("D"),mo("x"))` = eval(%, (rhs=lhs)~(equivalences))

`#msub(mo("D"),mrow(mo("x"),mo("t")))` = (diff(diff(F, t), x))*G-(diff(F, x))*(diff(G, t))-(diff(F, t))*(diff(G, x))+F*(diff(diff(G, t), x))

 

`@`(`#msub(mo("D"),mo("x"))`, `#msub(mo("D"),mo("t"))`) = (diff(diff(F, t), x))*G-(diff(F, x))*(diff(G, t))-(diff(F, t))*(diff(G, x))+F*(diff(diff(G, t), x))

 

`@`(`#msub(mo("D"),mo("t"))`, `#msub(mo("D"),mo("x"))`) = (diff(diff(F, t), x))*G-(diff(F, x))*(diff(G, t))-(diff(F, t))*(diff(G, x))+F*(diff(diff(G, t), x))

(17)
 

 

Download Hirota_derivative_KdV_equation_2.mw


 

restart

 

PART ONE

 

alias(F=F(x, t), G=G(x, t))

F, G

(1)

with(PDEtools):
undeclare(prime):

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

(2)

ND := proc(F, G, U)
  local v, w, f, g, a:
  v := op(F):
  if v[1] in U then w := -v[1] else w := v[1] end if:
  if v[2] in U then w := w, -v[2] else w := w, v[2] end if:
  f := op(0, F):
  g := op(0, G):
  a := diff(f(w)*g(v), U);
  convert(subs([w]=~[v], a), diff)
end proc:

ND(F, G, [x]);
ND(F, G, [t]);

-(diff(F, x))*G+F*(diff(G, x))

 

-(diff(F, t))*G+F*(diff(G, t))

(3)

ND(F, F, [x]);
ND(F, F, [x, x]);

0

 

2*F*(diff(diff(F, x), x))-2*(diff(F, x))^2

(4)

ND(F, G, [x$3]);

-(diff(diff(diff(F, x), x), x))*G+3*(diff(diff(F, x), x))*(diff(G, x))-3*(diff(F, x))*(diff(diff(G, x), x))+F*(diff(diff(diff(G, x), x), x))

(5)

ND(F, G, [x, t]);
`#msub(mo("D"),mrow(mo("x"),mo("t")))` = eval(%, G=F);

(diff(diff(F, t), x))*G-(diff(F, x))*(diff(G, t))-(diff(F, t))*(diff(G, x))+F*(diff(diff(G, t), x))

 

`#msub(mo("D"),mrow(mo("x"),mo("t")))` = 2*(diff(diff(F, t), x))*F-2*(diff(F, x))*(diff(F, t))

(6)

 

PART TWO

A name like KdV__n refers to the equation (n) in the paper you present

 

alias(u=u(x, t), w=w(x, t))

F, G, u, w

(7)

KdV__1 := diff(u, x$3)+6*u*diff(u, x)+diff(u, t) = 0

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

(8)

KdV__3 := eval(KdV__1, u=diff(w, x$2))

diff(diff(diff(diff(diff(w, x), x), x), x), x)+6*(diff(diff(w, x), x))*(diff(diff(diff(w, x), x), x))+diff(diff(diff(w, t), x), x) = 0

(9)

KdV__4 := int~(lhs(KdV__3), x) = 0

diff(diff(diff(diff(w, x), x), x), x)+3*(diff(diff(w, x), x))^2+diff(diff(w, t), x) = 0

(10)

prepa  := eval(KdV__4, w=2*ln(F)):
KdV__7 := op(-1, numer(lhs(prepa))) = 0;

(diff(diff(diff(diff(F, x), x), x), x))*F+(diff(diff(F, t), x))*F-4*(diff(diff(diff(F, x), x), x))*(diff(F, x))-(diff(F, x))*(diff(F, t))+3*(diff(diff(F, x), x))^2 = 0

(11)

 

PART THREE: express KdV__7 using ND "operators"

 

# As the highest derivation degree wrt x is 4, the D-operator will contain
# ND(F, F, [x$4]):

`#msubsup(mo("D"),mo("x"),mo("4"))` = ND(F, F, [x$4]);

`#msubsup(mo("D"),mo("x"),mo("4"))` = 2*(diff(diff(diff(diff(F, x), x), x), x))*F-8*(diff(diff(diff(F, x), x), x))*(diff(F, x))+6*(diff(diff(F, x), x))^2

(12)

ToRewrite := diff(F, x$4)*F;
RewriteAs := isolate((12), ToRewrite);
Rewritten := subs(RewriteAs, lhs(KdV__7));

(diff(diff(diff(diff(F, x), x), x), x))*F

 

(diff(diff(diff(diff(F, x), x), x), x))*F = 4*(diff(diff(diff(F, x), x), x))*(diff(F, x))-3*(diff(diff(F, x), x))^2+(1/2)*`#msubsup(mo("D"),mo("x"),mo("4"))`

 

(1/2)*`#msubsup(mo("D"),mo("x"),mo("4"))`+(diff(diff(F, t), x))*F-(diff(F, x))*(diff(F, t))

(13)

# As the highest total derivation degree is 2 and then ND(F, F, [x, t]) has to be involved

`#msub(mo("D"),mrow(mo("x"),mo("t")))` = ND(F, F, [x, t]);

`#msub(mo("D"),mrow(mo("x"),mo("t")))` = 2*(diff(diff(F, t), x))*F-2*(diff(F, x))*(diff(F, t))

(14)

ToRewrite := F*(diff(F, [x,t]));
RewriteAs := isolate((14), ToRewrite);
Rewritten := subs(RewriteAs, Rewritten);

(diff(diff(F, t), x))*F

 

(diff(diff(F, t), x))*F = (diff(F, x))*(diff(F, t))+(1/2)*`#msub(mo("D"),mrow(mo("x"),mo("t")))`

 

(1/2)*`#msubsup(mo("D"),mo("x"),mo("4"))`+(1/2)*`#msub(mo("D"),mrow(mo("x"),mo("t")))`

(15)

# Check:



ND(F, F, [x$4])/2 + ND(F, F, [x, t])/2;
simplify(% - lhs(KdV__7))

(diff(diff(diff(diff(F, x), x), x), x))*F+(diff(diff(F, t), x))*F-4*(diff(diff(diff(F, x), x), x))*(diff(F, x))-(diff(F, x))*(diff(F, t))+3*(diff(diff(F, x), x))^2

 

0

(16)

# Operator form of KdV__7

KdV__9 := ``(2*Rewritten)(F.F)=0

(``(`#msubsup(mo("D"),mo("x"),mo("4"))`+`#msub(mo("D"),mrow(mo("x"),mo("t")))`))(F.F) = 0

(17)

 

"To get a relation closer to equation (9) in your paper we need to prove this;    D[xt] = D[x] @ D[t] = D[t] @ D[x]"

 

`#msub(mo("D"),mrow(mo("x"),mo("t")))` = ND(F, G, [x, t]);


# some algebraic transformations
     relation_x := `#msub(mo("D"),mo("x"))` = ND(F, G, [x]):
     alias(f=f(x, t), g=g(x, t)):
     equivalences := {diff(F, x)=f, diff(G, x)=g}:

     eval(relation_x, equivalences):
     map(z -> sign(z)*ND(op(sign(z)*z), [t]), [op(rhs(%))]):
     add(%):

`#msub(mo("D"),mo("x"))`@`#msub(mo("D"),mo("t"))` = eval(%, (rhs=lhs)~(equivalences));


# some algebraic transformations
     relation_t := `#msub(mo("D"),mo("t"))` = ND(F, G, [t]):
     equivalences := {diff(F, t)=f, diff(G, t)=g}:

     eval(relation_t, equivalences):
     map(z -> sign(z)*ND(op(sign(z)*z), [x]), [op(rhs(%))]):
     add(%):

`#msub(mo("D"),mo("t"))`@`#msub(mo("D"),mo("x"))` = eval(%, (rhs=lhs)~(equivalences))

`#msub(mo("D"),mrow(mo("x"),mo("t")))` = (diff(diff(F, t), x))*G-(diff(F, x))*(diff(G, t))-(diff(F, t))*(diff(G, x))+F*(diff(diff(G, t), x))

 

`@`(`#msub(mo("D"),mo("x"))`, `#msub(mo("D"),mo("t"))`) = (diff(diff(F, t), x))*G-(diff(F, x))*(diff(G, t))-(diff(F, t))*(diff(G, x))+F*(diff(diff(G, t), x))

 

`@`(`#msub(mo("D"),mo("t"))`, `#msub(mo("D"),mo("x"))`) = (diff(diff(F, t), x))*G-(diff(F, x))*(diff(G, t))-(diff(F, t))*(diff(G, x))+F*(diff(diff(G, t), x))

(18)

 


 

Download Hirota_derivative_KdV_equation.mw

First 6 7 8 9 10 11 12 Last Page 8 of 151