Mariusz Iwaniuk

1616 Reputation

14 Badges

10 years, 140 days

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are answers submitted by Mariusz Iwaniuk

 

Maple has this function Totient(n) built-in.This command was introduced in Maple 2016. Using showstat function we can preview the code.

with(NumberTheory):
showstat(Totient);
showstat(PrimeFactors);
NumberTheory:-Totient := proc(n::{posint, And(algebraic,Not({boolean, `in`, complexcons, extended_numeric}))}, $)
local prime_factors, p;
   1   if not type(n,'posint') then
   2       return ('procname')(n)
       elif isprime(n) then
   3       return n-1
       else
   4       prime_factors := NumberTheory:-PrimeFactors(n);
   5       return n*mul(p-1,`in`(p,prime_factors))/convert(prime_factors,'`*`')
       end if
end proc

NumberTheory:-PrimeFactors := proc(n::{integer, And(algebraic,Not({boolean, `in`, complexcons, extended_numeric}))}, $)
local i;
   1   if n = 0 then
   2       error "cannot represent all prime factors of %1", n
       elif type(n,{'negint', 'posint'}) then
   3       return {seq(i[1],`in`(i,ifactors(n)[2]))}
       else
   4       return ('procname')(n)
       end if
end proc

Another code you can find on this webpage: http://oeis.org/A000010 see:MAPLE -> # version 2.

Have fun !

If yours integral is:

int(sqrt(ln(x)/x^2-1/x), x)

then Maple can't find it. Possible it has No closed form.

See: https://en.wikipedia.org/wiki/Nonelementary_integral.

Mathematica, Rubi,Axiom,SymPy, Maxima  cannot do it, either.

Second one:

int((ln(x)^(a-1)/x^2-1/x)^(1/2),x)

the same case.

EDITED:

If You want approximate integral by series see worksheet.

Approximate_indefine_integral_by_Series.mw

convert(exp(x), Sum, dummy = n)

or:

convert(exp(x), FormalPowerSeries)

For Simple function (2 methods):

you can use inverse ztransform:

Sum(x^n*invztrans(eval(exp(x), x = 1/x), x, n), n = 0 .. infinity)#only works if invztrans can find transfrom.

or n-th derivative:

Sum(x^n*(eval(diff(exp(x), x$n), x = 0))/factorial(n), n = 0 .. infinity)#only works if n-th derivative can find.

 

Only another way to calculate Julian date.

Formula from:http://aa.usno.navy.mil/faq/docs/JD_Formula.php

Compute the JD corresponding to 2018 January 11, 18h30m30s UT.

Substituting Y = 2018, M = 1, D = 11,h = 18, m = 30, s = 30;

restart:
JD := proc (Y, M, D, h, m, s) local x; 
x := evalf(367*Y-trunc((7/4)*Y+(7/4)*trunc((1/12)*M+3/4))+trunc((275/9)*M)+D+1721013.5-
(1/2)*signum(100*Y+M-190002.5)+1/2+(1/24)*h+(1/1440)*m+(1/86400)*s); end proc:

JD(2018, 1, 11, 18, 30, 30);

# 2.458130271*10^6

 

 

It may not possible to find anti-derivatives(closed form).

https://math.stackexchange.com/questions/1469123/integral-of-ex2

https://math.stackexchange.com/questions/168860/functions-cannot-be-integrated-as-simple-functions?rq=1

Mathematica gives No solution.

An aproximation only can be done e.g by series:


 

p := sqrt(ln(t)*(1/ln(t)^2))/(t*(1-ln(t)^2/t^2)^(1/4))

(1/ln(t))^(1/2)/(t*(1-ln(t)^2/t^2)^(1/4))

(1)

with(IntegrationTools):

Int(p, t)

Int((1/ln(t))^(1/2)/(t*(1-ln(t)^2/t^2)^(1/4)), t)

(2)

Change(Int((1/ln(t))^(1/2)/(t*(1-ln(t)^2/t^2)^(1/4)), t), t = exp(x))

Int(-(1/ln(exp(x)))^(1/2)*(exp(x))^2*(-(ln(exp(x))^2-(exp(x))^2)/(exp(x))^2)^(3/4)/(ln(exp(x))^2-(exp(x))^2), x)

(3)

`assuming`([simplify(Int(-(1/ln(exp(x)))^(1/2)*(exp(x))^2*(-(ln(exp(x))^2-(exp(x))^2)/(exp(x))^2)^(3/4)/(ln(exp(x))^2-(exp(x))^2), x))], [x > 0])

Int(exp((1/2)*x)/((-x^2+exp(2*x))^(1/4)*x^(1/2)), x)

(4)

GetIntegrand(Int(exp((1/2)*x)/((-x^2+exp(2*x))^(1/4)*x^(1/2)), x))

exp((1/2)*x)/((-x^2+exp(2*x))^(1/4)*x^(1/2))

(5)

series(exp((1/2)*x)/((-x^2+exp(2*x))^(1/4)*x^(1/2)), x = 0, 5)

1/x^(1/2)+(1/4)*x^(3/2)-(1/2)*x^(5/2)+(21/32)*x^(7/2)+O(x^(9/2))

(6)

Int(exp((1/2)*x)/((-x^2+exp(2*x))^(1/4)*x^(1/2)), x) = int(1/x^(1/2)+(1/4)*x^(3/2)-(1/2)*x^(5/2)+(21/32)*x^(7/2)+O(x^(9/2)), x)

Int(exp((1/2)*x)/((-x^2+exp(2*x))^(1/4)*x^(1/2)), x) = (1/1680)*x^(1/2)*(245*x^4-240*x^3+168*x^2+3360)+O(x^(11/2))

(7)

``


 

Download Only_aproximation.mw

 

Use Maple built function intsolve with method Neumann or with this  paper https://arxiv.org/ftp/arxiv/papers/1309/1309.6311.pdf see another attached file (Fredholm_integral_2ver.)


 

restart

alpha := 1; A := 1

f := proc (k) options operator, arrow; 1-2*k^2/(sqrt(alpha^2+k^2)*(sqrt(alpha^2+k^2)+k)) end proc

proc (k) options operator, arrow; 1-2*k^2/(sqrt(alpha^2+k^2)*(sqrt(alpha^2+k^2)+k)) end proc

(1)

K := proc (x, t) options operator, arrow; Int(2*f(v)*cos(x*v)*cos(t*v)/Pi, v = 0 .. A) end proc

proc (x, t) options operator, arrow; Int(2*f(v)*cos(x*v)*cos(t*v)/Pi, v = 0 .. A) end proc

(2)

EQ := h(x) = 4/(Pi*alpha^2)-(Int(h(t)*K(x, t), t = 0 .. 1))

h(x) = 4/Pi-(Int(h(t)*(Int(2*(1-2*v^2/((v^2+1)^(1/2)*((v^2+1)^(1/2)+v)))*cos(x*v)*cos(t*v)/Pi, v = 0 .. 1)), t = 0 .. 1))

(3)

HT := intsolve(EQ, h(x), method = Neumann, order = 1)

h(x) = 4*(Int(Int(-2*(-v^2+1+(v^2+1)^(1/2)*v)*cos(x*v)*cos(_k1*v)/((v^2+1)^(1/2)*((v^2+1)^(1/2)+v)), v = 0 .. 1), _k1 = 0 .. 1)+Pi)/Pi^2

(4)

help("intsolve # See Maple Help for more information.")

(1/4)*D/(Pi*mu*U[0]) = int(rhs(HT), x = 0 .. 1, numeric)

(1/4)*D/(Pi*mu*U[0]) = .7334429187

(5)

NULL


 

Download _Fredholm_integral.mw

_Fredholm_integral_2ver.mw

Only for k=1,4,5,6,7 is real solution.


 

restart

sol := allvalues(solve(10*c*x^7-6*x^3+6 = 0, x))

RootOf(5*_Z^7*c-3*_Z^3+3, index = 1), RootOf(5*_Z^7*c-3*_Z^3+3, index = 2), RootOf(5*_Z^7*c-3*_Z^3+3, index = 3), RootOf(5*_Z^7*c-3*_Z^3+3, index = 4), RootOf(5*_Z^7*c-3*_Z^3+3, index = 5), RootOf(5*_Z^7*c-3*_Z^3+3, index = 6), RootOf(5*_Z^7*c-3*_Z^3+3, index = 7)

(1)

Matrix([seq([series(sol[k], c = 0, 5)], k = 1 .. 7)])

Matrix([seq([convert(series(sol[k], c = 0, 5), polynom)], k = 1 .. 7)])

Matrix([[1+(5/9)*c+(50/27)*c^2+(19000/2187)*c^3+(934375/19683)*c^4], [-1/2+((1/2)*I)*3^(1/2)-(5/9)*(-1+I*3^(1/2))*c/(I*3^(1/2)+1)+(50/27)*c^2-(38000/2187)*c^3/(I*3^(1/2)+1)+(1868750/19683)*c^4/(-1+I*3^(1/2))], [-1/2-((1/2)*I)*3^(1/2)-(5/9)*(I*3^(1/2)+1)*c/(-1+I*3^(1/2))+(50/27)*c^2+(38000/2187)*c^3/(-1+I*3^(1/2))-(1868750/19683)*c^4/(I*3^(1/2)+1)], [1+(5/9)*c+(50/27)*c^2+(19000/2187)*c^3+(934375/19683)*c^4], [1+(5/9)*c+(50/27)*c^2+(19000/2187)*c^3+(934375/19683)*c^4], [1+(5/9)*c+(50/27)*c^2+(19000/2187)*c^3+(934375/19683)*c^4], [1+(5/9)*c+(50/27)*c^2+(19000/2187)*c^3+(934375/19683)*c^4]])

(2)

``


 

Download sol.mw

 

solve(15-(1/100)*m = 5+(1/600)*m, {m})
#{m = 6000/7}

solve(15-1/(100*m) = 5+1/(600*m), {m})
#{m = 7/6000}

Regards,Mariusz

Please read in Maple Help (Ctrl+F1 and put "How Do I,Solve an Ordinary Differential Equation?" in Search->Enter):

Scroll down to:

      -Solving an ODE Numerically

      - Taking Derivatives and Integrals of Numeric Solutions

      -  Why You Should Not Use Int or Diff on a Numeric Solution 

 

Corrected file:question-vers_2.mw

(Edited: 2 times) :P

    
 


 

restart

with(Student[Calculus1])

solve([-(1.25*y-sqrt(abs(x)))*abs(1, x)/sqrt(abs(x))+2*x, 3.1250*y-2.50*sqrt(abs(x))], [x, y])

[]

(1)

solX := solve(((125*(1/100))*y-sqrt(abs(x)))^2+x^2-1 = 0, {y})

{y = (4/5)*abs(x)^(1/2)+(4/5)*(-x^2+1)^(1/2)}, {y = (4/5)*abs(x)^(1/2)-(4/5)*(-x^2+1)^(1/2)}

(2)

c1 := CriticalPoints(rhs(solX[1, 1]), x)

[-1, -(1/12)*((215+12*321^(1/2))^(2/3)-(215+12*321^(1/2))^(1/3)+1)/(215+12*321^(1/2))^(1/3), 0, (1/12)*((215+12*321^(1/2))^(2/3)-(215+12*321^(1/2))^(1/3)+1)/(215+12*321^(1/2))^(1/3), 1]

(3)

evalf(c1)

[-1., -.5566930951, 0., .5566930951, 1.]

(4)

point1 := evalf(subs(x = 1, rhs(solX[1, 1])))

.8000000000

(5)

point2 := evalf(subs(x = 0, rhs(solX[2, 1])))

-.8000000000

(6)

point3 := evalf(subs(x = -.5566930951, rhs(solX[1, 1])))

1.261469543

(7)

c2 := CriticalPoints(rhs(solX[2, 1]), x)

[-1, 0, 1]

(8)

with(plots); p1 := pointplot([[evalf(c1)[2], point3], [evalf(c1)[4], point3], [0, point2], [0, point1]], color = [green], symbol = circle, axes = none, symbolsize = 15); p2 := implicitplot(((125*(1/100))*y-sqrt(abs(x)))^2+x^2-1, x = -1 .. 1, y = -1 .. 1.3, axes = normal, gridrefine = 3); display({p1, p2})

 

``


 

Download Critical_Points.mw

sol := n > ceil(evalf(solve(product(exp(1/i), i = 1 .. n) = 100, n))); solve(sol, n);

# sol := 56 < n

# RealRange(Open(56), infinity)

Calculating point with newton method:

restart;
with(Student[NumericalAnalysis]):
with(plots):
f := x^3-x^2-x-1;
P := Newton(f, x = 2.0, tolerance = 10^(-2));
p1 := pointplot([[P, 0]], color = [blue], symbolsize = 20, symbol = circle, axes = normal):
p2 := plot(f, x = 0 .. 2.2):
display({p1, p2});

 

First iteration:   

evalf(eval(simplify(x-f/(diff(f, x))), x = 2));
# 1.857142857

 

Hi

I'm only changed "Equation" to "2*M" , "Solu" to "Solu[1]" and other things.

Regards Mariusz.

Help_v2.mw

 

 I'm not an expert on that topic.

With help from: https://www.maplesoft.com/applications/view.aspx?sid=4971  (See: A Numeric Approach).

 

restart;
f := proc (u) options operator, arrow; piecewise(0 <= u and u <= 1, 0, 1 < u and u <= 2, 1) end proc;
ode := diff(y(u), u$2) = 4*Pi^2*(f(u)-e)*y(u); bc := y(0) = 0, y(2) = 0, (D(y))(0) = 1;
Eigen1 := (dsolve({bc, ode}, numeric, range = 0 .. 2, maxmesh = 8192, abserr = 1.*10^(-3), approxsoln = [y(u) = exp(-u), e = 1]))(0)[4];
Eigen2 := (dsolve({bc, ode}, numeric, range = 0 .. 2, maxmesh = 8192, abserr = 1.*10^(-3), approxsoln = [y(u) = u, e = 3]))(0)[4];
Eigen3 := (dsolve({bc, ode}, numeric, range = 0 .. 2, maxmesh = 8192, abserr = 1.*10^(-3), approxsoln = [y(u) = u, e = 6]))(0)[4];

In Maple there is not much choice how to do it.

One of the possibilities is textplot.

with(plots):
p1 := pointplot([[3, 8], [-5, 16], [11, 32], [3, -8]], color = [black], symbol = solidbox, axes = none, symbolsize = 12): 
p2 := textplot({[-5, 16+2, "lampart"], [3, (-8)-2, "dog"], [3, 8+3, "cat"], [11, 32+4, "panthera"]}, axes = none):
p3 := implicitplot(y^2 = x^3-43*x+166, x = -40 .. 40, y = -40 .. 40, axes = normal, gridrefine = 2): 
display({p1, p2, p3})

First 15 16 17 18 19 20 Page 17 of 20