## NonlinearFit Error...

Hi everybody, I’m Helena

I have a function with the following general characteristics:

y= const*M*[Int_def (from a to b) [f(x)*g(x, M)*p(x, t, M,K)]dx]

::::::::::::::::::::::::::::::::::::::::::::::::::

y= dependent variable

a= 1.76E-7

b= 1.76E-9

x= integration variable

M= unknown parameter

K= unknown parameter

t= independent variable

::::::::::::::::::::::::::::::::::::::::::::::::::

... and I'm trying to fit it to my experimental data (421 values), to determine the best values for M and K. In order to do that I’m using the package Statistic and the NonlinearFit command from maple, however, it seems that NonlinearFit cannot fit the model (y(t)) to the experimental data. It gives an error: “Error, (in Statistics:-NonlinearFit) integration range or variable must be specified in the second argument, got HFloat(1.0) = 0 .. 1” for which I could not find any explanation or solution on the internet. Could you please give me some advice or ideas about how can I solve this problem?

## Maybe a bug in MAPLE 2015's Explore ?...

Hi,

Here is the minimal situation that reveals which that could be a (little) bug in the MAPLE 2015 version of Explore.

In the attached file y is a list of numbers and val(r) a procedure that just print the value the rth element of y.
Changing the value of r is done with Explore (of course of no interest at all).
If I define the parameter r as a list ( r=[1..numelems(y)] ), only the value of y[1] is displayed: changing the value of r generates an error.
This doesn(t happen if r is defined as a slider ( r=1..numelems(r) ).

I discovered than the initial instance of Explore defines r as an integer while all the others (due to a change of r) define r as a string.
In the last command of the attached file you will see hjow I have circumvent this problem.

Is it a bug in Explore or does it exist some way to force the values of r to the implicit type they have in r=[\$1..numelems(y)] ?

TIA

## collocation method for integral equation ...

Hello,

I am looking help for solving this integral equation using the collocation method with 1.5<= x<=3.5 ?

I have used the successive approximation method and the solution seems to be increasing.

Thanks

## How can I get "allvalues" of a list of "rootof" ?...

Hi,

I have a list of integers (>1) and for all of them I define an alias (in the attached file I've tried two different names for them : a[n] or a||n) wich represents the nth roots of the unity.
When I apply the procedure allvalues to a specific alias it returns the algebraic values of the corresponding roots of the unity.
But when aplied to the list of aliases it gives me back only the name of the alias, not the algebraic values.

How can I fix this ?

TIA

 > restart:
 > interface(version)
 (1)
 > for n from 2 to 3 do   alias(a[n]=RootOf(z^n-1)): end do: alias();
 (2)
 > allvalues(a[2]); allvalues(a[3]); seq(allvalues(a[n]), n=2..3)
 (3)
 > for n from 2 to 3 do   alias(a||n=RootOf(z^n-1)): end do: alias(); allvalues(a2); allvalues(a3); seq(allvalues(a||n), n=2..3)
 (4)
 > A := [alias()]: map(allvalues, A);
 (5)
 >

## derivative of a function depending on a function a...

Hello,

I have the general function F(x,g(y)), and I don't understand the following notation of the derivative of  F w.r.t  y in Maple ?  What is D2(F) ?  Can we provide a concrete example ?

Thank you!

## Value of an expression at specific position ...

Dear Users!

Hope you would be fine with everything. I want to evaluate an expression (diff(u(y, t), y)+diff(diff(u(y, t), y), t)) for various values of b at y = 0, t=1. Please help me to evaluate it. Thanks in advance,

restart; with(plots); a := .7; L := 8; HAA := [0, 2, 5, 10];

for i to nops(HAA) do

b := op(i, HAA);

PDE1[i] := diff(u(y, t), t) = diff(u(y, t), y, y)+diff(diff(u(y, t), y, y), t)-b*u(y, t)+T(y, t);

PDE2[i] := diff(T(y, t), t) = (1+(1+(a-1)*T(y, t))^3)*(diff(T(y, t), y, y))+(a-1)*(1+(a-1)*T(y, t))^2*(diff(T(y, t), y))^2+T(y, t)*(diff(T(y, t), y, y))+(diff(T(y, t), y))^2;

ICandBC[i] := {T(L, t) = 0, T(y, 0) = 0, u(0, t) = t, u(L, t) = 0, u(y, 0) = 0, (D[1](T))(0, t) = -1};

PDE[i] := {PDE1[i], PDE2[i]}; pds[i] := pdsolve(PDE[i], ICandBC[i], numeric)

end do;

## how to find necessary condition for real solution ...

with(RegularChains):
with(ChainTools):
with(MatrixTools):
with(ConstructibleSetTools):
with(ParametricSystemTools):
with(SemiAlgebraicSetTools):
with(FastArithmeticTools):
R := PolynomialRing([x,y,z,a,b]):
sys := [x^2 + y^2 - x*y - 1 = 0, y^2 + z^2 - y*z - a^2 = 0, z^2 + x^2 - x*z - b^2 = 0,x > 0, y > 0, z > 0, a - 1 >= 0, b-a >= 0, a+1-b > 0]:

dec := RealTriangularize(sys,R): # very slow
Display(dec, R);

dec := LazyRealTriangularize(sys,R): # it is faster
dec2 := value(dec): # very slow
value(dec2);

find a , b to satisfy sys have real solution

expect  one of solution is below, but above function are very slow, load a very time still no result, where is wrong?

R1 = a^2+a+1-b^2;
R1 = a^2-1+b-b^2;

[R1 > 0, R2 > 0]

## How can I force Maple to rewrite expressions conta...

Hi,

Is it possible to force Maple to simplify these Sum(s) ?
SimplifySum.mw

 > s := Sum(a*X[n]+b, n=1..N); simplify(s); value(s);  # part of the job done  but... IWouldLikeToHave = a*Sum(X[n], n=1..N) + b*N; # or +N*b, it doesn't matter
 (1)
 > s := Sum(X[n]+Y[n], n=1..N); (expand@value)(s); IWouldLikeToHave = Sum(X[n], n=1..N) + Sum(Y[n], n=1..N);
 (2)
 >

## How can I define (and sample) a mixture of two ra...

Hi,

I can't find a unique way to define a mixture of two random variables that enables at the same time to compute its PDF and generate a sample.
In the attached file you will find two methods :

1. the first one is the most formal and only CAS are supposed to be able to allow its implementation:
it enables computing the PDF and the CDF (trivial) but fails to generate a sample.
(PS : in a first attempt I had defined only the PDF, which should have been enough for method=envelope does work... ... at my opinion)

2. the second method is the one one would use in non CAS languages (for instance Matlab, R, ...). It enables generating a sample (of course) but fails to compute the PDF (which is not very surprising).

So my question: does anyone here would have some suggestions to make one these two methods capable to compute both the PDF (eventually the CDF) and generate samples ?

PS: still have this kind of problems (tomleslie suggested months ago that using interface(rtablesize=10) could help but it's not the case here)
Maple Worksheet - Error
Failed to load the worksheet /maplenet/convert/Mixture_of_random_variables.mw .

## Can anyone explain me how 'infinity' is treated in...

Hi

I got, a bit by mistake, a weird result that seems to come from the way "Maple" manipulates infinity (please have a look at the results below)
I couldn't find a correct explanation to these results in the help pages dedicated to infinity or evaluation.

Could anyone explain me why, in some circumstances, 'infinity' seems to be a name (for instance infinity*Pi; does not return  infinity but infiniy/Pi).

 > restart:
 > with(Statistics):
 > f := PDF(Cauchy(0, 1), x)
 (1)
 > m := int(x*f, x=-infinity..+infinity);
 (2)
 > p := int(x*f, x);
 (3)
 > # Naive "proof" : eval(..., infinity) seems to consider infinity as a name (consistent with # the first line in help(infinity) without any particular property. # This seems to be confirmed by the value of p1 and p2 : I expected to get infinity instead # of infinity/Pi. p1 := eval(p, x=-infinity); p2 := eval(p, x=+infinity); p2 - p1;
 (4)
 > # Correct "proof" : a := limit(p, x=-infinity); b := limit(p, x=+infinity); b-a
 (5)
 > # Does Maple treat 'infinity' as a number ? infinity         - infinity; infinity*2       - infinity*2; infinity*(1/3)   - infinity*(1/3); infinity*0.333   - infinity*0.333; infinity*sqrt(2) - infinity*sqrt(2); infinity/Pi      - infinity/Pi;
 (6)
 > limit(sqrt(2)/x, x=0) - limit(sqrt(2)/y, y=0); limit(Pi/x, x=0)      - limit(Pi/y, y=0);
 (7)
 >

## Spliting of a matrix ...

Dear Users!

Hope you would be fine with everything. I have following code to generate marix A of order M by M

restart; with(LinearAlgebra); with(linalg); Digits := 30; M := 10; nu := 1;

for k1 while k1 <= M do

C[k1] := simplify(sum((-1)^(k1-1-i1)*GAMMA(k1-1+i1+2*nu)*GAMMA(nu+1/2)*x^i1/(GAMMA(i1+nu+1/2)*factorial(k1-1-i1)*factorial(i1)*GAMMA(2*nu)), i1 = 0 .. k1-1))

end do;

A := evalm(Matrix(M, M, proc (i, j) options operator, arrow; eval(C[j], x = (i-1)/(M-1)) end proc))

I want to split (or decompose) A into two parts Ad and Ab

where Ad is M by M matrix of all entries of A but first and last rows of Ad shoud be zero

and Ab is M by M matrix with zero entries expect first and last rows.

For exmaple for M = 5, A, Ab and Ad are given as,

Ab := Matrix(5, 5, {(1, 1) = 1, (1, 2) = -2, (1, 3) = 3, (1, 4) = -4, (1, 5) = 5, (2, 1) = 0, (2, 2) = 0, (2, 3) = 0, (2, 4) = 0, (2, 5) = 0, (3, 1) = 0, (3, 2) = 0, (3, 3) = 0, (3, 4) = 0, (3, 5) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 0, (4, 4) = 0, (4, 5) = 0, (5, 1) = 1, (5, 2) = 2, (5, 3) = 3, (5, 4) = 4, (5, 5) = 5});

Ad := Matrix(5, 5, {(1, 1) = 0, (1, 2) = 0, (1, 3) = 0, (1, 4) = 0, (1, 5) = 0, (2, 1) = 1, (2, 2) = -1, (2, 3) = 0, (2, 4) = 1, (2, 5) = -1, (3, 1) = 1, (3, 2) = 0, (3, 3) = -1, (3, 4) = 0, (3, 5) = 1, (4, 1) = 1, (4, 2) = 1, (4, 3) = 0, (4, 4) = -1, (4, 5) = -1, (5, 1) = 0, (5, 2) = 0, (5, 3) = 0, (5, 4) = 0, (5, 5) = 0});

Special request @acer @Carl Love @Kitonum @Preben Alsholm

## How can I have a pretty display of a piecewise exp...

Hi,

How can I force the command InsertContent(Worksheet(Group(Input( T )))) to display the variable eq as it appears in label (2) ?

(a screen capture of the output of InsertContent(Worksheet(Group(Input( T )))) is given after the Maple code)

 > restart:
 > interface(version)
 (1)
 > with(DocumentTools):
 > with(DocumentTools[Layout]):
 > eq := piecewise(t < 1, sin(t), cos(t)); C := Cell( Textfield(style=TwoDimOutput,Equation(eq)) ): T := Table(Column(), widthmode=percentage, width=40, Row(C)): InsertContent(Worksheet(Group(Input( T )))):
 (2)
 >

## GKLS - Optimization test functions generator...

Hi!

There is a (relatively) known software code (written in C), called ." GKLS-generator" or "GKLS" to generate, according to certain user paramenters, optimization test functions. The code is available for free at the web

http://wwwinfo.deis.unical.it/%7Eyaro/GKLS.html

I would like to write this code in Maple. In the attached zip there is a PDF explaining how to build these functions. For now, I tried the follwoing Maple code GKLS_v4.mw

I think I'm doing something wrong, since the drawing generated by the attached Maple does not look much like the PDF in the attached zip (Fig. 1 of page 8).

Please, Can you help me with this?

## Collocating a vector...

Hi User!

Hope you would be fine with everything. I have a vector "POL" of M dimension obatined for the following expression

restart; with(LinearAlgebra); nu := 1; M := 3;
for k while k <= M do
Poly[k] := simplify(sum(x^i*GAMMA(nu+1)/(factorial(i)*GAMMA(2*nu)), i = 0 .. k-1))
end do;
POL := `<,>`(seq(Poly[k], k = 1 .. M))

and I want to construct a matrix of M by M by collocating it on the points x=i/(M-1) for i=0,1,2,...,M-1 like the following way,

For M=3 I need

Matrix(3, 3, {(1, 1) = Poly[1](0), (1, 2) = Poly[1](1/2), (1, 3) = Poly[1](1), (2, 1) = Poly[2](0), (2, 2) = Poly[2](1/2), (2, 3) = Poly[2](1), (3, 1) = Poly[3](0), (3, 2) = Poly[3](1/2), (3, 3) = Poly[3](1)});

For M=4 I need

Matrix(4, 4, {(1, 1) = Poly[1](0), (1, 2) = Poly[1](1/3), (1, 3) = Poly[1](2/3), (1, 4) = Poly[1](1), (2, 1) = Poly[2](0), (2, 2) = Poly[2](1/3), (2, 3) = Poly[2](2/3), (2, 4) = Poly[2](1), (3, 1) = Poly[3](0), (3, 2) = Poly[3](1/3), (3, 3) = Poly[3](2/3), (3, 4) = Poly[3](1), (4, 1) = Poly[4](0), (4, 2) = Poly[4](1/3), (4, 3) = Poly[4](2/3), (4, 4) = Poly[4](1)})

and general form is like this

[[[Poly[1](0/(M-1)),Poly[1](1/(M-1)),Poly[1]((2)/(M-2)),...,Poly[1]((M-1)/(M-1))],[Poly[2](0/(M-1)),Poly[2]((1)/(M-1)),Poly[2]((2)/(M-1)),...,Poly[2]((M-1)/(M-1))],[Poly[3]((0)/(M-1)),Poly[3]((1)/(M-1)),Poly[3]((2)/(M-1)),...,Poly[3]((M-1)/(M-1))],[...,...,...,...,...],[Poly[M]((0)/(M-1)),Poly[M]((1)/(M-1)),Poly[M]((2)/(M-1)),...,Poly[M]((M-1)/(M-1))]]];

Another problem is I want to define a vector of M dimension using a function f(x)=sin(x) and two points a=1, b=2 like the following way,

Vec:=[[[a],[f((1)/(M-1))],[f((2)/(M-1))],[f((3)/(M-1))],[...],[f((M-1)/(M-1))],[b]]]
Special request @acer @acer @Carl Love @Kitonum @Preben Alsholm

## Simplification of an expression...

Dear Users!

Hope you would be fine with everything. I want the simpliest for of the following expression in two step:

diff(U(X, Y, Z, tau), tau)+U(X, Y, Z, tau)*(diff(U(X, Y, Z, tau), X))+V(X, Y, Z, tau)*(diff(U(X, Y, Z, tau), Y))+W(X, Y, Z, tau)*(diff(U(X, Y, Z, tau), Z))+u[delta]*lambda[1]*(diff(U(X, Y, Z, tau), tau, tau))/L[delta]+u[delta]*lambda[1]*(diff(U(X, Y, Z, tau), tau))*(diff(U(X, Y, Z, tau), X))/L[delta]+u[delta]*lambda[1]*U(X, Y, Z, tau)*(diff(U(X, Y, Z, tau), tau, X))/L[delta]+u[delta]*lambda[1]*(diff(V(X, Y, Z, tau), tau))*(diff(U(X, Y, Z, tau), Y))/L[delta]+u[delta]*lambda[1]*V(X, Y, Z, tau)*(diff(U(X, Y, Z, tau), tau, Y))/L[delta]+u[delta]*lambda[1]*(diff(W(X, Y, Z, tau), tau))*(diff(U(X, Y, Z, tau), Z))/L[delta]+u[delta]*lambda[1]*W(X, Y, Z, tau)*(diff(U(X, Y, Z, tau), tau, Z))/L[delta];
Step 1:
diff(U(X, Y, Z, tau), tau)+U(X, Y, Z, tau)*(diff(U(X, Y, Z, tau), X))+V(X, Y, Z, tau)*(diff(U(X, Y, Z, tau), Y))+W(X, Y, Z, tau)*(diff(U(X, Y, Z, tau), Z))+u[delta]*lambda[1]*(diff(diff(U(X, Y, Z, tau), tau)+U(X, Y, Z, tau)*(diff(U(X, Y, Z, tau), X))+V(X, Y, Z, tau)*(diff(U(X, Y, Z, tau), Y))+W(X, Y, Z, tau)*(diff(U(X, Y, Z, tau), Z)), tau))/L[delta];
Step 2: (final form I need)
(1+(u[delta] lambda[1])/(L[delta]) (&PartialD;)/(&PartialD;tau)) ((&PartialD;)/(&PartialD;tau) U(X,Y,Z,tau)+U(X,Y,Z,tau) ((&PartialD;)/(&PartialD;X) U(X,Y,Z,tau))+V(X,Y,Z,tau) ((&PartialD;)/(&PartialD;Y) U(X,Y,Z,tau))+W(X,Y,Z,tau) ((&PartialD;)/(&PartialD;Z) U(X,Y,Z,tau)));