vv

13977 Reputation

20 Badges

10 years, 37 days

MaplePrimes Activity


These are answers submitted by vv

residue connot compute the residue at a pole with symbolic order.
It's easy to write a procedure in this case provided that you know the order of the pole. It is based on Maple's ability to compute the derivative of a symbolic order, but it will fail for complex expressions.

Res:=(f,z,a,p) -> limit(diff(f*(z-a)^p,[z$(p-1)]), z=a)/(p-1)!:
# p = the order of the pole z=a

f := exp(-z/A)/z^(2 + n):
Res(f,z,0,n+2);

        

Try to increase Digits. For example,

restart;
Digits:=10;
n:=10;
x:=ln(1+0.1^n);
x^x;

==> Float(undefined). Increasing Digits ==> OK.

 

restart;

It's an interesting problem.

The points  Z(n, eps)   can be written as complex numbers, so that the computation will be easy and fast.

Starting from

Z(1, eps)=0, Z(2, eps)=1, Z(3, eps)=1+I*eps

 

then  for Z = X + I*Y,

 

  X(2*n+1, eps) - Y(2*n+1,eps)^2 - 1 0,  for small eps.

 

So, the "limit curve" is almost  a parabola (at least near Z=1).

 

Digits:=40;

40

(1)

f:=(Z1,Z2,Z3) -> Z1 + conjugate((Z2-Z3)/(Z1-Z3)) * (Z1-Z3);
N:=10^4; epsilon:=1e-5; Z:=Vector(N):
Z[1]:=0:  Z[2]:=1:  Z[3]:=1+I*epsilon;
Z[4]:=f(Z[1],Z[2],Z[3]):  Z[5]:=f(Z[3],Z[1],Z[4]):
for i from 6 to N do
Z[i]:=f(Z[i-2],Z[i-3],Z[i-1]) od:

proc (Z1, Z2, Z3) options operator, arrow; Z1+conjugate((Z2-Z3)/(Z1-Z3))*(Z1-Z3) end proc

 

10000

 

0.1e-4

 

1.+0.1e-4*I

(2)

 

X:=Vector(N/2-1, i -> Re(Z[2*i+1])):
Y:=Vector(N/2-1, i -> Im(Z[2*i+1])):
maxY:=max(Y);

0.4990711393221379712016621884051685006329e-1

(3)

# The result (for eps --> 0) is almost a parabola (near Z=1)!
plots:-display(plot(Y,X, thickness=12,color=green), plot(y^2+1, y=0..maxY, color=red));

 

int( sqrt(1+4*y^2),y=0 .. maxY );

0.4998986029275945551447823599821645242220e-1

(4)

 

You must use

Explore('a'[i], i = 1 .. 3);

otherwise accessing a[i]  with symbolic i, produces an error.

(Explore has special evaluation rules, the first argument is passed unevaluated).

 

pde:={diff(u(x,t),t) =K*diff(u(x,t),x, x), D[1](u)(0,t)=0}: 
# u(x,infinity) = infinity,  diff(u(x,t),x) =0 when x=0 for all t 
sol:=pdsolve(pde, generalsolution);

# ==> (changing the constants)

u(x,t) = A*( exp(c*(K*c*t+x))+exp(c*(K*c*t-x)) );

  


# A>0, c>0 [K>0]
# pdsolve says it's the general solution, but with pdsolve you can never know

SolveTools:-SemiAlgebraic([x^2+y^2+z^2-4*x+6*y-2*z-11 = 0, 2*x+2*y-z = -18], [x,y,z]);

       [[x = -4/3, y = -19/3, z = 8/3]]
              

 

You should post text, or preferably Maple code instead of low resolution pictures.

Anyway, you do not need Change if your f is smooth:
int(diff(f(s),s), s = a..b, continuous);
      - f(a) + f(b)

 

Chebyshev already had the smart idea in 1853, see here.

After a change of variables ( x+1 --> x), it's a binomial integral

Int( x^m * (A + B*x^n)^p, x);

where m=-3/2, n=3*b, p=-1/2

Using Chebyshev's result, assuming that b is rational (and a<>0, a<>1 of course), the integral is an elementary function iff
b = 1/(6*k), or b = 1/(6*k + 3),  where k is an integer.

Yes, the computation are very slow in the general case.

You can speed up considerably the computations if you use hardware floats.

If A is the 0-1 matrix, define B:=Matrix(A, datatype=float)   and compute C := B^k.
The result will be exact provided that the entries of C are < 2^53 =~ 9.0*10^15.

Another posibility is to use LinearAlgebra:-Modular.

Here I have assumed the usual multiplication. For a custom multiplication you may use LinearAlgebra:-Generic.

 

The level sets BS_Price = B (B constant) are 4-dimensional manifolds.
The equation can be solved e.g. wrt K. (It is convenient to use IERF the inverse erf function, see the code below).

To visualize the 3d sections, one can use Explore.

restart;
BS_Price=exp(-r*T)*(-(1/2)*erf((1/4)*sqrt(2)*(sigma^2*T-2*r*T+2*ln(K)-2*ln(S__0))/(sigma*sqrt(T)))+1/2);
IERF(2*B*exp(r*T)-1) = (-(1/2)*sigma^2*T+r*T-ln(K)+ln(S__0))*sqrt(2)/(2*sigma*sqrt(T));
EQK:=solve(%, K);
IERF:= z -> RootOf(erf(_Z)-z):
Explore(plot3d(EQK, r = 0 .. -ln(B)/T, T=0.5 .. 2, labels=[r,T,K]), 
parameters=[sigma=0.01 ..1, S__0=0.01 ..2, B=0.01  ..0.95]);

 

AFAIK combinat[randperm] exists in Maple versions much older than 13.

Maple can use theoretically up to 3.8*10^10 digits - if you have enough memory :-).
Your number has 83196715617456  digits (i.e. > 8*10^13) , so it will "overflow".

Using Maple + some elementary math yo can compute

a) the first n digits
b) the last n digits
for any reasonable n.
Try it.

A much more dificult task (probably impossible) would be to compute e.g. the 2 digits in the middle for this number.
If you can do it, please let us know!

 

1.  Use \\  or  /  as  directory separator.

2. The assignment operator is := 
so, use its := 1;

simplify((1/2)!);
  

restart;

# So, u = u(y,t), the rest are constants

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

diff(u(y, t), t)-(1/2)*(diff(diff(u(y, t), y), y))-A*sin(M*x-t) = 0

 

u(0, t) = 0

 

u(10, t) = A*sin(M*x-t)

 

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

(1)

sol:=pdsolve(sys);

u(y, t) = (1/2)*(sin(10+10*I)*(((-1+I)+cos(10-10*I))*sin((1-I)*y)-sin(10-10*I)*cos((1-I)*y))*exp(-I*(M*x-t))-(((1+I-cos(10+10*I))*sin((1+I)*y)+cos((1+I)*y)*sin(10+10*I))*exp(I*(M*x-t))-2*cos(M*x-t)*sin(10+10*I))*sin(10-10*I))*A/(sin(10+10*I)*sin(10-10*I))

(2)

pdetest(sol,sys);

[0, 0, 0]

(3)
First 55 56 57 58 59 60 61 Last Page 57 of 120