## 20 Badges

19 years, 265 days
Munich, Bavaria, Germany

## no solution (2)...

If you insert x[2] from g into f then you find x[1] = - 0.668... now feeding g you find x[1] = - 1.552 ...

## ctrl + D...

For me the keyboard combination <ctrl> + <D> works.

## = sqrt( cos^2 )...

I think it can be written as a* sqrt( cos(x+c__1)^2 ) which I consider to be more simple (even if LeafCount is the same as for e2)

MP_238462_some_simplification.mw

## trick...

You may try the following approach:

fsolve usually delivers real solutions only. If you want positive ones you can change your variable, say x, to X^2, fsolve for X and square it.

Find an example bellow. However I will not do it for your problem.

 > # https://www.mapleprimes.com/questions/238400-Helping-Fsolve
 > eq:=(x-1)^2-16;   # plot(%); {fsolve(eq)};     # set of solutions = {-3, +5}
 (1)
 > EQ:=eval(eq, x=X^2); # {fsolve(EQ, complex)};     # set of complex solutions for EQ {fsolve(EQ)};                # set of (real) solutions for EQ map(q -> q^2, %);            # now back to eq
 (2)
 >

Download MP_238400_positive_solutions.mws

## try this...

You can use

(*

(some code to be de-activated)

*)

## CR...

For example

 >
 > restart; interface(version);
 (1)
 >
 > f:= z -> 1/(z + 2); f(x+I*y); u:=unapply(evalc(Re(%)), x,y); v:=unapply(evalc(Im(%%)), x,y);
 (2)
 >
 > ['D[1](u)(x,y) = D[2](v)(x,y)', 'D[2](u)(x,y) = -D[1](v)(x,y)']; simplify(%): evalc(%); map(is, %);
 (3)
 > '[diff(u(x,y),x) = diff(v(x,y),y), diff(u(x,y),y) = -diff(v(x,y),x)]'; evalc(%): simplify(%); map(is, %);
 (4)

Download CR.mws

## - 2/7...

It should simplify to - 2/7

 > # https://www.mapleprimes.com/questions/236590-Error-in-Trignormalsincosargs-Too restart; kernelopts(version);
 (1)
 > expr := -1/7 - (-1/7*7^(5/7)*exp(2/7*Pi*I)*sin(1/7*Pi)*I - 1/7*cos(1/7*Pi)*7^(5/7)*exp(2/7*Pi*I))^(7/2):
 > # evalf[20](expr): fnormal(%): identify(%); # = -2/7
 > # evalc(expr): simplify(%);                 # = -2/7
 > simplify(expr): evalc(%): simplify(%);                      # = -2/7
 (2)
 > # convert(expr, trig): simplify(%);         # = -2/7

Download MP_236590.mw

## Real and Imaginary...

It often helps to care for spurious numerical imaginary results:

[Re(res), Im(res)]:
plot(%,t=-5..1, color=[red,blue]);

## formally...

For example like this (upload does not work ...):

NumericEventHandler(invalid_operation = `Heaviside/EventHandler`(value_at_zero = 0)):
assume(u::real, v::real);

[Int(Dirac(u-v), [u, v]) , min(u,v)]; value(%);
convert(%, piecewise, u);
%[1] - %[2]; # = 0

[Int(Dirac(u+v-1), [u, v]), max(u+v-1, 0)]; value(%);
convert(%, piecewise, u);
%[1] - %[2]; # = 0

## hm...

I think that limit(expr, +oo) = 24 is false

## Proof...

 > # https://www.mapleprimes.com/questions/237741-Integral-Of-Dirac restart; kernelopts(version);
 (1)
 > g:= x -> x^2+y^2-1; #g:= x -> x^2-a^2; 'y^2-1 = eval(-a^2, a=sqrt(1-y^2))'; is(%);
 (2)
 > Int(Dirac('g'(x)), x=-infinity ... infinity): '%'= value(%);
 (3)

This is correct using a quite common definition for composing Dirac and appropriate functions, see Maple's help

or https://en.wikipedia.org/wiki/Dirac_delta_function#Composition_with_a_function referencing to I M Gelfand

 > 0='g'(x); Zeros:={solve(%,x)}; x1,x2:=op(Zeros);
 (4)

The zeros of g are simple iff  . Therefore the composition can be defined as

 > delta('g'(x)) = Sum('delta(x-xi)/abs(D(g)(xi))', xi in 'Zeros'); subs(Sum=add, %): %; Dirac_of_g(x):=eval(rhs(%), delta=Dirac);
 (5)

Then the integral works out as asserted (since  ):

 > Int(Dirac('g'(x)), x=-infinity ... infinity); ``=Int(Dirac_of_g(x), x=-infinity .. infinity); value(%);
 (6)

Download MP_237741-Integral-Of-Dirac.mw

## formula...

@Zeineb I can not read your local pdf ...

In Gradshteyn+Ryzhik 3.196.3 you find the following formula

Here B = Beta function and EH is a reference to Erdelyi's Bateman manuscripts.

From that you may derive your desired formula by changing the variable through x = f(y)
and renaming variables

## you can stay with Sum ......

... if you change the range of integration

 > # https://www.mapleprimes.com/questions/237601-Message--Error-in-Assuming-When
 > restart; kernelopts(version); N:='N':
 (1)
 > f := (n, x) -> 1/4*JacobiP(n, 1/2, 1/2, x)*4^(1/2)/   (GAMMA(n + 3/2)^2/((2*n + 2)*GAMMA(n + 2)*n!))^(1/2):
 > # change range of integration Int(sqrt(1 + x)*phi(n, x)*sqrt(-x^2 + 1), x = -1 .. 0) +   Int(phi(n, x)*sqrt(-x^2 + 1), x = 0 .. 1); ``=IntegrationTools:-Change( op(1,%), 1+x=xx,xx) +   op(2,%): subs(xx=x,%): combine(%); subs(phi=f, rhs(%)): c:=unapply('%',n);
 (2)
 > S:=(N,t) -> Sum(c(n)*f(n, t), n = 0 .. N);
 (3)
 > 'S(1,1)': '%'=  simplify(value(%)); `` = evalf(rhs(%));
 (4)

Download MP_237601.mw

## Roughly ......

Some general explanation is given in  https://simple.wikipedia.org/wiki/Compiled_language

Roughly evalhf uses compiled code - but only for a small set of numerical function, results are limited w.r.t. "valid digits of the result"

For the full strength of Maple however one needs more, evalhf ist not enough.

## Acer's solution as numerical function an...

 > # https://www.mapleprimes.com/questions/237170-How-Can-I-Resolve-This-Numeric-Integral
 > restart; Digits:=15;
 (1)
 > E:= c -> 1/erfi(c); #c = sqrt(alpha/2)*b; g:= (x, c) -> exp(-x^2 - erfi(x)^2*E(c)^2/2); ``; h:=    (c) -> (x -> (g(x, c))); hNum:= (c) -> (x -> evalf[15](g(x, c))); # Acer ... ``; F:= (alpha,b) -> 2* sqrt(2)*alpha* E(sqrt(alpha/2)*b)/Pi*   Int( h(sqrt(alpha/2)*b)(x), x=0..infinity); P:= (alpha,b) -> 2* sqrt(2)*alpha* E(sqrt(alpha/2)*b)/Pi*   Int( hNum(sqrt(alpha/2)*b), 0..infinity,method = _d01amc);
 (2)
 > # One can show that F equals the original task using the change # sqrt(2)*sqrt(-alpha)*t/2 = I*x # erfi is a real valued function (convert to an integral)
 >
 > # after a first call for a 'warm up' the function P is ~ 20% slower than acer's direct version forget(evalf): CodeTools:-Usage(   evalf(P(0.1, 0.1)) );
 memory used=9.70MiB, alloc change=0 bytes, cpu time=124.00ms, real time=122.00ms, gc time=0ns
 (3)
 >
 > 'F(a,b)= a*F(1, sqrt(a)*b)', 'F(a,b)= 1/b^2*F(a*b^2,1)'; map(is, [%]) assuming 0
 (4)
 > # That identity means that F originates from an univariate function: # Let f(x) be given. Then define Phi(x,y) := f(x*y^2)/y^2 and f(x) = Phi(x,1)
 > plot(x -> P(x,1), 0 .. 20, numpoints=6, smartview=false);
 > # with some hand waving one sees: F(0,1) =, F(+oo, 1) = 0
 >
 > #a0, b0:= 0.1, 0.2; # example #['P(a0, b0) = a0*P(1, sqrt(a0)*b0)', 'P(a0, b0) = P(b0^2*a0, 1)/b0^2']; evalf(%);
 >

Download MP_237170_avoid_overflow.mw

 1 2 3 4 5 6 7 Last Page 1 of 92
﻿