Maple 17 Questions and Posts

These are Posts and Questions associated with the product, Maple 17

Hi, I installed Maple 17 a while back and was able to work all the commands but recently I reinstalled it
I tried a command which gave me an error that I never got before

>rightsum:=RiemannSum(1/x^2,x=50..75,partition=25,method=right,output=plot);


Error, (in Student:-Calculus1:-RiemannSum) external linking: error loading external library statshw.dll: The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail.

When I tried to reinstall the only issue was that it had trouble installing Visual C++ 2005 redistribute however I already have it on my computer and I don't intend to uninstall it since it took a long time to actually get my other programs to have it working. Is there anyhting I can do to fix this error? (Plotting other stuff seems to work fine except for Riemann Sums)

Hi there,

I'm trying to simulate an stochastic SIR model following the Gillespie algorithm, as described here [1].

 

When trying to update each process' probabilities, it looks like Maple is not updating their values. Although each element of the lists S, I and R is updated the ai lists are not updated.

For example, for a given index i

a2[i]:= m*S[i]:

takes the same value for every i, regardless of the value of S[i].

Can anybody tell why this is happening or what's wrong with the worksheet? This is the attempt: MaplePrimes_SIR_model_simulation_Gillespie_algorithm.mw

 

On the other hand, I tried making things more clear through a couple of procedures. However, when it comes to the point where a random number with an exponential distirbution is computed:

Rexp := RandomVariable(Exponential(mu)):

it looks like Maple is unable to evaluate mu. But having a look at the Variables explorer, it has a defined value, indeed.

So what's wrong in the worksheet? Thi is the attempt: MaplePrimes_SIR_model_simulation_Gillespie_algorithm.mw

 

Thanks,

jon

[1] http://www.biosym.uzh.ch/modules/models/ETHZ/StochasticSimulation/sir_stoch.xhtml

Hi, all

I use INT to calculate multiple integration as below. It runs more than 20 hours without results. I wander is there any problem in my codes.

restart;
A := sin(k*Pi*(x-h*cos(theta))/a)*sin(l*Pi*(y-h*sin(theta))/b)*sin(k[0]*h)*sin(k*Pi*x/a)*sin(l*Pi*y/b);

W := evalf[5](int(int(int(int(A, h = 0 .. (x-a)/cos(theta)), theta = Pi+arctan((b-y)/(a-x)) .. 3*Pi*(1/2)), x = 0 .. a), y = 0 .. b, numeric))

 

Thanks

I am trying to define a new typt and I am beating my head against the wall...

What I have working:

TypeTools:-AddType(Element,'record(l,R)');
 
This defines a type which I can then use in type(xpr,Element) to be false or true depending on whether xpr is a record containing (at least) entries l and R or not.

Now I want to define a type ExpandedLine that is a Vector of Element (Element in the sense above). In fact, in the context of my application I am willing to settle for ExpandedLine being a Vector of record.

Tried various approaches (and making sure Vector is in uneval quotes in the AddType statement) like:

TypeTools:-AddType(ExpandedLine,'Vector'(record));

and variations but no luck.

Any help is appreciated.

Mac Dude

 

Hello everyone,

I have nonlinear partial differential equations (see the attached file) need to be solved:

https://drive.google.com/file/d/0B14...ew?usp=sharing

With initial condition: h(x, y) = K1 (constant), dh/dx = K2 (constant); dh/dy = K3 (constant); And h(x,y) is function of (x,y) other factors are constant. Could anyone tell me how to solve these equations by using numerical method? Do you know any library in c/ c++ language that can solve these equations??

I have tried with Maple 17 and the response is: "Error, (in pdsolve/info) first argument is not a differential equation". Whole of my input:

 

with(PDEtools); declare(U1(x, y), U2(x, y), U3(x, y));

PDEs = [diff(U1(x, y), y) = U2(x, y),

diff(U1(x, y), x) = U3(x, y),

(diff(U2(x, y), y))*((L-U1(x, y))^2+(D2+tan(alpha)*(L+U1(x, y)))^2)+.5*U2(x, y)*(2*tan(alpha)*U1(x, y)-D2) = 0,

(diff(U3(x, y), x))*((L-U1(x, y))^2+D1^2*cos(alpha+2*U2(x, y))^2)+.5*U3(x, y)*D1*cos(alpha+2*U2(x, y))+.5*D1*sin(alpha+2*U2(x, y))*(L-U1(x, y)) = 0];

 

[ d d / d
PDEs = [--- U1(x, y) = U2(x, y), --- U1(x, y) = U3(x, y), |--- U2(
[ dy dx \ dy

\ / 2 2\
x, y)| \(L - U1(x, y)) + (D2 + tan(alpha) (L + U1(x, y))) /
/

/ d
+ 0.5 U2(x, y) (2 tan(alpha) U1(x, y) - D2) = 0, |--- U3(x, y)
\ dx

\ / 2 2 2\
| \(L - U1(x, y)) + D1 cos(alpha + 2 U2(x, y)) /
/

+ 0.5 U3(x, y) D1 cos(alpha + 2 U2(x, y))

]
+ 0.5 D1 sin(alpha + 2 U2(x, y)) (L - U1(x, y)) = 0]
]

pdsolve(PDEs);
Error, (in pdsolve/info) first argument is not a differential equation

 


I will be very appreciated with your help!!!

Hi all.

I try to get the real part from the complex expression. But it turns out to not be the simplest result:

A:=I*sin(k*Pi*(x-h*cos(theta))/a)*sin(l*Pi*(y-h*sin(theta))/b)*exp(-I*k[0]*h)*sin(k*Pi*x/a)*sin(l*Pi*y/b)

convert(exp(-I*k[0]*h), sin);

simplify(Re(A));

Maple results in:

Re(sin(k*Pi*(-x+h*cos(theta))/a)*sin(l*Pi*(-y+h*sin(theta))/b)*exp(-I*k[0]*h)*sin(k*Pi*x/a)*sin(l*Pi*y/b))

while the simplified result should be:

sin(k*Pi*(x-h*cos(theta))/a)*sin(l*Pi*(y-h*sin(theta))/b)*sin(k*Pi*x/a)*sin(l*Pi*y/b)*sin(k[0]*h)

 

I wander how to get the simplifyed result in maple. Thanks

How can one use maple to linearized nonlinear ODE of this type Linearize.mw

with maple.

Best regards.

 

hi...plese help me

:

how i can solve set of non linear differential equation with a unknown parameter with numeric role in maple software??

thank a lot ...

Hi there,

I am trying to simulate the behaviour of an equation in the continuous domain for two different populations given a set of parameters.

The equations reads:

S(t) = exp(-alpha·D(t)-beta·G·D^2(t))

where alpha and beta are known (and are different for two populations of cells), and G may be:

Case 1: G=1

Case 2: G = (D1^2+D2^2+2*D1*D2*exp(-lambda*T))/D^2 (where D1=D/3; D2=2·D/3; and lambda is also known)

 

For the Case 1, I need to simulate for different values of D. Even if for the purposes of this case, D(t) = D0 (a constant); I would like to know how I would do it for a time-dependent D, for example,  D(t) = D0·t, with a varying D0, for example in the range [1..8].

For the Case 2, I need to simulate under different values of T (for example in the range [1..8]), letting D be a constant, known value. In this case, D(t) is a piecewise function:

D(t) =
= D/3 if t=0

= 2·D/3 if t=T
= 0 for any other t

I really don't know how to write the expression for S(t) in this case.

 

I guess I need an array to store as many instances of S as numbers of parameters I have (8 values for D0 int he first case, and another eight for T).

And besides, it needs to be a function of t (even if in the first case, it is not; I'd like to simulate as if it were).

 

So I am at a loss when it comes to writing the expressions of S(t), and having it evaluated (and its values plot in the same graph using a palette for differente parameter values) for say, t=0..100.

 

Attached is my attempt: Mapleprimes_LQ_model_simulation.mw

 

Any ideas?

Thanks,

jon

Hi there,

I've got the following differential equation system:,

dU/dt = delta·dotD -lambda·U - kappa·U^2
dL/dt = (1-phi)·lambda·U + 1/4 ·kappa·U^2


being phi, delta, kappa, lambda, kappa some fixed parameters of the system, and where dotD (the derivative wrt time of a function D), which is defined a piecewise funtion:

dotD(t)=1/(3·T1)·DT for t in [0,T1]

dotD(t)=2/(3·(T2-T1-T))·DT for t in [T1+T,T2]

where T and DT are also known, and T1 approaches 0, and T2 approaches T1+T.

Setting the equation system in Maple and trying to solve it, gives a NULL result. However, trying to solve each piece separately seems to work fine.

Why is this?

 

Furthermore, taking limits for the [T1+T,T2] part (having solved each piece separately) yields an invalid limits point error. Ain't the possibility to take limits for both parameters at the same time?

Any ideas?

 

This is the Maple worksheet: MaplePrimes_LQ_model_solve.mw

Thank you.

jon

Hi there,

I am trying to maximize a function given a set of values to a parameter in the function. The function is an differential equation belonging to a system of two differential equations.

I have a for loop to state different values to the parameter.

Maple yields the error:

Error, (in Optimization:-NLPSolve) cannot evaluate the solution further right of 0.17757507e-4, probably a singularity

When trying to maximize the function.

Supposed that I was doing something wrong in the loop, if I reproduce the contents of the loop outside, and set a value for the parameter. If I plot the solution of the ordinary differential equation, I can see where the maximum lies.

Having plot it, the Optimizamtion:-Maximize works as expected.

However, omitting the plot has a weird effect: I only get the same result depending on the bounds I set for the Maximization:

de1 := diff(A(t), t) = r*m*(1-g)*A(t)-piecewise(t < 8, r*A(t), t >= 8, (r+k)*A(t));
de2 := diff(G(t), t) = r*m*g*A(t)-l*G(t);

ics := A(0) = 25.0, G(0) = 0.;
num := dsolve({de1, de2, ics}, {A(t), G(t)}, type = numeric, output = listprocedure, parameters = [g]);

num(parameters = [g = .15]);
val := eval(G(t), num);

# odeplot(val, [t, G(t)], t = 0 .. 100);


Maximize(val);
Error, (in Optimization:-NLPSolve) cannot evaluate the solution further right of 0.17757507e-4, probably a singularity

val2 := Maximize(val);

Error, (in Optimization:-NLPSolve) cannot evaluate the solution further right of 0.17757507e-4, probably a singularity

val3 := Maximize(val(t), t = 0 .. 60);

  [10267.824035766165, [t = 8.25727747134303]]

val4 := Maximize(val(t), t = 0 .. 100);

[6.863211343195069e-9, [t = 59.84184367042171]]

 

The right answer is [10267.824035766165, [t = 8.25727747134303]]: Why do I get two different answers even if in that range there is only one relative maximum?

I ignore whether the way I am specifying the arguments for the Maximize function is correct. val is a procedure.

 

What am I missing?

Attached is the worksheet: MaplePrimes_malaria_param_variation_2.mw

 

Thanks,

jon

Good day everyone, could you please help use Gauss Elimination method for these system of equations. See the worksheet here F1.mw

Thanks.

Hi all,

I'm currently writing a code to solve the equations for a gravitational collapse of a star numerically. I'm using two dimensional Arrays for most of the physical quantities in my finite difference equations, with one index for the spatial dimension (I'm only considering spherically symmetric collapses) and one time index. I wrote two nested loops, where the inner one solves the equations from the centre of the star to the surface (with the exception of one quantitiy, where I have to integrate the other way around) and the outer loop advances the Arrays in time. My problem is, that Maple doesn't seems to evaluate the two dimensional Arrays. Instead for inserting the appropriate value for e.g. A[3,2], Maple just keeps on using A[3,2] which messes up some formulas, since I have to take roots of the numbers. At least that is what seems to be going on when I'm trying to debug the relevant part of the code and I check for the values, with whicih Maple calculates. I'm also using a one dimensional Array to store the timesteps, I'm using in the code and Maple doesn't seem to have problems evaluating them. Is anybody familiar with this problem? Does Maple have trouble with multidimensional Arrays in loops or have I just messed up my code? I have uploaded my code (I hope it worked). I apologize for my code being messy, but it's the first time I'm working with Maple and using numerical methods. The part which troubles me is labeled "# actual code".

Thank you all.

Oppenheimer-Snyder_Maple_3.mw


Hi there,

I would like to use Maple to solve a couple of integrals.

My attempt seems to have some errors, since even if the integral expressions are rendered correctly, they are  not being solved. They shouldn't need numeric methods to be solved.

The integrals are the following:
G1 := int(e^((lambda-k)*s-e^(-k*s)), s = -infinity..t);
G := int(e^(-(lambda+k)*t-e^(-k*t))*G1, t = -infinity..infinity);

Thus:

and

 


And attached is the unsuccessful attempt: MaplePrimes_Lea-Catcheside.mw

Thanks,
jon


Hi there,
I have a set of differential equations whose solution, Jacobian matrix and its eigenvalues, direction field, phase portrait and nullclines, need to be computed.

Each of the equations has a varying parameter.

I know how to get the above for a single parameter value, but when I set a range of values for the parameters, Maple is not able to handle all cases as I would expect: solving the differential equation system:

eq1 := x*(1.6*(1-(1/100)*x)-phi*y)
eq2 := (x/(15+x)-0.3e-1*x-.4)*y+.6+theta
desys := [eq1, eq2];
vars := [x, y];
steadyStates := map2(eval, vars, [solve(desys)])

already yields an error:
Error, (in unknown) invalid input: Utilities:-SetEquations expects its 2nd argument, equations, to be of type set({boolean, algebraic, relation}), but received {-600*y+(Array(1..2, {(1) = 8400, (2) = 15900})), Array(1..5, {(1) = 0, (2) = 0, (3) = 0, (4) = 0, (5) = 0})}


The equations are the following:
de1 := diff(x(t), t) = x(t)*(1.6*(1-(1/100)*x(t))-phi*y(t));
de2 := diff(y(t), t) = (x(t)/(15+x(t))-0.3e-1*x(t)-.4)*y(t)+.6+theta

the parameters being:
phi:=[0 0.5 1 1.5 2]
theta:=[5. 10.]

How can I handle the situation so that Maple computes each of the above for each combination of the parameters?

I would like to avoid using two for loops and having to store all results in increasingly bigger and complicated arrays.

The worksheet at issue is this: MaplePrimes_Tumour_model_phi_theta_variation.mw


Thanks,
jon

First 27 28 29 30 31 32 33 Last Page 29 of 61