vv

14092 Reputation

20 Badges

10 years, 90 days

MaplePrimes Activity


These are answers submitted by vv

AA:=convert(A,rational):
bb:=convert(b,rational);
xx := LinearSolve(AA, bb);

 

restart;
g[2]:=0: g[1]:=1: g[3]:=1: alpha:=2: c:=1:
k:=(g[2]+2*g[3]-3*g[1]*alpha)/(6*g[1]*g[3]):
omega:=(((1-3*g[1]*k)*(2*k-c-3*g[1]*(k^2))  )/(g[1]))+(k^2)-g[1]*(k^3):
uu11:=1/(g[2]+2*g[3])^(1/2)*(-3*(3*k^2*g[1]+c-2*k))^(1/2
)*sin(1/2/g[1]*2^(1/2)*(g[1]*(3*k^2*g[1]+c-2*k))^(1/2)*(-c*t+x))/
cos(1/2/g[1]*2^(1/2)*(g[1]*(3*k^2*g[1]+c-2*k))^(1/2)*(-c*t+x))*exp(
I*(k*x-omega*t)):
pde:=I*Diff(u(x,t),t)+Diff(u(x,t),x$2)+alpha*(abs(u(x,t))^2)*u(x,t)+ 
I*( g[1]*Diff(u(x,t),x$3) + g[2]*(abs(u(x,t))^2)*u(x,t) + g[3]*Diff((abs(u(x,t))^2),x)*u(x,t) ):
eval(pde, u(x,t)=uu11):
Z:=value(%):
eval(Z, [x=1,t=2]): evalf(%);  # <>0
eval(Z, [x=2,t=1]): evalf(%);  # <>0

                  -12687.93889 - 28829.95560 I

                  25022.56665 - 19131.68293 I

The two functions are equal (f and the spline). This is normal, f being a polynomial of degree <=3). So, if you want to test your construction, choose another f.
convert(NaturalSpline(x) - f, rational) ; # ==> 0.

BTW. Your f is an expression, not a procedure. So, don't use f(x) because it's a nonsense. 

So, you probably want to approximate a solution of ODE0 by U0. Why not something like this?

restart;
ODE0:= diff(U(x),x$2) + A*U(x) + B*U(x)^3;
U0:=x -> sin(mu*x)/(K + L*cos(mu*x));
Z:=eval(ODE0, U=U0);
series(Z,x,4);
coeffs(convert(%,polynom),x);
solve([%],[K,L],explicit);

 

Maple is not a human. A student would make the change of variables e.g. x = t^(3/4), and then compute directly.
But Maple uses sometimes lookup tables (with patterns) such as int(x^a*(1+A*x^b)^c, x), in terms of special functions.
The conversion from these special functions to elementary ones is not always easy, or even possible.

BTW, in Maple 2020 the integral is computed directly.

resultant makes sense only with respect to a single variable. So, resultant(f, g, x) eliminates (roughly) x for the system {f=0, g=0}.
If you want to eliminate both x and y, use eliminate or apply resultant twice.
Actually, you should say what exaclty you want to achieve.

int(simplify(v), x);

works.

There is a bug in Maple 2020 which does not integrate the obvious integral

int(sqrt(-x*(x - 20))*sqrt(-1/(x*(x - 20))), x = 0 .. h) assuming h>=10,h<=20;

( should be of course h) .

Workaround:

f := sqrt(-x^2+20*x):
F := simplify(f*sqrt(1+diff(f,x)^2)) assuming x>0, x<20:
solve(2*Pi*int(F, x=0..h) = 1005);

          201/(4*Pi)

It is easy to see that if there was a solution, then 
s  :=  a^4 + 4*a^3*k + 2*a^2*k^2 + 4*a*k^3 + k^4
would be an exact square for a,k positive integers (actually 0 < k < a).

But s is never a square for 0 < k < a. This can be proved mathematically, or checked by Maple for a <= N = 5000 say:

N:=5000;
seq(seq(`if`(issqr(a^4 + 4*a^3*k + 2*a^2*k^2 + 4*a*k^3 + k^4), [a,k],NULL), k=1..a-1),a=1..N);

You define u(x,t) := ...,  but u is already defined as a table u[i]:=...
This generates a total mess. Use another "variable", e.g. U(x,t) instead.

How can you believe that the expressions could be equal? Not only the exponents of sin(...) are different (2/n  versus 2/(n-1)) but the constants are not the same, one of them is piecewise, ...

C:=(m::nonnegint,n::integer) -> 
  coeff(coeff(product((1-q^i)*(1-q^i/z)*(1-q^(i-1)*z), i=1..m+1),q,m),z,n):


C(6,2),  C(6,4); 

      0,  1

(k is an arbitrary integer)

restart;
f:=(x,c,d)->(x-c)*(x+c)*(x-d)*(x+d):
g:=(x,c,d)->(x-c)*(x+c-1)*(x-d)*(x+d-1):
N:=10:
for c to N do  for d from c+1 to N do
  for x1 to c-1 do
    for F in [f,g] do
      if nops(factor(F(x,c,d)-F(x1,c,d)))=4 then lprint(F(x+k,c,d),m=F(x1,c,d)) fi;
    od
  od
od od:

(x+k-4)*(x+k+3)*(x+k-5)*(x+k+4), m = 180
(x+k-4)*(x+k+3)*(x+k-6)*(x+k+5), m = 360
(x+k-4)*(x+k+4)*(x+k-7)*(x+k+7), m = 720
(x+k-5)*(x+k+4)*(x+k-7)*(x+k+6), m = 504
(x+k-5)*(x+k+4)*(x+k-9)*(x+k+8), m = 1260
(x+k-5)*(x+k+4)*(x+k-10)*(x+k+9), m = 1800
(x+k-5)*(x+k+5)*(x+k-10)*(x+k+10), m = 2016
(x+k-6)*(x+k+5)*(x+k-7)*(x+k+6), m = 1260
(x+k-6)*(x+k+6)*(x+k-7)*(x+k+7), m = 1440
(x+k-6)*(x+k+5)*(x+k-9)*(x+k+8), m = 1080
(x+k-7)*(x+k+7)*(x+k-9)*(x+k+9), m = 2880
(x+k-7)*(x+k+6)*(x+k-10)*(x+k+9), m = 3780
(x+k-8)*(x+k+8)*(x+k-9)*(x+k+9), m = 5040
(x+k-9)*(x+k+8)*(x+k-10)*(x+k+9), m = 5544
(x+k-9)*(x+k+8)*(x+k-10)*(x+k+9), m = 2520
 

1. In Maple 2020 it can be done because a (statement)  is an expression

restart;
x:=10: str:="A":
str:=cat(str,  `if`(x=10,  [(x:=11)," it was 10"][2], [(x:=8)," it was not 10"][2]));  x;

 

2. `if`  is alias for ifelse  and a link appears in the help page of if. Or, use ?ifelse 

 

p:=randpoly([x,y,z]);
`%+`(sort([op(p)], key=abs@coeffs)[]);

Use value(%)  to  go back.

First 30 31 32 33 34 35 36 Last Page 32 of 121