vv

13827 Reputation

20 Badges

9 years, 316 days

MaplePrimes Activity


These are answers submitted by vv

It will be impossible to represent such a huge object.

n:=30:
A:=simplify(LinearAlgebra:-RandomMatrix(n)+x):
B:=A^(-1):
length(B);

    2334559

If you have enough time, try then  n:=100.

restart;
f := z -> MeijerG([[], [1]], [[0, 2], []], z):
e :=      MeijerG([[], [1]], [[0, 2], []], z):
plots:-display(plot(f, -2.5..2,color=red), plot(e, z=-2.5..2,color=blue));

 

The truncated power series:

series(tanh(x), x=0, 10);

series(x-(1/3)*x^3+(2/15)*x^5-(17/315)*x^7+(62/2835)*x^9+O(x^11),x,11)

(1)

You want formal power series.
The command to obtain the formal power series for tanh(x) is

convert(tanh(x), FPS);

tanh(x)

(2)

Unfortunately it does not work.
But it can be computed using symbolic integer order derivatives

a:=eval(diff(tanh(x),x$n)/n!, x=0) assuming n>=1;

-I*I^(n+1)*2^n*(Sum((-1)^_k1*factorial(_k1)*Stirling2(n, _k1)/2^_k1, _k1 = 0 .. n))*I^n/factorial(n)

(3)

tanhx := sum(a*x^n, n=1..infinity);

sum(-I*I^(n+1)*2^n*(Sum((-1)^_k1*factorial(_k1)*Stirling2(n, _k1)/2^_k1, _k1 = 0 .. n))*I^n*x^n/factorial(n), n = 1 .. infinity)

(4)

# Check

simplify( series(value(tanhx),x,10) );

series(x-(1/3)*x^3+(2/15)*x^5-(17/315)*x^7+(62/2835)*x^9+O(x^10),x,10)

(5)

# Numeric check

evalf( tanh(1/2) = eval(tanhx,x=1/2) );

.4621171573 = .4621171573

(6)

 

There are infinitely many solutions.

solve(z^(1+I) = 1, z, allsolutions):
evalc(%);

        

So, you don't need evalf.

BTW, seq(print(...),...)  is strange (and the output is wrong; what version are you using?). Why not:

interface(rtablesize=infinity):
Vector([seq(evalf(evalf[d](u)), d = 10 .. 3010, 300)]);

The assume facility is limited. It works better for symbols rather than expressions.

 

F:=exp(-I*a*z)/a:

F1:=eval(F, z=x+I*y);

exp(-I*a*(x+I*y))/a

(1)

limit(F1, a=infinity);

limit(exp(-I*a*(x+I*y))/a, a = infinity)

(2)

limit(F1, a=infinity) assuming y>0;

undefined

(3)

One may use the experimental package MultiSeries, containing a "smarter" limit:

 

MultiSeries:-limit(cos(a*z)/a, a = infinity);

limit(cos(a*z)/a, a = infinity)

(4)

MultiSeries:-limit(cos(a*z)/a, a = infinity) assuming z::complex;

limit(cos(a*z)/a, a = infinity)

(5)

MultiSeries:-limit(cos(a*z)/a, a = infinity) assuming Im(z)>0;

undefined

(6)

 

I think that readstat being  an I/O command, it may need time to complete before calling it again.
Inserting some Sleeps makes it work.
dt depends on the speed of the computer.

dt:=0.5:
fun:=proc(n)  local a, b, i, x;
a:=readstat("insert a");
Threads:-Sleep(dt);
b:=readstat("insert b");
for i to n do
Threads:-Sleep(dt);
x[i]:=readstat("insert x");
od;
end proc:
fun(3);

 

sqrt (the principal branch) is af course well defined, the branch cut is arbitrary (-oo,0); it could be any "arc" from 0 to oo.

But it is possible to define a custom sqrt. Here is one with a branch cut along negative imaginary axis.

restart;
mysqrt:=z -> piecewise(argument(z)>-Pi/2,sqrt(z),-sqrt(z)):

 

limit(mysqrt(-1-t*I), t=0, left), limit(mysqrt(-1-t*I), t=0, right); #continuous
                              I, I
limit(sqrt(-1-t*I), t=0, left), limit(sqrt(-1-t*I), t=0, right);     #discontinuous
                             I, -I
limit(mysqrt(-I-t), t=0, left), limit(mysqrt(-I-t), t=0, right);     #discontinuous


   
limit(sqrt(-I-t), t=0, left), limit(sqrt(-I-t), t=0, right);        #continuous        

(1/2)*sqrt(2)-I*sqrt(2)*(1/2), (1/2)*sqrt(2)-I*sqrt(2)*(1/2)

simplify(convert(z, arcsin)) assuming x>-a,x<a;

works in Maple 2017.

restart;

with(Statistics):

X := RandomVariable(Normal(0,1)):

f:=t->PDF(X, t);

proc (t) options operator, arrow; Statistics:-PDF(X, t) end proc

(1)

f(t);

(1/2)*2^(1/2)*exp(-(1/2)*t^2)/Pi^(1/2)

(2)

L:= unapply( int( (t-z)*f(t) , t=z..infinity), z ); # (unit) loss function

proc (z) options operator, arrow; (1/2)*(z*Pi^(1/2)*erf((1/2)*z*2^(1/2))+2^(1/2)*exp(-(1/2)*z^2)-z*Pi^(1/2))/Pi^(1/2) end proc

(3)

plot(L, 0..3.5);

 

fsolve(L(z)=1/5, z);

.4928873272

(4)


Download loss.mw

Compilable procedures are very restrictive. See ?compile.

- Arrays can only appear as parameters of a procedure and must have datatype=float or integer
- No symbolics; for example (in your case) int(...), orthopoly[...](...)  are out of the question. Also W(...) is not allowed.

 

 

The symbol O has nothing special, except it is protected,  to prevent it from being modified.

letters:=map(convert,[seq("A".."Z"), seq("a".."z")], symbol);
    letters := [A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R,  S, T, U, V, W, X, Y, Z, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z]
select(type, letters, protected);
   
[D, O]

Edit. The symbol I (the imaginary unit) is a special one, not detected above.

 

 

It is strange that convert(...,tanh) does not work as expected.
For example, convert(sinh(x), tanh)  works but convert(exp(x), tanh) does not.

`convert/exp2tanh`:=proc(ex)
  simplify(eval(ex, exp = (t -> (tanh(t/2)+1)/(1-tanh(t/2)))))
end;

convert(exp(3*x),exp2tanh);

       

Expr:=-(exp(-a*s)-1)*kw/((exp(-a*s)+1)*s^2):

convert(Expr,exp2tanh);

    

PerfectRandom := proc()
  return 4  # Chosen by fair dice roll, guaranteed to be random
end proc:

Example:

PerfectRandom();
        4

Output:=Array(-10..10,-10..10, (i,j)->i^2+j^2):
plots:-surfdata(Output);

Let f be a real function defined on [a,b].

If f has an antiderivative F (on [a,b]) then F is by definition differentiable, hence continuous.
But f could have infinitely many discontinuities and could be non-integrable (Riemann or even Lebesgue).

Note that there exist other (generalized) integrals such as Denjoy; in this context f becomes integrable
and Newton-Leibniz applies. However the Denjoy integral is not usually considered even at a university level.

The simplest example of a function not integrable (Riemann or Lebesgue) but having an antiderivative
is  f(x) = F'(x), F(x) = x^2*sin(1/x^2), x∈[-1,1]∖{0}, F(0) = 0. Note that f is discontinuous at 0.

 

First 84 85 86 87 88 89 90 Last Page 86 of 120