Items tagged with parameters parameters Tagged Items Feed

Another easy question from a newbie:

Say I have a procedure which, along the its execution, needs to pass a parameter to a different procedure (which, in this case, would be a subroutine) to be elaborated and returned to go on.

This process may happen a few times during the execution and the passing parameter, which may have the same name but different value, needs to be worked on by the subrooutine.

My question is: how do I invoke a procedure from a parent procedure passing one or more parameters and have them returned?

Thank you

Hello

I am working on a project where I need to find the parameters of the formula:

1/2*a*erfc(1/2*2^(1/2)*(-x+m1)/s1)+(1/2-1/2*a)*erfc(1/2*2^(1/2)*(-x+m2)/s2)

which is the formula for the cumulative distribution for two gaussian peaks, one with average m1 and standard deviation s1, the other m2 and s2, with weights a and (1-a). I have data in excel that form the gaussian distribution but now I need to find the parameters of the formula that fits these data.

Is there a command in maple to find these parameters or how do I start? And do I need to upload the data from excel to maple or do I need to insert only some values?

Some one who could help me, because it is really hard and I find no information for this.

Hasselhof

Hi !

I wish to solve a differential equation with an initial condition of the type D(f)(a)=b, where 'a' and 'b' are arbitrary real constants and are entered this way symbolically. Maple interprets D(f)(a) as a function which depends on a new variable 'a' and gives the error:

 

Error, (in dsolve) found differentiated functions with same name but depending on different arguments in the given DE system: {f(a), f(psi)}

(the differential equation is for a function f(psi) which was defined previously)

 

How can I pass this initial condition f'(a)=b (a,b being constants, but arbitrary) to the Maple dsolve command?

I have been browsing the web and looking at manuals, but always find D(f)(0)=3 or any other combination with numbers only.

Thank you in advance.

Regards,

              Michael

 

 

I want to test linearly dependence of a polynomial f on a list of polynomials F by additional condition on parametric coefficients of linear parametric polynomial (linear for variables not parameters). Please note that:

  1. The polynomialand the members of are always homogenous in the variables.
  2. The coefficients of f, the coefficients of the members of F are all always polynomials in the parameters or contant and the members of N and W are all always polynomials in the parameters.

 

For example let

and

(a,b,c,d,e,h are parameters and A1,A2,A3 are variables).

If I use PolyLinearCombo(F,f,{A1,A2,A3}) (see http://www.mapleprimes.com/questions/204469-How-Can-I-Find-The-Coefficients-Of-Linear#comment217621)then its output is false,[].

Now we let to condition sets for parameters as the following:

N:=[ebc+ahd]

W:=[a,c]

The elements of N must be zero means that ebc+ahd=0

and the elements of W are non-zero that is a<>0 and c <>0.

Let a=b=c=d=h=1 and e=-1. This specialization satisfy in the above condition sets N and W. By this specialization we have:

and

Now if I use PolyLinearCombo(F,f,{A1,A2,A3}) then its output is true,[-1,1].

By this additional two condition sets I have to check that whether f is linearly independent of F or not. How can I do this without specialization? In fact I want an algorithm that its input is (null condition N, not-null condition W, list of polynomials F, a polynomial f, the set of variables) and its output is true and coefficients if f is linearly dependent of F w.r.t. null and not-null conditions N and W, else its output is false.

If the name of new procedure is ExtPolyLinearCombo and 

N:=[ebc+ahd]

W:=[a,c]

I want the output of

ExtPolyLinearCombo(N,W,F,f,{A1,A2,A3}) be true,[coefficients]

Thank you very much in advance.

 

 

guys, i have this equation which a, n, c, phi[0] are parameters and r is variable. maple solved this equation with n=0,c=c,phi[0]=5/4-1/4 c but i obtained another solution for this equation : a = 1, c = 5, n = 1, phi[0] = 1 ( you can check). 

 

restart

odesys := {5*r^a+4*n-c*r^n-4*phi[0]}

{5*r^a+4*n-c*r^n-4*phi[0]}

(1)

res := op(odesys);

5*r^a+4*n-c*r^n-4*phi[0]

(2)

 

SOL := solve(identity(res = 0, r), [a, n, c, phi[0]]);

[[a = 0, n = 0, c = c, phi[0] = 5/4-(1/4)*c]]

(3)

NULL

eval(5*r^a+4*n-c*r^n-4*phi[0], [a = 1, c = 5, n = 1, phi[0] = 1])

0

(4)

NULL


how can i get all solutions for a equation like this ?

Download eq000.mw

Trying to use the Explore() to parametrize a couple of plots simultaneously.

According to the help: "A plotting command to be explored can be a function call to plot, plot3d, a command in the plots package, or any user-defined procedure which returns a two- or three-dimensional plot structure or an Array of such plot structures."

However with the definitions

restart;
with(plots):
with(plottools):
Parab1 := ''plot(a*x^2, x = -1 .. 1, y = -3 .. 3)'';
Parab2 := ''plot(a*x^2+1, x = -1 .. 1, y = -3 .. 3)'';
L:=Array(1..2);
L[1]:=Parab1;L[2]:=Parab2;

I then find the following:

Explore(L[1], parameters = [a = -1.0 .. 1.0]);
gives the expected parabola, and the slider updates the parabola dynamically, as expected, and of course the same with L[2] in place of L[1]. However,

Explore(L, parameters = [a = -1.0 .. 1.0])

does not work, giving "Warning, expecting only range variable x in expression a*x^2 to be plotted but found name a". If I use display(L) in the command above, I receive two adjacent plots, as expected but they do not update as the parameter a is changed via the slider.

I'd guess I need to delay or promote variable evaluation somehow, but I can't seem to make it work. What am I missing?

 

 

 

 

 

 

 Let M be a matrix with polynomial array f_i's such that any array is in K[a_1,..,a_m][x_1,..,x_n] where a=a_1,,,a_m are sequence of parameters and x=x_1,..,x_n are sequense of variables. Now, I want to extract the coefficients of  f_i that are in K[a_1,a_2,..,a_m]. For example if M=Matrix([[ax-bxy],[cx^2-dy]]) how can I extract the matrix coefficint C=Matrix([[a,-b],[c,-d]])?

Please note that a,b,c,d are parameters and x,y are variables.

How do I solve this in Maple:

 

M(k,n)=M(k,n-1)+M(k-1,n-1)+M(k-2,n-2) and

M(k,1)=1 and M(1,n)=n

 

?

 

Thank you, Jan

 

Hej hej,

is there a way to obtain confidence intervals for the parameters in a NonlinearFit? To give you an impression of the problem which I was working on, I created a minimial working example (not sure wheather that actually helps). In this particular case, I have two parameters to fit the coefficients of a binomial series to some data I obtained. Beyond the values of the parameters (in a least square fit), I'm also interested in some kind of confidence interval, to get a feeling about how realiable my values are. Is there a direct (or even indirect) way to obtain such a thing. Either directly as a Maple function (confidenceintervals is not supported for NonlinearFit, if I'm not mistaken) or as something I can implement myself (within a reasonable time frame, as in hours rather than days).
Thanks in advance!

Cheer,

Sören

restart; with(plots); with(Statistics)

alpha[0] := 1.000000000:

m__max := 4:

model := Fit(pochhammer(z__1, m)*h__exp^m/factorial(m), [seq(m, m = 0 .. m__max)], [seq(alpha[m], m = 0 .. m__max)], m, output = [leastsquaresfunction, residuals], weights = [seq(1/abs(alpha[m]), m = 0 .. m__max)], iterationlimit = 10000)

model := [pochhammer(1.42349754368085, m)*16.2763580438677^m/factorial(m), Vector[row](5, {(1) = 0., (2) = -0.120508651249829e-1, (3) = 0.113910530162494e-1, (4) = 0.348907003220054e-3, (5) = -0.305508272150429e-2})]

(1)

plots[multiple](logplot, [{seq([m, alpha[m]], m = 0 .. m__max)}, style = point, color = black], [{seq([m, model[1]], m = 0 .. m__max)}])

 

``

Download nonlinearfit-problem.mw

Hi,

 

I'm trying to create interactive plots by using Explore to help demonstrate the effects parameters have on functions. I created one successfully to illustrate shifts and stretches of a polynomial:

 

transform(A,B,X,H,P,K):=Explore(plot(a*(b*x+h)^(p)+k,x=X),parameters=[a=A, b= B,h=H,p=P,k=K],placement=right)

 

However when I try to do the same with a solved ODE it returns an error message:

 

Explore(plot(1/(-p*x+x+1)^(1/(p-1)), x = -5 .. 5), parameters = [p = -20 .. 20], placement = right);

 

Executing this gives the error message: 

Warning, expecting only range variable x in expression 1/((-p*x+x+1)^(1/(p-1))) to be plotted but found name p
INTERFACE_PLOT(AXESLABELS(x, ""),

VIEW(-5. .. 5., DEFAULT, _ATTRIBUTE("source" = "mathdefault"))),

parameters = [p = -20 .. 20], placement = right

 

I'm not sure why it is having difficulty dealing with "p" when it had no difficulty with the first. Any help would be appreciated!

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

I have solved ODE's with either i.c. or b.c. (mechanics stuff) where the results were in terms of expressions, not functions.  I could plot these expressions, substitute values in for parameters, etc. 

Then I thought that the real way to solve an ODE or system of ODE's was to define functions.  I wanted this to be in three levels: the solutions in generality, the solutions with i.c./m.c. applied, and then further with the parameter values defined. 

So far, no joy.  Lots of confusion--input eqns as sequence, list, set?  I looked on the Maple help page, thought I was doing things right. I even tried out "union" for the ode's and the ic's.

The code is below; statement (11) produces an error. Yes, I am using Maple 18, even though the file says Maple 15.  I'd like to solve the 4-ODE system at the three levels listed above, and then (if possible), plot the result! Am I asking too much?  Should I be using MapleSim or some other product instead?

 

Thanks for any and all help!

 

robert w.


NULL

restart

assume(m1 > 0);

eqn1 := diff(z1(t), t) = z2(t);

diff(z1(t), t) = z2(t)

(1)

eqn2 := diff(z2(t), t) = -(k1+k2)*z1(t)/m1-(c1+c2)*z2(t)/m1+k2*z3(t)/m1+c2*z4(t)/m1;

diff(z2(t), t) = -(k1+k2)*z1(t)/m1-(c1+c2)*z2(t)/m1+k2*z3(t)/m1+c2*z4(t)/m1

(2)

eqn3 := diff(z3(t), t) = z4(t);

diff(z3(t), t) = z4(t)

(3)

eqn4 := diff(z4(t), t) = k2*z1(t)/m2+c2*z2(t)/m2-k2*z3(t)/m2-c2*z4(t)/m2;

diff(z4(t), t) = k2*z1(t)/m2+c2*z2(t)/m2-k2*z3(t)/m2-c2*z4(t)/m2

(4)

eqns := eqn1, eqn2, eqn3, eqn4;

diff(z1(t), t) = z2(t), diff(z2(t), t) = -(k1+k2)*z1(t)/m1-(c1+c2)*z2(t)/m1+k2*z3(t)/m1+c2*z4(t)/m1, diff(z3(t), t) = z4(t), diff(z4(t), t) = k2*z1(t)/m2+c2*z2(t)/m2-k2*z3(t)/m2-c2*z4(t)/m2

(5)

var := z1(t), z2(t), z3(t), z4(t);

z1(t), z2(t), z3(t), z4(t)

(6)

ic1 := z1(0) = -2;

z1(0) = -2

(7)

ic2 := z2(0) = 0;

z2(0) = 0

(8)

ic3 := z3(0) = 1;

z3(0) = 1

(9)

ic4 := z4(0) = 0;

z4(0) = 0

(10)

ics := ic1, ic2, ic3, ic4;

z1(0) = -2, z2(0) = 0, z3(0) = 1, z4(0) = 0

(11)

dsolve(`union`(eqns, ics), var)

Error, invalid input: `union` received diff(z1(t), t) = z2(t), which is not valid for its 1st argument

 

var;

z1(t), z2(t), z3(t), z4(t)

(12)

data:=(m1=1,m2=2,m3=1,c1=0,c2=0,c3=0,k1=5,k2=2,k3=2);

m1 = 1, m2 = 2, m3 = 1, c1 = 0, c2 = 0, c3 = 0, k1 = 5, k2 = 2, k3 = 2

(13)

eqnsev := subs(data, eqns);

diff(z4(t), t) = z1(t)-z3(t)

(14)

NULL


Download mae340_state_space_4-ode_system.mw

I am trying to fit an experimental data C[A](t)  vs t, with modelled ODE equation by solving it with numerical method. But the process gives problems here ha code and also find attached maple file.

Input is time =[0, 30, 60, 90, 120, 150, 180, 210, 240]

and output exptal data = [7647.5, 7397.5, 6755, 6252.5, 5860, 5530, 5440, 5107.5, 4857.5]

I want to find k,K[A] parameters;

 

EXPT_datafittinh_LHHW.mw

Dear all,

I want to know how can I solve a fourth or higher order equation to find out its roots, actually coefficients of each power terms itself are functins of other parameters not constant.

Please reply as soon as possible, as this is very urgent,

Regards.

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.

Thank you for your help.

1 2 3 4 5 Page 1 of 5