vv

13992 Reputation

20 Badges

10 years, 39 days

MaplePrimes Activity


These are replies submitted by vv

@Carl Love 

Using dsolve here does not seem to be very useful. It would be nice to construct continuous selections from the solutions obtained by solve, but it is not the case. This is possible using the Draghilev's method (for systems) which uses indeed ODEs, or solving the ODE starting from the equation (if possible), not from the solutions provided by solve.

Take for instance a discontinuous function (like one given by solve).

f:=piecewise(x<1,x^2, 3-x^2):

s:=dsolve( {diff(Y(x),x)=diff(f,x), Y(0)=0}, numeric):

plots:-odeplot(s, [x,Y(x)],x=0..2);

 

plot(f, x=0..2);

 

 

 

It is clear that for x>1 the result is continuous but completely wrong.

 

Nice, vote up! A shorter version:

restart;

g :=min((3+((x-y)^(2))/(10)+(abs(x+y))/(sqrt(2))),(-abs(x-y)+(7)/(sqrt(2))));

min(-abs(x-y)+(7/2)*2^(1/2), 3+(1/10)*(x-y)^2+(1/2)*abs(x+y)*2^(1/2))

(1)

J:=Int(Heaviside(g)*exp((-x^2-y^2)*(1/2))/(2*Pi), y = -infinity .. infinity, x = -infinity .. infinity):
J = `?`;

Int((1/2)*Heaviside(min(-abs(x-y)+(7/2)*2^(1/2), 3+(1/10)*(x-y)^2+(1/2)*abs(x+y)*2^(1/2)))*exp(-(1/2)*x^2-(1/2)*y^2)/Pi, y = -infinity .. infinity, x = -infinity .. infinity) = `?`

(2)

# the terms (x-y) and (x+y) suggest changing frame [0, x, y]into frame [O, u, v] by a rotation of angle Pi/2
uv2xy := [x = (1/2)*sqrt(2)*(u+v), y = (1/2)*sqrt(2)*(u-v)]

[x = (1/2)*2^(1/2)*(u+v), y = (1/2)*2^(1/2)*(u-v)]

(3)

f := exp((-x^2-y^2)*(1/2))/(2*Pi);

(1/2)*exp(-(1/2)*x^2-(1/2)*y^2)/Pi

(4)

F:=eval(f, uv2xy);

(1/2)*exp(-(1/4)*(u+v)^2-(1/4)*(u-v)^2)/Pi

(5)

G := simplify(eval(g, uv2xy));

min(-(1/2)*2^(1/2)*(2*abs(v)-7), 3+(1/5)*v^2+abs(u))

(6)

#  G >= 0  <==>  abs(v) <= 7/2   (obvious), so

J = int(F, u=-infinity .. infinity, v=-7/2..7/2);

Int((1/2)*Heaviside(min(-abs(x-y)+(7/2)*2^(1/2), 3+(1/10)*(x-y)^2+(1/2)*abs(x+y)*2^(1/2)))*exp(-(1/2)*x^2-(1/2)*y^2)/Pi, y = -infinity .. infinity, x = -infinity .. infinity) = erf((7/4)*2^(1/2))

(7)

 

@tapish2502

Your worksheet is in Maple 2017.3.
In Maple 2018.2 (which I use) it works.

@ecterrab 

A pdetest should not be necessary for u(x,y,t) if u(y,t) is verified. Anyway, here it is:

pde := diff(u(x, y, t), t)-1/2*(diff(u(x, y, t), y, y))-A*sin(M*x-t) = 0;
bc[1] := u(x, 0, t) = 0;
bc[2] := u(x, 10, t) = A*sin(M*x-t);
sys := [pde, bc[1], bc[2]];

SYS:=eval(sys, u = ((x,y,t) -> U(y,t)));
SOL:=pdsolve(SYS);

sol:= eval(SOL, U = ((y,t) -> u(x,y,t)));
pdetest(sol,sys);

@snpa 

You cannot do this mathematically.
E.g.  you may obtain an antiderivative (=indefinite integral) as  ln(x) + c1   or  ln(2*x) + c2.
Which one of c1, c2  should be 0?

Of course, you may use definite integrals.

@Carl Love 

It is worth mentioning that for a large k (say >1000) it's practically impossible to prove the primality.
We'll have to be happy with the "probably prime" status.

@Vortex 

For simple k,z as above it's easy to compute EllipticF(infinity, k) by hand, splitting the integral and using changes of variables.

@acer 

Yes, I know about the flaws. I have just copied OP's procedures in order to show the idea.

@Vortex 

Yes, but only for real k,z (z --> +infinity).
For example, for k=I/2, z --> I*infinity,  the limit is  EllipticCK(k)*I.

@mmcdara 

The OP says "connections from i to j"; I'd use "between i and j" for an undirected graph.
Anyway it's OP who will decide which one is best for him.

@sadaf bibi 

In any CAS it's very difficult to rewrite an expression in your preferred form.
For example, from an expanded polynomial it will be hard to obtain  (2*x^2 - x - 1)^15 + x^9 + 7 even if you like it very much.

In your cases:
1.  csch  and coth  are  not "independent".  A lot of acrobatics will be needed to express an exponential exactly as you want it. There are infinitely many equivalent forms.

2. The second phi is wrong (2D input): you have spaces after sech.

@sadaf bibi 

If you want to retrieve a solution Q(xi) then compute a := Q(0)  (or a := limit(Q(xi), xi=0))  and take phi(0) = a  as initial condition.  But why don'd you just check Q(xi) in the ODE?

BTW, you have used incorrectly the 2D input in your second solution. I'd recommend to use 1D input.

 

@sadaf bibi

 

restart;

E1 := (diff(phi(xi), xi))^2-a*phi(xi)^2-b*phi(xi)^3-c*phi(xi)^4;

(diff(phi(xi), xi))^2-a*phi(xi)^2-b*phi(xi)^3-c*phi(xi)^4

(1)

S:=dsolve({E1, phi(0) = b*a/(a*c-b^2)},  phi(xi)):
simplify([S], symbolic);

[phi(xi) = 4*a*b*exp(xi*a^(1/2))/((4*a*c-b^2)*exp(2*xi*a^(1/2))-2*b^2*(exp(xi*a^(1/2))+1/2)), phi(xi) = 4*a*exp(-xi*a^(1/2))*b/((4*a*c-b^2)*exp(-2*xi*a^(1/2))-2*b^2*(exp(-xi*a^(1/2))+1/2))]

(2)

g:= -a*b*sech((1/2)*sqrt(a)*xi)^2/(b^2-a*c*(1-tanh((1/2)*sqrt(a)*xi))^2);

-a*b*sech((1/2)*xi*a^(1/2))^2/(b^2-a*c*(1-tanh((1/2)*xi*a^(1/2)))^2)

(3)

gg:=simplify(convert(g,exp));

-4*exp(xi*a^(1/2))*a*b/(exp(2*xi*a^(1/2))*b^2+2*exp(xi*a^(1/2))*b^2-4*a*c+b^2)

(4)

simplify(rhs(S[2]) - gg, symbolic);

0

(5)

 

Download -ode.mw

@Carl Love 

I just wanted to post my foldl version when I saw that you alredy have posted CartProd_NestedSeq which is almost the same.
It seems to be the fastest.

@Carl Love 

Yes, you are right. Only for huge numbers the procedure could have problems if Digits is not large enough.
(Of course my procedure, where Digits is increased automatically if necessary, could be very slow in such cases).

First 66 67 68 69 70 71 72 Last Page 68 of 177