vv

12453 Reputation

19 Badges

9 years, 282 days

MaplePrimes Activity


These are answers submitted by vv

Compute the series around x = 0. You will see that Maple's result is correct.

The procedure is very simple and practically it cannot be made faster (the bottleneck being isprime).
For n>28 you will need a lot of patience. But you can save f and rerun it another day, the computed values are saved too.
 

restart;
f:=proc(n::posint)
local a,b,c;
a,b:=f(n-2),f(n-1);
while not isprime((c:=a+b)) do a,b:=b,c od;
if n<13 then lprint(n=c) else
   printf("%d = %s ... %s len=%d\n", n, ""||c[1..10], ""||c[-10..-1], length(c)) fi; 
f(n):=c;
end proc:
f(1):=2:f(2):=3:

f(27):


3 = 5
4 = 13
5 = 31
6 = 313
7 = 2659
8 = 96979
9 = 97340263
10 = 96133996771
11 = 288596670839
12 = 35613385860024917251
13 = 1210855125 ... 1377274153 len=22
14 = 4191695536 ... 7350583473 len=23
15 = 1559140836 ... 5674347327 len=35
16 = 1169745412 ... 9762684239 len=40
17 = 3996415043 ... 1378463323 len=55
18 = 4535544101 ... 7757493097 len=64
19 = 2625668239 ... 2056367381 len=113
20 = 2276456306 ... 0210477381 len=138
21 = 2046360541 ... 3641285093 len=168
22 = 4162619505 ... 8047946001 len=271
23 = 1930123412 ... 5467084469 len=276
24 = 1665092783 ... 3398723741 len=287
25 = 7550383970 ... 9920377053 len=421
26 = 1325989112 ... 9358807409 len=691
27 = 1475647825 ... 1633573333 len=1030
 

A = A(i) can be proved to be equal to - (-d)^i. Use induction. Maple does not want to simplify A(i) to -(-d)^i. It would be possible to use Maple for A(i+1) etc, but it's easier by hand..

The rest is simple, because B = - A(i+1)/d = - (-d)^i = A(i).

A:= t -> numapprox:-infnorm((f_exact-f_numeric)(x,t), x=0..2):
numapprox:-infnorm('A'(t), t=0..2);
#                         0.02681084520

 

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, ...

First 20 21 22 23 24 25 26 Last Page 22 of 111