Items tagged with numerical


Hello i need a tutor to help me with  Numerical analysis on Maple and the programming part. Im In UAE but we can do this online as well


I am working with numerical function with two indices, such as f[i,j], where i,j run over 1 to N, where N is n integer number.

The resluts stored in vector colummn for each value of j. i.e.

for each j=1,     G1:=Vector[column](N,i-->f(i,1))

for each j=2,     G2:=Vector[column](N,i-->f(i,2))

and so on.

The procedure is working for the first value j=1.

for the second value the following message appear

{--> enter Terminate, args = 
{--> enter Terminate, args = 
<-- exit Terminate (now in Terminate) = }
<-- exit Terminate (now at top level) = }

Hi, i try resolve this equations numerical for the boundary between the spinglass and ferromagnetic phases:






Hello! Hope everything fine with you. I am try to solve the three-point differential by numerical method in attached file but failed. Please see the attachement and solve my problem. I am very thankful your kind effort. Please take care.

With my best regards and sincerely.

Muhammad Usman

School of Mathematical Sciences 
Peking University, Beijing, China

G := 6.6743*10^(-8);

a := 1.9501*10^24;

b := .3306;

c := 2.99792458*10^10;

d := 2.035;

pi := 3.143;

eps := 3.8220*10^35;

g(r) = 1-s(r)/0.06123;

j(r) = e^(-(1/2)*w(r))*(1-2*G*v(r)/(r*c^2))^.5

sys := diff(v(r), r) = 4*pi*r^2*eps/c^2, ics=v(0)=0

diff(u(r), r) = -G*(eps+u(r))*(v(r)+4*Pi*r^3*u(r)/c^2)/(c^2*(r^2-2*G*r*v(r)/c^2)),u(0)=1.3668*10^34

diff(w(r), r) = 1.485232054*10^(-28)*(v(r)+4.450600224*10^(-21)*pi*r^3*u(r))/(r^2-2*G*r*v(r)/c^2), conditions: w(0)=0,iterate it to find w(688240)=-2.05684, it solve must satistfy the both conditions.

diff(r^4*j(r)*(diff(g(r), r)), r)+4*r^3*g(r)*(diff(j(r), r)) = 0, conditions dg(r)/dr =0  at r=0, g(688240) =0.87214

diff(J(r), r) = (8*pi*(1/3))*(eps/c^2+u(r)/c^2)*(g(r)*j(r).(r^4))/(1-2*G*v(r)/(r*c^2)) condition J(0)=0.

I try to solve numerically a boundary VP for ODE with different order of discontinuity of right part.

Say, the following BVP is given:


y(0)=1, y(2)=1

Let's use piecewise right part

F  := piecewise(x<=1, -x, x>1, 2*x+(x-1)^2)

plot(piecewise(x<=1, -x, x>1, 2*x+(x-1)^2), x=0..2,thickness=5)

The function

piecewise(x<=1, 1-x, x>1, (x-1)^2)

plot(piecewise(x<=1, 1-x, x>1, (x-1)^2), x=0..2, color=blue,thickness=5)

as obviuos, satisfies the BVP exclung the point x=1, where its 1st and 2nd derivatives are discontinuos.

Numerical solution

As:=dsolve([diff(y(x), x$2)+diff(y(x), x)+y(x)=F,  y(0)=1, y(2)=1], y(x), type=numeric, output = Array([seq(2.0*k/N0, k=0..N0)]), 'maxmesh'=500, 'abserr'=1e-3):

provides the solution essentially different to exact one described above:

But if to use the right part

F := piecewise(x<=1, x^2+x+2, x>1, -x^2+x)

plot(piecewise(x<=1, x^2+x+2, x>1, -x^2+x), x=0..2, color=blue,thickness=5)

for which the function

piecewise(x<=1, 1-x+x^2, x>1, -1+3*x-x^2)

plot(piecewise(x<=1, 1-x+x^2, x>1, -1+3*x-x^2), x=0..2, thickness=5)

satisfies the BVP excluding x=1, where this function has discontinuity of 2nd derivative only, the corresponding numerical solution is very similar to this exact solution:

This reason of the difference between these two cases is clear. In the first case both 1st and 2nd derivatives are discontiuos, while in the second one -- 1st derivative is contiuos.

I wonder, if there are numerical methods, implemeted in Maple, for numerical solution of the first type BVP with non-smooth right part?

Please help me to solve the system of 1st order singular O.D.E  (see uploaded file)....New_Microsoft_Office_Word_Document.docx


I have to solve numerical trogonometric equations such as :

But, after, I would like to keep only the solution defined in a specific interval such as : [0,Pi]

1) Is there a possibility to define options with the function solve to limit the solutions belonging to a specific interval ?

2) Otherwise, may you help me to make an systematic process to choose a solution in a specific interval ?

Thank you for your help


I am trying to solve a matrix system to find the relative arrival rates of a queueing network using Gauss-Seidel.The maple commands are below:

with(Student[NumericalAnalysis]); with(LinearAlgebra);

A := Matrix([[1, -.333, -.333, -.333], [0, 1, -.333, -.333], [0, -.333, 1, -.333], [0, -.333, -.333, 1]]);

IsDefinite(A, 'query' = 'positive_semidefinite');


b := Vector([1, 1, 1, 1]);

IterativeApproximate(A, initialapprox = Vector([1, 1, 1, 1]), tolerance = 10^(-3), maxiterations = 20, stoppingcriterion = relative(infinity), method = gaussseidel);

Error, (in Student:-NumericalAnalysis:-IterativeApproximate) check that the augmented matrix has the correct dimensions

I do not understand this error as the matrix is 4x4 as shown. Can anyone see where I went wrong?


Hello Mapleprime users

I am having an issue with a numerical integration calculation. I have a large(ish) polynomial integrand and need to apply two integrations which I am using the _cuhre method for. See attached the minimum working example file.

Firstly some simplifications are done to the integrand and then a basic for loop which calculates the integration for r from 0 to 20 in steps of 0.1. The issue occurs when the loop hits r~2.5 (on my machine, Maple 2015, i5, 16GB ram). Up to that point the calculation is steady with the following stats per point calculated:

memory used=87.59MiB, alloc change=0 bytes, cpu time=3.45s, real time=3.15s, gc time=439.16ms

Then when the calculation gets to ~2.5 it just hangs and will not calculate past it. Any ideas as to what is going on here?

Any help would be appreciated with this issue.

Thank you in advance




Hi, Maple community

I am trying to integrate a 3D data numerical set. I managed to execute an array interpolation algorithm and apply it to plot a smooth surface but I do not know how to integrate it numerically. I want to be able to integrate the data not only in its domain but also in sub-domains for multiple purposes.

I've found here a topic about it and tried to apply suggestions made with no success.

Here I copy the worksheet steps:


Initial Parameters

Nx:=8;    Points in the x direction
Nz:=6;    Points in the z direction
Lx:=3;    This means x goes from 0 to 3
Lz:=2;    This means z goes from 0 to 2

DataPn:=Matrix(Nx,Nz,0):         Matrix to store values in the 3rd direction

The following step is a function that I used to simulate data that I will later on will get by measurings.

for i from 1 to Nx do
 for j from 1 to Nz do
 end do;
end do;

Setting data to use ArrayInterpolation


In this step here, I don't really understand what this argument [[a],[b]] means but ArrayInterpolation cannot work without it.

MI:=(a,b)->ArrayInterpolation([datax, dataz],Array(DataPn),[[a],[b]],'method' = 'spline')[1,1];

Plot and display the interpolation and the real function to compare the quality of the interpolation, actually it does an excellent job, at least with this data.

G1:=plot3d(MI, datax[1]..datax[Nx], dataz[1]..dataz[Nz],labels=[x,z,Pn]);

And finally I found this integration method here in mapleprimes

evalf(Int(x->evalf(Int( y->MI(x,y), 0..3,method=_d01akc)),0..2,method=_d01akc));

And the result is 1.102279199. I thought maybe I was setting wrongly the integration limits or the order in the command but in any case the result was near the analytic case which was:



In this scenario I know the result is wrong because I can compute the exact solution, but later on I won't be able to do so. Also, later I'm interested in the integration, let's say, x from 0..0.5 and later from 0.5..1 and so on (keeping z always from 0 to 2) So, the main questions are:

1. Am I setting something wrong?
2. If I delete the method option in the integral, it takes a lot of time for the program to compute any result. Why?
3. Is there any other way to integrate this? I mean, any other way to write the command to compute the integral.
4. What does the [[a],[b]] argument stands for in ArrayInterpolation?

Regards and thanks for your help.

Hello everyone,

I am trying to solve numerically int( f(t,z) , t=0..T ) = 0 , in z for a cumbersome f.

I tried z1=fsolve( int( f(t,z) , t=0..T ) = 0 , z). But then I tried int( f(t,z1) , t=0..T ) and the result is clearly not zero nor anything small.

It looks like Maple evaluates analytically the integral, and does it wrong (check this for more details) so fsolve uses the wrong equations.

Anyone knows how I can force Maple to evaluate numerically the integral at each step of the fsolve function?

Thank you!

I am solving a complicated ODE and I would like to know if there is a way for Maple to output the ODEs without doing any numerical substitutions for known parameters. Say one of my parameters, call it P, is initialized (there are many more but Ill just simplify and consider one here) to a value of 10. In order to chekc that I have coded the ODEs correctly it would help me if Maple does not substitue with the numerical value 10 for P when displayng teh ODEs, but rather keeps P, as a parameter. Is there a way to achieve this?

Hi all,

I'm trying to perform some calculations containing exponential integrals. Here is a snippet of my code:



Es := 4*10^9:


C := (q) -> q^(H+1.5):

G := (q) -> (int(q^3*C(q), q = q[0] .. q)):
P := (q) -> 1/sqrt(G(q)):

p := (xi) -> p[0]/P(xi*q[0]):
w:= (q,xi) -> 1/(Pi*(int(C(qs)*qs^3, qs = xi*q[0] .. q)))^(1/2):

U := (xi) -> (int(q*C(q)*w(q,xi)*(Int(exp(-(w(q, xi)*ps/Es)^2)/ps,ps=p(xi)..infinity)),q=xi*q[0]..q[s])):

My objective is to evaluate U for a set of discrete values of xi for further processing e.g. visualisation via plots. Neither value(U(xi)) nor evalf(U(xi)) produces a numerical result so I keep searching for solution. Does anybody have an advice how to solve U?

Regards, lassa



I wonder how is it possible to numerically evaluate two-dimensional sum, something like this:


1 2 3 4 5 6 7 Last Page 1 of 9