vv

13837 Reputation

20 Badges

9 years, 328 days

MaplePrimes Activity


These are replies submitted by vv

@mmcdara 

A Maple command to squeeze polynomials is compoly. Unfortunately it fails for almost any random polynomial.
My example was not presented as a challenge (and the simplified form was given).
Here is also a simple one:

F := 1238*a^9 + (6927*b + 3756)*a^8 + (40476*b^2 + 26226*b + 5334)*a^7 + (145584*b^3 + 144582*b^2 + 46947*b + 5376)*a^6 + (326904*b^4 + 436890*b^3 + 218880*b^2 + 48384*b + 4032)*a^5 + (489558*b^5 + 815670*b^4 + 543885*b^3 + 181440*b^2 + 30240*b + 2016)*a^4 + (489988*b^6 + 979926*b^5 + 816510*b^4 + 362880*b^3 + 90720*b^2 + 12096*b + 672)*a^3 + (314936*b^7 + 734882*b^6 + 734877*b^5 + 408240*b^4 + 136080*b^3 + 27216*b^2 + 3024*b + 143)*a^2 + (118084*b^8 + 314894*b^7 + 367396*b^6 + 244944*b^5 + 102060*b^4 + 27216*b^3 + 4536*b^2 + 430*b + 16)*a + 19686*b^9 + 59055*b^8 + 78735*b^7 + 61236*b^6 + 30618*b^5 + 10206*b^4 + 2268*b^3 + 323*b^2 + 25*b;

It can be written (in 1D) using 534 characters (using simplify/size), i.e.  length(convert(F,string)) = 534.
There is a simplified form using only 49 characters.
It would be very nice to have in Maple such a "squeezer".

I did not remove it! Probably somebody else did.

I just asked why it was transformed into a question, from its initial place.

In all cases, it would be nice that any such action be mentioned by the person who decides to do so.

 

I wonder why this comment @chandrashekhar was converted into a question.

@Rouben Rostamian  

Very nice, thank you.
So, it seems that pdsolve accepts discontinuous bc's but rejects discontinuous pdes, and converting the 2nd order PDE into a 1st order system does not always work.
The solution is to approximate the discontinuous pde or to implement a custom finite difference method, as you did.
[There should be some pdsolve options, but they seem to be hard to find].

The pde approximation method (also yours!) works well for your last example:

restart;
uexact := piecewise(x<0, erf(x/(2*sqrt(t))), 1/2*erf(x/(4*sqrt(t)))):
#K := x -> piecewise(x<=0, 1,4):
K := x -> 1+3*(1+erf(100*x))/2:
pde := { diff(u(x,t),t) =  diff(K(x)*diff(u(x,t),x), x)}:
bc:={ u(-1,t)=-erf(1/(2*sqrt(t))), u(1,t)=erf(1/(4*sqrt(t)))/2, u(x,0)=piecewise(x<0, -1, +1/2)}:
sol:=pdsolve(pde, bc, numeric, spacestep=1/200, timestep=0.0001):
p1:=sol:-animate(u, t=0..0.1, frames=25, color=red):
p2:=plots:-animate(plot,[uexact, x=-1..1, color=blue], t=0..0.1, frames=25):
plots:-display(p1,p2);

@Rouben Rostamian

It would be nice to know an exact solution for an example where c(x) (=K(x)) is also discontinuous.
It is in this case where I don't know theoretical results.

@Bart 

Yes, it seems that pdsolve rejects not only a discontinuous u(x,0) but also a continuous but non-smooth one.
Rouben's solution accepts any u(x,0) because it does not check it. It just solves the generated linear system.
I do not know what the theory says for such conditions and about the nature of the solution (when it exists).

(for Example 2)

restart;
K := x -> piecewise(x<0.5, 1, 10):
pde := {diff(u(x,t),t)=diff(v(x,t),x),
        v(x,t)=K(x)*diff(u(x,t),x)}: 
bc:={ u(0,t)=0, u(1,t)=1, u(x,0)=2 }:
sol:=pdsolve(pde, bc, numeric, spacestep=1/200):
sol:-animate(u, t=0..0.15);

@federicie

f:=proc(a,b,ev)
   local i; global A,B,F;
   if ev<>true then return 'last'(A,B)=F fi;
   A,B:=a,b;
   F:=add(evalf(sin(a+b+i)), i=1..10^5)
end:

 

@Carl Love 
In the 2019 help page:

This feature is currently not supported in 2-D math input

@Carl Love 

Maybe I am too conservative but I prefer the old style

ur:= proc(r) local i:=op(procname); A[i]*r + B[i]/r end;

 

@WebSuccess 

Unfortunately you have not checked your statement.

@byrktr 

Sorry, I don't know. But usually in such problems some heuristic is used.
BTW, I have corrected a typo in cond3.

Edit.
Here is an idea.
Solve the problem in real x[i,j,k],  in the interval 0..1. Maple can do it quickly.
One obtains an "approx" solution (with some conditions violated). Maybe you can start from here.

i1:=indets([cond1])<=~1:
i0:=indets([cond1])>=~0:
i01:=i0[],i1[]:

fracsol:=Optimization:-LPSolve( add(q[i],i=1..20), {seq(cond||i, i=1..6), i01} );
sol01_approx:=map(t -> (lhs(t)=round(rhs(t))), fracsol[2]);

@byrktr 

It is always a good idea to post the mathematical presentation of the problem. Then, an experienced user could come with a simpler/alternative solution.

@student_md 

Actually, it's the absolute error. For the relative error, use

numapprox:-infnorm((y-mExact)/mExact, 0..1);

 

@denbkh 

I can easily give recurrences with "complex" sums which cannot be solved.
If you have a specific one, why don't you post it?

First 61 62 63 64 65 66 67 Last Page 63 of 176