# Items tagged with parameterparameter Tagged Items Feed

### How to solve non-linear ODE numerically...

December 13 2014
2 3

Hi,

I'm trying to solve the following differential equation numerically with dsolve:

but dsolve gives me this error:

> res := dsolve(DGL, numeric, parameters = [y0, A, B, C, E]);
Error, (in DEtools/convertsys) unable to convert to an explicit first-order system

I think the problem is that I use the wrong solver. Does Maple provide a solver which is capable of solving this kind of equations (nonlinear ODE)?

### Parameter estimation with differential equations...

December 03 2014
0 1

Dear all,

I have one quetion. I have written maple code based on Dr.Robert J. Lopez's one.

Here is my code.

> q1 := diff(x(t),t) = -a*x(t)*y(t) + b*z(t);

q2 := diff(y(t),t) = -a*x(t)*y(t) + b*z(t);

q3 := diff(z(t),t) =  a*x(t)*y(t) - b*z(t);

q4:=k(t)=x(t)*y(t)/z(t);

ic := x(0)=10,y(0)=10,z(0)=0;

C := < I put Experimental data….>:

> SS := proc(a,b)

local F, V;

if not type([a,b],['numeric','numeric']) then return 'SS'(a,b);

elif a<0 or b<0 then return 1e100;

end if;

F := dsolve(eval({q1,q2,q3,q4,ic},{:-a=a,:-b=b}),[x(t),y(t),z(t),k(t)],numeric, output=Array([seq(k,k=0..N)]));

V := convert(Column(F[2,1],5),Vector);

Norm(V-C,2);

end proc:

I just put one more equation -eqn4. it is not differential equation.

I currently have error massage from maple. Could you let me know how I solve the equations in this case?

Thanks.

### Non linear system...

November 24 2014
0 2

Dear all;

I need your help to get all the solution of this nonlinear  system  with four parameters: r1, r2, q1, q2  assumed to be positives. Let the system:

the first equation is: r1*x*(1-x/q1)=x*y/(1+x)

the second equation: r2*y*(exp(-y)-q2)=-x*y/(1+x)

How can get the positive solution ( x, y) of the previous system.

### How do I refer to the symbol name passed as argume...

November 17 2014
1 4

Hi experts

In a procedure with no declared parameteres I would like to return (print) the passed arguments (expecting Matrix structures) in a modified form along with the name of the symbol holding the structure passed as arguments.

That is, the procedure just iterates through the _passed arguments in a for-loop to display the name of the the passed argument (the symbol), a colon and then the modified matrix structure.

My problem is that when looping from i to _npassed arguments, refering to _passed[i] gives me the evaluated form.Tat is what I need to modify the structure but not to list the symbol name.

Say I wanted to print a transposed version of my passed matrices. Then I would call

M:=<<1,2>|<3,4>>;

myProc(M);

And the result I want would be

M:

But I don't know if _passed holds the symbol names or just the evaluated versions of the passed arguments??

And theoretically the passed argument (assuming a matrix) could be the matrix structure put directly in the procedure call, in which case there is no symbol to refer to.

I hope you get my question and can help me out.

Thanks

Simon

### Solving a system of non-linear equations for diffe...

November 14 2014
0 2

I have the following system of non-linear equations and want to find their solutions experimenting with my parameters. I also want to restrict the solutions to be non-negative. I have done the following, but i am sure it exist a more efficient way. Can somone help on this?

eqns := [A = (gr_c+delta)*kh^(1-alpha)/sav_rate, theta = Rk*(Rh-Rk)/(gamma*((Rh-Rk)^2+sigma^2)), theta = 1*1+kh, Rk = 1+rk-delta, Rh = 1+rh-delta, rk = A*alpha*kh^(alpha-1), rh = A*(1-alpha)*kh^alpha, sigma = sigmay/theta, varrho = Rap^((eps-1)*eps/(1-gamma)), Rap = Rk^(1-gamma)+(1-gamma)*Rk^(-gamma)*theta*(Rh-Rk)-.5*Rk^(-gamma-1)*gamma*(1-gamma)*theta^2*((Rh-Rk)^2+sigma^2), R = Rk+theta*(Rh-Rk), beta = ((1+gr_c)/R)^(1/eps)/varrho];
print(`output redirected...`); # input placeholder
[
[
[
[
[ (1 - alpha)
[ (gr_c + delta) kh
[A = ----------------------------,
[ sav_rate
[

Rk (Rh - Rk)
theta = ---------------------------, theta = 1 + kh,
/ 2 2\
gamma \(Rh - Rk) + sigma /

Rk = 1 + rk - delta, Rh = 1 + rh - delta,

(alpha - 1) alpha
rk = A alpha kh , rh = A (1 - alpha) kh ,

/(eps - 1) eps\
|-------------|
sigmay \ 1 - gamma /
sigma = ------, varrho = Rap , Rap =
theta

(1 - gamma) (-gamma)
Rk + (1 - gamma) Rk theta (Rh - Rk) - 0.5

(-gamma - 1) 2 / 2 2\
Rk gamma (1 - gamma) theta \(Rh - Rk) + sigma /,

/ 1 \]
|---|]
\eps/]
/1 + gr_c\ ]
|--------| ]
\ R / ]
R = Rk + theta (Rh - Rk), beta = ---------------]
varrho ]
]
vals := [alpha = .36, delta = 0.6e-1, sigmay = sqrt(0.313e-1), gamma = 3, eps = .5, gr_c = 0.2e-1, sav_rate = .23];
eval(eqns, vals);
print(`output redirected...`); # input placeholder
[
[
[
[ 0.64 Rk (Rh - Rk)
[A = 0.3478260870 kh , theta = -----------------------,
[ / 2 2\
[ 3 \(Rh - Rk) + sigma /

0.36 A
theta = 1 + kh, Rk = 0.94 + rk, Rh = 0.94 + rh, rk = ------,
0.64
kh

0.36 0.1769180601
rh = 0.64 A kh , sigma = ------------,
theta

0.1250000000
varrho = Rap ,

1 2 theta (Rh - Rk)
Rap = --- - -----------------
2 3
Rk Rk

2 / 2 2\
3.0 theta \(Rh - Rk) + sigma /
+ --------------------------------, R = Rk + theta (Rh - Rk),
4
Rk

2.000000000]
/1\ ]
1.0404 |-| ]
\R/ ]
beta = ---------------------]
varrho ]
]
eqns := [A = .3478260870*kh^.64, theta = (1/3)*Rk*(Rh-Rk)/((Rh-Rk)^2+sigma^2), theta = 1+kh, Rk = .94+rk, Rh = .94+rh, rk = .36*A/kh^.64, rh = .64*A*kh^.36, sigma = .1769180601/theta, varrho = Rap^.1250000000, Rap = 1/Rk^2-2*theta*(Rh-Rk)/Rk^3+3.0*theta^2*((Rh-Rk)^2+sigma^2)/Rk^4, R = Rk+theta*(Rh-Rk), beta = 1.0404*(1/R)^2.000000000/varrho];
print(`output redirected...`); # input placeholder
[
[
[
[ 0.64 Rk (Rh - Rk)
[A = 0.3478260870 kh , theta = -----------------------,
[ / 2 2\
[ 3 \(Rh - Rk) + sigma /

0.36 A
theta = 1 + kh, Rk = 0.94 + rk, Rh = 0.94 + rh, rk = ------,
0.64
kh

0.36 0.1769180601
rh = 0.64 A kh , sigma = ------------,
theta

0.1250000000
varrho = Rap ,

1 2 theta (Rh - Rk)
Rap = --- - -----------------
2 3
Rk Rk

2 / 2 2\
3.0 theta \(Rh - Rk) + sigma /
+ --------------------------------, R = Rk + theta (Rh - Rk),
4
Rk

2.000000000]
/1\ ]
1.0404 |-| ]
\R/ ]
beta = ---------------------]
varrho ]
]

solve(eqns, [Rk, Rh, varrho, Rap, beta, R, A, sigma, theta, rk, rh, kh]);

### Proper way to use CodeTools:-Test...

October 28 2014
0 1

Cause CodeTools:-Test will not eval the paramater:

```
f := x -> x+1;

y := 2;

CodeTools:-Test( f(1), 2); # this will work as normal

CodeTools:-Test( f(1), y); # this will not work because `y` will not eval as 2

```

So current my solution is

```
test := subs(y=2, () -> CodeTools:-Test( f(1), y));

test();

```

I don't know is there any more proper solution for this.

More general, is there a way to force evaluate an `uneval` parameter?

### Multi-dimensional matrices/arrays...

October 16 2014
1 8

Hi there,

I was trying to simulate the behaviour of a one-variable, discrete-time function having three parameters.

M[n+1]=(b·theta^(m)·R[n])/(theta^(m)+R[n]^m)

defined for b, theta, m > 0

Say I want to simulate the function for the following values

b := [seq(1 .. 10, 1)];
theta := [seq(1 .. 5, 1)];
m := [seq(1 .. 2, 1)];

for n from 1 to 10.

I guess I need to build a 4-dimension array. But I was not able to find the right way to do this: should I use the Array strucutre? and if yes, how would I do it? As far as I've read, indexing would be an issue: should I create special indexing functions?

If I'm not wrong Maple matrices (Matrix) are just 2D.

Once the values of M computed, I would like to generate the corresponding plots, varying one parameter while the other two are fixed, and drawing the different M's in the same plot.

How can I achieve this?

Furthermore, if I would like to generate all possible combinations, I guess I would need to insert the solution given to the above question within a for loop. Will Maple display all plots or will it overlap/overwrite the preceding plot if used within a loop?

Thanks,

jon

### Bifurcation and Equilibria points...

September 29 2014
1 0

Hello,

One again, I have a problem to solve some bifurcation problem using maple.

Discuss the existance of Equilibria and determine any possible bifurcation.

x'=r*x-ln(x+1);

where \$r\$ is a parameter.

many thinks for your help and suggestion.

### Wrapper for plot() etc....

September 15 2014
1 0

I am considering to write a wrapper for plot and related commands (could redefine the commands or introduce a new name) which facilitates export of Maple plots to postscript. The command should interpret some of the options and remove them from the options sequence before submitting the remaining ones to the original plot().
E.g. it should recognize a title="TITLE" parameter and process TITLE (e.g. write it to a specific file). Similarly I would want to be able to pass additional parameters, e.g. filename="FILE" in order to specify how the output file name should be set. Is this a sensible approach. How can I realize this detailed option 'parsing' in Maple?

### solving a symbolic inequality...

September 04 2014
1 2

Hi, those who are in mapleprimes.

i have a problem in solving inequality with symbolic notated parameters.

I wrote the following code to solve for n(SPH), but couldn't obtain any result but an error message.

solve(-s*(-n(SPF)*tau+n(SPH))/(tau-1) <= n(SPH),n(SPH)) assuming (tau<1,s>0,s<1,tau>0);

The error was

Error, (in assuming) when calling 'unknown'. Received: 'invalid input: Utilities:-SetSolutions expects its 2nd argument, solutions, to be of type ({list, set})({piecewise, ({list, set})({name, relation})}), but received [s = -tau~+1, [SPF = SPF, s = s, tau~ <= 0]]'

Please tell me how I should do to solve the inequality.

taro

### Pde system with initial condition...

July 27 2014
1 8

Dear Maple Users,

I'm beginner in Maple.

I have this system of Pde:

with lambda experimental parameter and n,c,v dependent variables. I write this on Maple but I read on internet that the solution "float(undefined)" is an error.

I will insert this initial condition: c(x,0)=0,n(x,0)=0.4

Thanks everybody

### plot 3D for the numerical solution with parameter ...

May 29 2014
2 6

I have a differential equation system x'(t)=f1(k,t)*x(t)+f2(k,t)*y(t), x'(t)=g1(k,t)*x(t)+g2(k,t)*y(t) with initial condition x(0)=1 and y(0)=1. Here k is a parameter, f1, f2,g1, g2 are certain functions of k and t. I used dsolve and set k to be a parameter to solve the system numerically which gives you a procedure output. If I fixed k to be a specific numerical number, then I can use odeplot to plot x(t) VS t.

Now I set a range for k, say k=0..10. And I want to plot x VS (t,k) which is a 3D graph. How can I do this?

### Plotting simultaneous equation solutions, against ...

February 12 2014
2 11

Hello,

So I have two simultaneous equations,

T= n1/(1+|T-S|) and S=n2/(n3+|T-S|)

Where n1, n2 and n3 are constant parameters (from here on I fix n1=1 and n3=0.3). So I want to plot T, S against n2 for different values of n2.

If I also fix n2 (say, n2=1.5) I  can get values for T and S no problem.

But I've no idea (after many hours of searching) how to progresss. I know I need the program to put various values of n2 into the two equations and then plot the solutions numerically but I'm unsure what to try next.

Could anyone please shed some light on this?!

Thanks!

### Is there a way to see integration results for simu...

January 06 2014
1 1

Hi MaplePrimers!

I have a simulation in MapleSIM, exported as a compiled procedure in maple using -LinkModel(), and -GetCompiledProc.

I'm trying to do parameter estimation on my MapleSIM model.  Within a optimization scheme, I call the MapleSIM model, and it will output a curve.  Using a least squares method, I compare this measurements to synthetic experimental data (I know the actual values), and generate an objective function.  The optimization algorithm will try different parameter values, and try to minimze the objective function.  When the curves are exactly the same, the objective function will be zero.

The problem I am having is certain parameter sets will cause the model to require very small steps.  I wish to put a timeout on these experiments, because speed is important.  However, I would also like to see the results up to the point of requiring very small steps.  For timeout, I was using code along the lines of:

out:= timelimit(30,cProc(params = PData)); #simulate with 30s limit

where PData are the parameter guessses, and cProc is the compiled MapleSim model.

I would like 'out' to be assigned whatever the results were after 30 seconds, even if the model had not finished integrating.

Thanks in advance for any help!

### Formal parameters understanding...

December 22 2013
2 9

Hi everyone.

i want to undestand how to use the passing by reference in Maple i do this:

generate_x := proc (x)

x := (rand(1 .. 10))()

end proc;

generate_y := proc (y)

y := (rand(1 .. 5))();

print(y)

end proc;

print_xy := proc ()

local x, y;

generate_x(x);

print(x);

generate_y(y) end proc;

print_xy();

#print(x)  works but generate_y(y) doesn't print the value of y.

Can you help me to understand WHY i dont get the print of y.

Thanks and happy christmas to you!

 1 2 3 4 5 6 Page 2 of 6
﻿