Mariusz Iwaniuk

1019 Reputation

14 Badges

4 years, 268 days

Social Networks and Content at Maplesoft.com

MaplePrimes Activity


These are replies submitted by Mariusz Iwaniuk

@panke

I edited my answer and works as it should.

@Preben Alsholm 

Reading this paper on page 87 says better is Trapezoidal rule.


 

restart

intsolve(y(x) = x+Int((x-t)*y(t), t = 0 .. x), y(x))

y(x) = (1/2)*exp(x)-(1/2)*exp(-x)

(1)

convert(y(x) = (1/2)*exp(x)-(1/2)*exp(-x), trigh)

y(x) = sinh(x)

(2)

restart

func := proc (x, n) x+evalf[5](Int((x-t)*(('ifunc')(n-1))(t), t = 0 .. x, method = _d01ajc)) end proc; func(x, 0) := x

N := 0.5e-2

0.5e-2

(3)

Terms := 5

5

(4)

ifunc := proc (j) option remember; Interpolation:-Interpolate([seq(x, x = -3 .. 3, N)], [seq(func(x, j), x = -3 .. 3, N)], method = cubic) end proc; ifunc(0) := proc (x) options operator, arrow; x end proc

plot(sinh(x)-(ifunc(Terms))(x), x = -3 .. 3)

 

``


 

Download Volterra_integral_equation_ver2.mw

@isifesai 

I speed up computations by numeric integration.Code still requires polishing(Speed up).


 

restart

EQ := y(x) = a*(k*x+1)+b*x-k*(Int((x-t)*y(t), t = 0 .. x))+2*(Int(sqrt(x-t)*y(t)^3, t = 0 .. x))/sqrt(Pi)

y(x) = a*(k*x+1)+b*x-k*(Int((x-t)*y(t), t = 0 .. x))+2*(Int((x-t)^(1/2)*y(t)^3, t = 0 .. x))/Pi^(1/2)

(1)

restart

kernelopts(floatPi = true)

a := 0; b := 1; k := 1; A := 0; B := 3

0

 

1

 

1

 

0

 

3

(2)

ifunc := proc (j) local func; option remember; func := proc (x, n) option remember; a*(k*x+1)+b*x-k*evalf[5](Int((x-t)*(('ifunc')(n-1))(t), t = 0 .. x, method = _d01ajc))+2*evalf[5](Int(Re(sqrt(x-t)*(('ifunc')(n-1))(t)^3), t = 0 .. x, method = _d01ajc))/sqrt(Pi) end proc; func(x, 0) := a*(k*x+1)+b*x; Interpolation:-Interpolate([seq(x, x = A .. B, 0.1e-1)], [seq(func(x, j), x = A .. B, 0.1e-1)], method = cubic) end proc; ifunc(0) := proc (x) options operator, arrow; a*(k*x+1)+b*x end proc

plot([seq((ifunc(j))(x), j = 1 .. 5)], x = A .. B, view = [A .. B, 0 .. 10])

 

plot((ifunc(5))(x), x = A .. B, view = [A .. B, 0 .. 10])

 

``


 

Download Integro-Eq_Ver_2A.mw

Works only in Maple 2018 and above.

@mmcdara 

I find a way to solve my problem.

Thank you for your contribution.


 

restart

intsolve(y(x) = x+Int((x-t)*y(t), t = 0 .. x), y(x))

y(x) = (1/2)*exp(x)-(1/2)*exp(-x)

(1)

convert(y(x) = (1/2)*exp(x)-(1/2)*exp(-x), trigh)

y(x) = sinh(x)

(2)

restart

func := proc (x, n) x+evalf[5](Int((x-t)*(('ifunc')(n-1))(t), t = 0 .. x, method = _d01ajc)) end proc; func(x, 0) := x

ifunc := proc (j) option remember; Interpolation:-Interpolate([seq(x, x = -3 .. 3, .2)], [seq(func(x, j), x = -3 .. 3, .2)], method = cubic) end proc; ifunc(0) := proc (x) options operator, arrow; x end proc

plot([sinh(x), (ifunc(5))(x)], x = -3 .. 3, linestyle = [3, 4], color = ["Red", "Green"])

 

``


 

Download Volterra_integral_equation.mw

@mmcdara 

Did you read my comments,I need solution with int(numeric) ,not int(symbolic) that I want  CurveFitting for that.

I do not want to wait for computation time an eternity.

Above MMA code give me solution, about a few second.

Thanks anyway.

Volterra2bis_ver2.mw

 

@sand15 

For func(x,7) it should be :x + x^3/6 + x^5/120 + x^7/5040

for n=7 it should be almost the same as sinh(x).

@sand15 

Thanks you for your efforts,but:

1.At first I need int(numeric),because I have  more complicated example and Int(symbolic) can't solve or is very slow.See

2.it does not matter if I use: Interpolation or CurveFitting.

3.Your answer dosen't work for me.("Problem is this method seems to diverge",Why ? I dosen't know)

Maybe exist a workaround and no need to convert code from MMA to Maple.

MMA solution with more complicated example:

 

@vv 

Maple's Sum have troubles, at t=1/10, workaround is:

Let's says for: t=3/100.

1/exp(2.)-evalhf(add(eval(2^(-j)*t^(-2*j)*GAMMA(-2*j+1, 1)*exp(-1)/factorial(j), t = 3/100), j = 0 .. 1000));

#-2.296937672*10^237

int(eval(exp(-1-1/v)*(1-exp(v^2/(2*t^2)))/v^2, t = 3/100), v = 0 .. 1, numeric);

#-2.296937672*10^237

,but for  t=2/100 or near t=0  gives: Float(-infinity) :P

 

Who needs such large numbers?

@weidade37211 

 

I did some tests and you can see Maple 2017.3 have bad performace and baheves incorrectly. 

 

 

@isifesai 

This has nothing to do with the first question.

Please post a new question.

@isifesai 

You can try Mathematica for free online(free plan),only you must sign-in to:https://www.wolframcloud.com

Maplesoft it does not give you that option yet.

@isifesai 

With MMA we can find solution with series and it easy to do: 

n = 5;
yrule = y -> Function[x, Sum[a[j] x^j, {j, 0, n}] + O[x, 0]^(n + 1)];
eq = y'[x] - (Exp[x] + 2/9*Exp[3] - 1/9 + Integrate[s *y[s]^3, {s, 0, 1}]) == 0 /. yrule // Simplify;
le = LogicalExpand[eq];
sol = Solve[le && (y[x] /. yrule /. x -> 0) == 1,Table[a[i], {i, 0, n}]];(*with the initial conditions y[0]\[Equal]1*)
Ysol[x_] = y[x] /. yrule /. First@sol // Normal // N

(* 1. - 5.59113 x + 0.5 x^2 + 0.166667 x^3 + 0.0416667 x^4 + 0.00833333 x^5 *)

Plot[Ysol[x], {x, -1, 1}]

I could translate MMA code to Maple code,but in Maple there is no equivalent to LogicalExpand function ,and this translation(LogicalExpand to Maple) is not my strength.

@Preben Alsholm 

When we expect the release of Maple 2018.2 ?

@vv 

Ohh my mistake ,You are right.

MMA code:

NIntegrate[(-\[Pi]^4 8 - 20 Log[x]^2*Pi^4 - 5 Log[x]^4*Pi^4 + 
  120 MeijerG[{{0, 0}, {1, 1, 1}}, {{0, 0, 0, 0, 0}, {}}, x, 
    1/\[Pi]])/(120 \[Pi]^4 (-1 + x)^2), {x, 4/10, 6/10}, 
 PrecisionGoal -> 25, AccuracyGoal -> 25, WorkingPrecision -> 50]

-0.0055516876936075055264305911679233087260653869140529

 

Thanks.

First 7 8 9 10 11 12 13 Last Page 9 of 24