sand15

842 Reputation

13 Badges

10 years, 249 days

MaplePrimes Activity


These are replies submitted by sand15

@RezaZanjirani 

Suppose you have to functions f[1](x) and f[2](x).
Heaviside(f(x)) (let's put aside the "x=0 case") has two values: 0 if f[1](x) < 0 ans 1 if f[1](x) > 0.
Then h(x)=Heaviside(f[1](x))+2*Heavside(f[2](x)) takes 4 values:

  • 0 if f[1](x) < 0 and f[2](x) < 0
  • 1 if f[1](x) > 0 and f[2](x) < 0
  • 2 if f[1](x) < 0 and f[2](x) > 0
  • 3 if f[1](x) > 0 and f[2](x) > 0

Then contourplotting h(x)  with contours=[0, 1, 2, 3] (provided you use a grid dense enough) will display the 4 domains corresponding to each of theconditions above.

I replaced the Heaviside function by a smooth tanh approximation) to ease the computations of the contour levels.
(the smoothing depends on a parameter [set to 1e6] in the tanh.

The generalization of the "Heaviside trick" is

h(x) = add(2^(n-1)*f[n](x), n=1..N)

@Rouben Rostamian  

The values

[E__1 = 0.991324553918355, E__2 = 0.972412189223068, h__1 = 0.999999468863441, nu = 0.473159649082875]

verify eqE.
To get them do

J := (lhs - rhs)(eqE)^2:
opt := Optimization:-Minimize(J, {0 <= nu, nu <= 0.5}, assume = nonnegative)

But I agree that there is probably no solutions:

J := add(`~`[lhs - rhs]([eqA, eqC, eqD, eqE]) ^~ 2);
opt := Optimization:-Minimize(J, {0 <= nu, nu <= 0.5}, assume = nonnegative, iterationlimit = 10000);
       [                      [                          7  
opt := [0.206149604449184010, [E__1 = 3.48734878853157 10 , 

                                                     5         ]]
  E__2 = 13328.4876967435, h__1 = 6.85943362585648 10 , nu = 0.]]


eval([eqA, eqC, eqD, eqE], opt[2]);
              [0.4017000000 = 4.03508624851090, 

                0.1745000000 = -1.93898396374958, 

                0.1517000000 = -1.41034232626533, 

                0.1332000000 = -1.93899197963935]


A simple observation: nu is likely the Poisson coefficient and E1 and E2 are likely Young modulii.`

Thus h__eq (I guess a length?) has the same dimension than h__1.
The relations which define R__C, R__D and R__E do not seem consistent from a dimensional point of view: shouldn't contain h__1^2 instead of h__1

Maybe it could help if you give us the units you use?

More of this the ranges in the fsolve command seem (at least to me) quite weird (if I agree for the nu range, ranges for E are strange).

@sursumCorda 

Thank's a lot.

Edited

Didn't you miss a derivative?
Logistic (ordinary) differential equation writes

diff(u(t), t) = u(t)*(1-u(t))

and Logistic Fractional Equation writes

diff(u(t), t^alpha) = u(t)*(1-u(t))

where  0 < alpha < 1.

I didn't see any derivative in what you wrote

Here is a reference:

https://www.sciencedirect.com/science/article/pii/S0893965921003037



Why don't you ask your question on a Matlab Q&A forum?

@Pepini 

http://math.univ-lyon1.fr/index/homes-www/recrutements/ecoinfo/~borrelli/Articles/PNAS_version_soumise.pdf

The complete construction of the embedding of a flat torus in the 3D Euclidean space is presented here
https://www.emis.de/journals/em/docs/ensaio_matematico/em_24_borrelli-et-al.pdf

Source code avaliable here (hevea.tgz.)
https://hevea-project.fr/ENPageToreCodeSource.html

Good luck if you are courageous enough to translate it in Maple

"I didnt know about Borrelli..."
The Nash-Kuiper embedding theorem(s) has been published in the mid fifties.
This theromem implies the existence of
an embedding of a flat torus in the 3D Euclidean space.
Nevertheless, it was not until almost 60 years later that Borrelli, Jabrane, Lazarus and Thibert built a 3D representation of this object.

@Pepini

Look my reply to @Carl Love

@Carl Love

The figure at the end of the question cannot be obtained by rotating the red curve around some axis..

I don't know what is the name of this toroidal figure in English, discovered by the French mathematician Vincent Borrelli (Lyon University, 2012), but it is French dubbed the "Tore plat" (Flat Torus). This "Flat Torus" is an example of smooth fractals.
You can look here
https://www-sop.inria.fr/geometrica/events/wocg14-symmetry_and_periodicity/slides/thibert.pdf

https://www.google.com/search?q=square+flat+torus&tbm=isch&ved=2ahUKEwjQnYnH2q6AAxW9mCcCHcJFBAAQ2-cCegQIABAA&oq=square+flat+torus&gs_lcp=CgNpbWcQAzoFCAAQgAQ6CAgAELEDEIMBOgQIABADOggIABCABBCxAzoHCAAQigUQQzoLCAAQgAQQsQMQgwE6BAgAEB46BwgAEBMQgAQ6CAgAEAUQHhATOggIABAIEB4QE1CRFFiOPWDOQ2gAcAB4AIABcYgB8AiSAQQxNi4ymAEAoAEBqgELZ3dzLXdpei1pbWfAAQE&sclient=img&ei=vErCZNDPHL2xnsEPwosR&bih=808&biw=1729&client=firefox-b-d


This "Flat Torus" is related to the Nash–Kuiper theorem:
https://en.wikipedia.org/wiki/Nash_embedding_theorems

@Rana47 

  1. The ode has 3 parameters b, n and k.
     
  2. Its HPM counterparty depends on one more parameter wich is the order of the expansion (what I named the ansatz).

restart:

# In the sequel [REF] refers to the paper in your question

with(ColorTools):

#PDEtools[declare](f(x), prime = x);
#PDEtools[declare](v(x), prime = x);

ansatz := N -> g(x) = add((q^(i))*w[i](x), i = 0 .. N);

proc (N) options operator, arrow; g(x) = add(q^i*w[i](x), i = 0 .. N) end proc

(1)

HPMEq0 := n -> (1-q)*diff(g(x), x$2)+q*(diff(g(x), x$2)+n*b*(diff(g(x), x))^(n-1)*(diff(g(x), x$2))-k)

proc (n) options operator, arrow; (1-q)*(diff(g(x), `$`(x, 2)))+q*(diff(g(x), `$`(x, 2))+n*b*(diff(g(x), x))^(n-1)*(diff(g(x), `$`(x, 2)))-k) end proc

(2)

ansatz_order    := 3;
exponent_degree := 5;

# The initial guess corresponding to relation [REF] eq (29).

v[0]  := k/2*(x^2-2*x)+1;
Lv[0] := diff(v[0], x$2);

3

 

5

 

(1/2)*k*(x^2-2*x)+1

 

k

(3)

# Plug the ansatz into HPMEq0:

HPMEq1 := collect(eval(HPMEq0(exponent_degree), ansatz(ansatz_order)), q):

# Derive the successive edos according to [REF] eq (23), (25), (27) and
# generalize.

equ[0] := coeff(HPMEq1, q, 0) - diff(v[0], x$2) = 0;  # [REF] eq 23
for i from 1 to ansatz_order do
  equ[i] := coeff(HPMEq1, q, i) + diff(v[0], x$(i+1)) = 0
end do;

diff(diff(w[0](x), x), x)-k = 0

 

5*b*(diff(w[0](x), x))^4*(diff(diff(w[0](x), x), x))+diff(diff(w[1](x), x), x) = 0

 

20*b*(diff(w[0](x), x))^3*(diff(w[1](x), x))*(diff(diff(w[0](x), x), x))+5*b*(diff(w[0](x), x))^4*(diff(diff(w[1](x), x), x))+diff(diff(w[2](x), x), x) = 0

 

diff(diff(w[3](x), x), x)+5*b*(diff(w[0](x), x))^4*(diff(diff(w[2](x), x), x))+20*b*(diff(w[0](x), x))^3*(diff(w[1](x), x))*(diff(diff(w[1](x), x), x))+5*b*(2*(diff(w[0](x), x))^2*(2*(diff(w[0](x), x))*(diff(w[2](x), x))+(diff(w[1](x), x))^2)+4*(diff(w[0](x), x))^2*(diff(w[1](x), x))^2)*(diff(diff(w[0](x), x), x)) = 0

(4)

# Remark: equ[1] writes

coeff(HPMEq1, q, 1) + 'diff(v[0], x$(1+1))';

# and thus

value(%);

5*b*(diff(w[0](x), x))^4*(diff(diff(w[0](x), x), x))+diff(diff(w[1](x), x), x)-k+diff(v[0], `$`(x, 2))

 

5*b*(diff(w[0](x), x))^4*(diff(diff(w[0](x), x), x))+diff(diff(w[1](x), x), x)

(5)

# BCs given by eq (21) in the paper you present.

cond[0] := w[0](0) = 1, (D(w[0]))(1) = 0;

# BCs on the successive corrections

for j from 1 to ansatz_order do
  cond[j] := w[j](0) = 0, (D(w[j]))(1) = 0
end do;

w[0](0) = 1, (D(w[0]))(1) = 0

 

w[1](0) = 0, (D(w[1]))(1) = 0

 

w[2](0) = 0, (D(w[2]))(1) = 0

 

w[3](0) = 0, (D(w[3]))(1) = 0

(6)

answers := {dsolve({cond[0], equ[0]})};

for j from 1 to ansatz_order do
  ans := dsolve(eval({cond[j], equ[j]}, answers)):
  answers := answers union {ans}
end do:

{w[0](x) = (1/2)*k*x^2-k*x+1}

(7)

b_values := [seq(0.1..0.9, 0.2)]:
b_n      := numelems(b_values):
b_colors := EvenSpread(Color("RGB", "Red"), b_n):

S2 := eval(eval(rhs(ansatz(2)), answers), [q=1, k=1]);

plots:-display(
  seq(
    plot(
      eval(S2, b=b_values[b_i])
      , x=0..1
      , color=Color(b_colors[b_i])
      , legend=typeset('b'=b_values[b_i])
    )
    , b_i = 1..b_n
  )
  , title=typeset(["HPM solution", `<|>`(n=5, k=1, 'ansatz_order'=ansatz_order)])
  , view=[default, 0..1]
  , gridlines=true
);

(1/2)*x^2-x+1-(1/6)*b*(x-1)^6+(1/6)*b+(1/2)*b^2*(x-1)^10-(1/2)*b^2

 

 

# Numericl solution

SweepNumSol := proc(b_values, K, N)
  local b_n, b_colors, b_i, sys, sol, graphs:

  uses ColorTools, plots:

  b_n      := numelems(b_values):
  b_colors := EvenSpread(Color("RGB", "Red"), b_n):

  graphs := NULL:
  for b_i from 1 to b_n do
    sys    := eval({HPMEq0(N), g(0)=1, D(g)(1)=0}, [b=b_values[b_i], k=K, q=1]):
    sol    := dsolve(sys, numeric);
    graphs := graphs,
              odeplot(
                sol
                , [x, g(x)]
                , x=0..1
                , color=Color(b_colors[b_i])
                , legend=typeset('b'=b_values[b_i])
              )
  end do:
  display(
    graphs
    , title=typeset(["Numerical solution",`<|>`(n=5, k=1, 'ansatz_order'=ansatz_order)])
    , view=[default, 0..1]
    , gridlines=true
  )
end proc:

SweepNumSol(b_values, 1, 5)

 

 

Download parameterized_solution.mw

@Rana47 

You write "I have compared the ist and second orders problem but its look not same as reported in paper"
From the paper (equation 33)

  • green = zeroth order
  • red first order
  • blue second order

What I get

  • zeroth orders are the same
  • first orders are the same given n=5
  • second orders differ by a factor n in the paper.
    I noticed this in my mw file sayink that it could be either an error on my side or a typo in the paper.
    Here is the ode for the second order problem from paper ,eq 30.
    Here is this same ode same second in my file is  (remember n=5 and w <--> f, L(w2)=diff(w2, x$2))
    it is clear these two odes are identical.
    Given the doundary conditions I use are those of the paper (you can check that easily), and unless Maple is not capable to compute correctly the solution of this problem, I lean towards an error in the paper: the coefficient "n" in the second order term in equation 33 is a typo.

    In fact I am even sure there is an error in eq (33)  because after some substitutions the second order term is written this way (eq (34))

    As you can see the lultiplicative constant n in the second order term has disappeared.

This should close your first remark.

I dont understand what you say after "Sir, if we suppose ..."
Do you mean that "my" first order problem is not the one given by equations (25)-(26) ???
D
oes the absence of term k seem like a mistake on my side?
This is normal, this term is balanced by diff(v[0](x), x$2) which is equal to k.

Here is the same file as previously but with notations w instead of f and q instead of p to get closer to to make comparisons easier.
Comparison_made_easier.mw
Read it carefully before saying I did something wrong (which is of course perfectly possible)

@Rana47 

I've just seen that  @SHIVAS question has been removed and the the link
https://www.mapleprimes.com/questions/236755-How-To-Run-Or-Implement-HPM-Method-In-Maple

I sent you is obsolete.
Here is the file I attached to my answer to @SHIVAS

Download hpm_error_sand15.mw

@Rana47 

If you "do not know the other guys", why does your code contain the same names of variables, the same useless declare statement, the same way to write the ansatz, the same errors ?

"Please help to produce results mentioned in the pictures":

I do not inderstand what you are saying.
I answered
@SHIVAS a few hours ago and uploaded a code.
Go and see the answer here

https://www.mapleprimes.com/questions/236755-How-To-Run-Or-Implement-HPM-Method-In-Maple

Another advice: search for the name homotopy on this cite, you will find several answers.
To cite few
https://www.mapleprimes.com/questions/223044-Homotopy-Perturbation-Method
https://www.mapleprimes.com/questions/227515-Homotopy-Perturbation-Method
https://www.mapleprimes.com/questions/232586-How-To-Solve-System-Of-Nonlinear-ODE

@Rana47 

Did the three of you guys @Rana47 , @SHIVAS and @Madhukesh J K work together to ask the same question, or are you all the same person?

In any case I think that a correct attitude would be to reply the answers instead of opening a new thread on the same subject , with exactly the same bugged code.

Look here
https://www.mapleprimes.com/questions/236758-HPM-Error-Invalid-Input
and here
https://www.mapleprimes.com/questions/236747-Error-In-The-Program-HPM


As your code is strangely close to a recent code from another OP (are you and  @Madhukesh J Kthe same person?), I advice you to look here
https://www.mapleprimes.com/questions/236747-Error-In-The-Program-HPM
to see how HPM can be done.

First 7 8 9 10 11 12 13 Last Page 9 of 27