vv

9122 Reputation

18 Badges

5 years, 233 days

MaplePrimes Activity


These are answers submitted by vv

ex1:=1/cosh(x)+   (cosh(x)^2+cosh(x)*sinh(x)+x)/cosh(x)*_C1 + x*exp(_C3+x+_C2)*C;
ex2:=_C1/cosh(x)+ (cosh(x)^2+cosh(x)*sinh(x)+x)/cosh(x);
ex3:=_C1/cosh(x)+ (cosh(x)^2+cosh(x)*sinh(x)+x)/cosh(x)*_C2;
Cc:=proc(u)
  local Cc1 := C -> c[parse(convert(C,string)[3..])];
  subsindets(u, `*`,
    proc(u)
      local k,r;
      k,r:=selectremove(type, [op(u)], suffixed(_C,integer));
      if nops(k)<>1 then return u fi;
      `*`(Cc1(k[]),r[])
    end):
  subsindets(%, suffixed(_C,integer), Cc1)
end:
Cc(ex1); Cc(ex2); Cc(ex3); 

Most probably the constant has not a symbolic representation, but is this important? The series has a fast convergence (just like Sum(1/j^5, j)), so Maple computes quickly a few hundred decimals.

evalf[500](Sum(fd(n)*ln(1-1/n^2), n=2..infinity));

-0.13193448210193902101168456260113057372954207877638029494362536124924096687277453818310396774949030858278425655631749947528907468010666626334748919975517016978153062099871194024801794507410911378951971698504881151995858660891084236232931902589675514220351056452721912565324355327946777370232965534555511025840021602746613401257447542954468015595944834472807189884301164078566662687373782315983259649170312137042952056677012051441069664477950335128241355390929177317762043273134991270883122867315911249

restart;

conic:=(P,Q,R,a,b) -> a*Q*R+b*P*R+P*Q:

line:=(x1,y1,x2,y2)->(x-x1)*(y2-y1)-(y-y1)*(x2-x1):

Delta:=qq -> diff(qq,x,y)^2-diff(qq,x,x)*diff(qq,y,y):

########

pts:=[[1,2],[-2,2],[2,3]]:

PQR:=line(pts[1][],pts[2][]), line(pts[2][],pts[3][]), line(pts[3][],pts[1][]):

co:=conic(PQR, 2, b):

solve(Delta(co)>0); evalf([%]);

RealRange(-infinity, Open(3-2*2^(1/2))), RealRange(Open(3+2*2^(1/2)), infinity)

 

[RealRange(-infinity, Open(.171572876)), RealRange(Open(5.828427124), infinity)]

(1)

co1:=eval(co,b=2): co2:=eval(co,b=-8):

plots:-implicitplot( [PQR, co1, co2], x=-4..4, y=0..8, color=[red$3,blue,green], scaling=constrained);

 

 

Note. You may add a parabola for b=3+2*sqrt(2).

Use subs instead of alias

S:=[seq(_C||k=c[k], k=0..10)]:
sol:=dsolve(diff(y(x),x) = x+y(x),y(x));
sort(subs(S,sol));    #sort~(subs(S,[sol]))[]

 

The homogeneous coordinates are very useful to avoid degenerate cases.
A similar construction can be obtained with Cartesian coordinates.

restart;
r:=rand(-12..12):
P,Q,R := 'r()*x+r()*y+r()'$3:
q :=(a,b) -> a*Q*R+b*P*R+P*Q:
plots:-implicitplot( [P, Q, R, q(6,-6)], x=-5..5, y=-5..5, color=[red$3,blue]);

This seems to be about twice faster.

SP:= proc(A::list(set), B::list(set))
local i,j, M:=Array(1..nops(A),1..nops(B),datatype=integer[4]);
for i to nops(A) do for j to nops(B) do
  if A[i] subset B[j] then M[i,j]:=j fi od od;
[seq(subs(0=NULL,[entries(M[i],nolist)]),i=1..nops(A))]
end:

 

Maybe you should always check the envelope.
In this case,  [y=sin(x+c), cos(x+c)=0] ==> y = +-1.

Note. For the IV problem

dsolve({diff(y(x),x)=sqrt(1-y(x)^2), y(0)=-1});

Maple gives  y(x)=-1, but it has infinitely many solutions in any nbd of 0, e.g.
S:=a -> piecewise(x<a, -1, -cos(x-a));    #  0 <= a,   x<a+Pi
which probably Maple will never (?) find. 

f:=product(x+i, i=1..n):

answer:=simplify(residue(f/x^3,x=0)) assuming n::posint;

-(1/12)*(Pi^2-6*gamma^2-12*gamma*Psi(n+1)-6*Psi(n+1)^2-6*Psi(1, n+1))*GAMMA(n+1)

(1)

# check
simplify(eval(answer,n=10)) = coeff(expand(eval(f,n=10)),x^2);

12753576 = 12753576

(2)

 

Same result with:

simplify(coeff(series(f,x), x^2));

 

 

restart;

with(Physics):

Setup(noncommutativeprefix = {A,B,C})

[noncommutativeprefix = {A, B, C}]

(1)

(2*A+B*C)^*;

2*Physics:-Dagger(A)+Physics:-`*`(Physics:-Dagger(C), Physics:-Dagger(B))

(2)

lprint(%);

2*Physics:-Dagger(A)+Physics:-`*`(Physics:-Dagger(C),Physics:-Dagger(B))

 

(2*A * B^(-1) - C)^*;

2*Physics:-`*`(Physics:-`^`(Physics:-Dagger(B), -1), Physics:-Dagger(A))-Physics:-Dagger(C)

(3)

lprint(%);

2*Physics:-`*`(Physics:-`^`(Physics:-Dagger(B),-1),Physics:-Dagger(A))-Physics
:-Dagger(C)

 

 

 

ex:=sqrt(4*n^2+5*n-7)/n:
sqrt(expand(ex^2)); 

(assuming n>0).

You should be aware that in Maple it could be difficult to obtain the answer in a preferred form.

Maple can solve systems of polynomial inequalities. SemiAlgebraic is more flexible than solve.

sys := r-c>0, 0<=r^2 - 2*r*c -r +2*c, r^2 - 2*r*c -r +2*c  < (r-c)^2, 0<=c, c<=1 , 0<r, r<1, r<2*c:
SolveTools:-SemiAlgebraic([sys], [r], parameters=[c]);

       

The system has infinitely many solutions:

Sys:=lhs~(sys):
Groebner:-IsZeroDimensional(Sys);  # ==> false

To see some of them:

solve(sys, maxsols=10);

 

Somehow the names of the parameters returned by dsolve are local

 

sol:=dsolve( {diff(x(t),t)=a, x(0)=1}, numeric, parameters=[a]): # x(t)=a*t+1

type(a, `local`);

false

(1)

sol(parameters);

[a = undefined]

(2)

aa:=lhs(%[]);

a

(3)

type(aa,`local`); # !!

true

(4)

sol(parameters=[a=3]); # Works

[a = 3.]

(5)

sol(10)

[t = 10., x(t) = HFloat(31.000000000000007)]

(6)

sol(parameters=[aa=5]); # the locals not accepted

Error, (in dsolve/numeric/process_parameters) parameter(s) {a} are specified, but are not defined for the problem

 

 

 

I don't see this as a real (annoying) bug, because sol(parameters)  and sol(parameters=...) is supposed to be used only for display purposes.

Here are two working solutions.

1. Create a file A.mpl and use $include

module A()
$include "B.mpl";
export foo:=proc()
  0;
 end proc;
end module;

and in the worksheet use
read "A.mpl"

2. Remove the export from B.mpl, i.e. it will contain 

boo:=proc()
return 0;
end proc; 

and use in the worksheet:

module A()
export boo,foo;
read "B.mpl";

foo:=proc()
  0;
 end proc;
end module;


 

You cannot, because they differ by a constant.

5 6 7 8 9 10 11 Last Page 7 of 92