vv

13143 Reputation

20 Badges

9 years, 78 days

MaplePrimes Activity


These are answers submitted by vv

Not all ODEs have series solutions around 0.
To illustrate the problem, let's modify a bit your second ODE.

ode1:=x^2*diff(diff(y(x),x),x)+x*diff(y(x),x)+y(x) = 0:
dsolve(ode1);

             y(x) = _C1 sin(ln(x)) + _C2 cos(ln(x))

MultiSeries:-series(sin(ln(x)), x=0);

          -sin(ln(1/x))

 

restart;
m:=166571820085905498772938593207359906487315774156514145089564134\
67009247675308229223573508773729914408724747749233779284765414\
62530835296763930087228227919982503096221081674037688617693027\
1167988018683:
for x from isqrt(m) while not issqr(x^2-m) do od:
y:=isqrt(x^2-m):  'm' = (x-y) %* (x+y);

m = 4081321110693270343633073697474256143563558458718976746753830538032062222085722974121768604305614359 %* 4081321110693270343633073697474256143563558458719886006565783193342137709249520153612225643475208637

# This works only if the two primes are "very" close. (x is close to sqrt(m).)
x-isqrt(m);
                               25

 

You must use signum, not sign.(sign is used mainly for polynomials in Maple).

Take the two sub-sequences for which sin(n)>0  and sin(n)<0 [it cannot be 0].
The limits are 11/2 and 25/2, so, R=2/25.

Using random polynomials there are big chances to have duplicates (there are only 500 such polynomials). So:

restart;
A:={seq(-2..2)}:  A0:=A minus {0}:
n:=54:
a:=Iterator:-CartesianProduct(A0,A$3, rank=500-n+1):
seq(add(v[i]*x^(i-1)+x^4,i=1..4), v=a);

 

The radius of convergence needs limsup and root test here.

a := n -> ((2 + (-1)^n)/(5 - (-1)^n))^n:
an0:=simplify(abs(a(n))^(1/n)) assuming n::even:
R0:=limit(1/an0,n=infinity):
an1:=simplify(abs(a(n))^(1/n)) assuming n::odd:
R1:=limit(1/an1,n=infinity):
R:=min(R0,R1);

      R := 4/3

Optimization:-Minimize(x->TF(x, 0, 0.03, 55.11566060, Pi/2, Pi/4), 0 .. 0.03);

                         [4.281548719743726*10^(-7), [0.15749994509751696e-1]]
 

restart;

sum(Beta(k,1/2)/(2*k+1)^2,k=1..infinity);  # Bug!

Error, (in SumTools:-DefiniteSum:-ClosedForm) summand is singular in the interval of summation

 

S:=Sum(Beta(k,1/2)/(2*k+1)^2,k=1..infinity);

Sum(Beta(1/2, k)/(2*k+1)^2, k = 1 .. infinity)

(1)

Sa:=evalf[15](S);

.336137623291124

(2)

s:=value(convert(S, GAMMA));

(1/4)*Pi^(1/2)*MeijerG([[1], [5/2, 5/2]], [[3/2, 1, 1], []], -1)

(3)

evalf[15](s); # Maple cannot compute

 

exact:=identify(Sa,BasisPolyConst=[Catalan]);

4-4*Catalan

(4)

evalf[100](S-exact); # numerical check

0.

(5)

 

 

Adding to what user acer said:

Gcd in Algebraic has a distinct syntax; it is not inert any more.
If you want the result mod 3 then use

 Gcd(f, g, characteristic=3);

Note that without characteristic=3, the gcd is computed in the ring Z[x]; if mod 3 is included (as you did), the mod 3 is applied to this polynomial.

It depends on what the procedure actually does.E.g., p could be a local variable.

f:=proc(i)
local p;
answer = p[i]
end:
eq1 := f(1);

                      eq1 := answer = p[1]
rhs(eq1): is(%=p[1]);
                             false

If you comment out the local declaration, ==> true.
 

Any procedure P can be called "indexed" P[abc](arguments), instead of the usual P(arguments)
In the body of the procedure, the index can be retrieved and used as an extra argument, or can be simply ignored. Most library procedures ignore the index (mainly if it is not expected).
See a simple standard example with  showstat(log);

Examples:

sin[xxx](Pi/2); # ignored
                               1

max[abc](22,33,11); # not ignored, for obvious reasons
Error, invalid input: unrecognized max/min[option] abc

It would be convenient to have always warnings when calling an indexed procedure which ignores the index, but it would be inefficient; anyway, this "feature" is as old as Maple I think.

Some commands have option remember, so these are not re-executed next time.

@Johan159 You should be aware that W(x) is not a regular variable, and it is not a good idea to use it this way.

An assignment W(x) := a produces a procedure W and creates/extends its remember table. When W(x) is accessed, it is not evaluated, that's why in your case _C1 was displayed; if you want evaluation, it must be accessed via eval(W(x)). So, don't use it, unless you know these details.
 

restart;

f:= (n,x) -> piecewise(x <-1/n, -1, x<1/n,n*x, 1);
plot([f(3,x), f(7,x)], x=-2..2, color=[red,blue]);

f := proc (n, x) options operator, arrow; piecewise(x < -1/n, -1, x < 1/n, n*x, 1) end proc

 

 

simplify(int( abs(f(n,x)-f(m,x)), x=-1..1)) assuming 1<=m, m<n;
# Unfortunately, Maple cannot do it directly

int(abs(-piecewise(x*n < -1, -1, x*n < 1, x*n, 1)+piecewise(x*m < -1, -1, x*m < 1, x*m, 1)), x = -1 .. 1)

(1)

ans:=simplify(2*int(f(n,x)-f(m,x), x=0..1)) assuming m>1,n>m;
# Using that x->f(n,x) is odd and f(m,x)<=f(n,x) for x>=0

(n-m)/(n*m)

(2)

map(evalf@eval, Int(abs(f(n,x)-f(m,x)), x=-1..1) = ans, [m=3,n=7] ); # numeric check

.1904761905 = .1904761905

(3)

 

 

There are several problems with your code:

--  x is used both as a table (indexed) and as a real number. Use another name for one of them.

-- The arguments of piecewise are in a wrong order

--  You must use unapply when defining phi (otherwise the arguments of piecewise are not evaluated).

You may define (inside or outside the mpl)

Dy := t -> eval(diff(y(t_),t_), t_=t);
D2y := t -> eval(diff(y(t_),t_$2), t_=t);

and then 

ode:=D2y(x)+Dy(x)=sin(x);
ic:=y(0)=1,Dy(0)=0;
dsolve([ode,ic],y(x));

 

First 13 14 15 16 17 18 19 Last Page 15 of 116