mmcdara

6568 Reputation

18 Badges

8 years, 103 days

MaplePrimes Activity


These are answers submitted by mmcdara

Here is a possible (NOT THE) definition of the mean radius.

I replace "arithmetic mean" by mean in the sense (one sense) mentioned by Rouben:

  • I consider the canonical ellipse with principal axis Ox and Oy (natural cartesian coordinates)
  • let M1, M2<> M1 two points  on the ellipse
  • Let M a third point on the ellipse.
     Assuming M moves from M1 to M2 counterclockwise in such a way that the angular sector swept by M is less than 2*Pi,
    one can define the mean radius by the mean value of OM when M moves from M1 to M2.

Ellipse.mw

 

 

Maybe the shortest solution?
(just for fun, no practical interest when compared to the previous answers)

restart:

splitChange := proc(w)
  local bw:
  bw := map(u -> if w[u+1]<>w[u] then cat(w[u], " ") else w[u] end if, [$1..length(w)-1]);
  StringTools:-Words(cat(op(bw), w[-1]));
end proc:
  
splitChange("WPKCPYWYYYXHYY")


Download Shorter.mw

I guess you took as a reference the article by Faith Chelimo Kosgei?
(https://www.journalijdr.com/sites/default/files/issue-pdf/11819.pdf  practically the one I was able to find on the subject)

If it so I understand you asked for some help (I 've rarely read such a muddled, obscure and confusing paper!)

Nevertheless, after a lot of work spent to read between the lines of the article, you will find in the attached file the algorithm applied to the 3 toy examples this paper contains.

NewtonLagrange.mw

I leave you the pleasure to apply the method to your own test cases

I don't know what Maple version you use (in a previous thread you said tou used Maple 13?) but in Maple 2015 (and beyond.. but I can verify this right now) your code is not correct.
The line

should be replaced by 
V:= r -> piecewise(0<=r and r<=R, -VV, r>R, 0):

Here is your original code

A few points beyond the above correction

  1. Some lines are unnecessary:

     
  2. As Carl Love wrote, you need another IC/BC condition, dot instance D(u)(0) = something
    With, for instance, SYS2:={diff(u(r), r, r)+k^2*u(r) = V(r)*u(r), u(0) = 0, D(u)(0)=1} you should obtain this curve
    odeplot(sol, [r, u(r)], r = 0 .. 2);

The GB is reduced w.r.t the plex order (proof here)

GB.mw

 

It seems indeed that the help pages do not mention if th GB is reduced or not.
 

 

 

Use "randomize" to generate a random sed on each node

restart:
with(Grid):
with(Statistics):

Samplor := proc(N) 
  local Seed:
  Seed:=randomize();
  Sample(Uniform(0, 1), N); 
end proc:


Set(Samplor);
Map(Samplor, [2, 2, 2, 2]);


 

 


restart:
# example
N:=10:
Y := Array(1..N, i -> i^2);
             [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
#
DY := map(u -> Y[u+1]-Y[u-1], [$2..N-1])
                [8, 12, 16, 20, 24, 28, 32, 36]

 

Hi, 

You will find some hints in the attached file.

There are basically 2 problems wiith your code:

  1. value is a reserved word in Maple
  2. You don't read teploty.txt, so the test fails because the "value" is not valuated.
    ReadWrite.mw

A temporary solution until someone here will provide a clever one

restart:
M := `<|>`(`<,>`(1, 3, 2), `<,>`(4, 1, 3)):

# Structure of M

S := op(2, M);

 {(1, 1) = 1, (1, 2) = 4, (2, 1) = 3, (2, 2) = 1, (3, 1) = 2,  (3, 2) = 3}
 

# Reverse S

T := map(u -> rhs(u)=[lhs(u)], S);

 {1 = [1, 1], 1 = [2, 2], 2 = [3, 1], 3 = [2, 1], 3 = [3, 2],  4 = [1, 2]}

# A simple procedure to find a value "n"
# (should be improved to handle the case "n is not an element of M")

Find := proc(n) map(u -> if lhs(u)=n then rhs(u) end if, T); end proc:

Find(1);
Find(2);
Find(3);
                        {[1, 1], [2, 2]}
                            {[3, 1]}
                        {[2, 1], [3, 2]}

Find.mw

 

fsolve(f, omega=4)
               4.450852611 - 1.509500329*10^(-25)*I

fsolve(f, omega=5)
               4.450852611 - 5.580307451*10^(-24)*I


As you observe the solution is complex (even the smallness of the imaginary part can suggest it is a numerical effect).
But this info is usefull and give you a hint to search a solution in a given interval:

fsolve(f, omega=1, complex, {omega=1-I..5+I}  );  # search in the xomplex square [1, 5]x[-I, I]





By the way: Do not use simplify in fsolve to spare computational time.

 

 

Your integral is just the mathematical expectation of the random variable 0.3*p1+0.7*p2:

Mean(0.3*p1+0.7*p2)
   0.01669578723

No need to look further

More than this :
CodeTools:-Usage(Mean(0.3*p1+0.7*p2))
memory used=101.54KiB, alloc change=0 bytes, cpu time=2.00ms, real time=19.00ms, gc time=0ns
                         0.01669578723


... and finally:
Mean(3/10*p1+(1-3/10)*p2)

Hi, 

If you don't want to use a 'procedurelist' output and keep using an Array, you can buid a piecewise approximation of the second derivative where each "piece" is a 3rd order polynomial in x.
MaybeThis.mw

Nevertheless, as tomleslie said elsewhere in this thread (Rouben Rostamian too), you can easily isolate this second derivative from the original ode... then I'm not sure my answer is of any help ?

A simpler way:

E1 := x*y^3+5*x^2*y+3*a^2+4*x*y+z^2+3*x-y+z+2:
_order := 2:           # truncation order
vars   := [x, y, z]:   # truncation variables
mtaylor(E1, vars, _order+1);

Simpler.mw

 

Hi, 

 

Question 1:
There exits a package RootFindind with a procedure NextZero you could use In the same package. In the same package the procedure Isolate is also very useful.

Question 2: the content of the attached file could help you to get started

fsolve.mw 

Kitonum is right when he says "I think first you need to specify the values of the parameters  lambda  and  ."

You will find in the attached file a workaround:

  1. solve
  2. once the roots known, select the regions where 

A lot of work is to be done "by hand".

I would be interested to recieve the critics from Kitonum.

inequalitysolve.mw

First 50 51 52 53 54 55 56 Page 52 of 56