## FUNCTIONAL FORM OF INTERPOLATON...

How to get the functional form of interpolation in the given example below

GP.mw

Hi

## problems with ChiSquareSuitableModelTest...

Hi,

The procedure Statistics:-ChiSquareSuitableModelTest returns wrong or stupid results in some situations.
The stupid answer can easily be avoided if the user is careful enough.
The wrong answer is more serious: the standard deviation (in the second case below) is not correctly estimated.

PS: the expression "CORRECT ANSWER" is a short for "POTENTIALLY CORRECT ANSWER" given that what ChiSquareSuitableModelTest really does is not documented

 > restart:
 > with(Statistics):
 > randomize(): N := 100: S := Sample(Normal(0, 1), N):
 > infolevel[Statistics] := 1: # 0 parameter to fit from the sample S  CORRECT ANSWER ChiSquareSuitableModelTest(S, Normal(0, 1), level = 0.5e-1): print():
 Chi-Square Test for Suitable Probability Model ---------------------------------------------- Null Hypothesis: Sample was drawn from specified probability distribution Alt. Hypothesis: Sample was not drawn from specified probability distribution Bins:                    10 Degrees of freedom:      9 Distribution:            ChiSquare(9) Computed statistic:      15.8 Computed pvalue:         0.0711774 Critical value:          16.9189774487099 Result: [Accepted] This statistical test does not provide enough evidence to conclude that the null hypothesis is false
 (1)
 > # 2 parameters (mean and standard deviation) to fit from the sample S  INCORRECT ANSWER ChiSquareSuitableModelTest(S, Normal(a, b), level = 0.5e-1, fittedparameters = 2): print(): # verification m := Mean(S); s := StandardDeviation(S); t := sqrt(add((S-~m)^~2) / (N-1)); print(): error "the estimation of the StandardDeviation ChiSquareSuitableModelTest is not correct"; print():
 Chi-Square Test for Suitable Probability Model ---------------------------------------------- Null Hypothesis: Sample was drawn from specified probability distribution Alt. Hypothesis: Sample was not drawn from specified probability distribution Model specialization:    [a = -.2143e-1, b = .8489] Bins:                    10 Degrees of freedom:      7 Distribution:            ChiSquare(7) Computed statistic:      3.8 Computed pvalue:         0.802504 Critical value:          14.0671405764057 Result: [Accepted] This statistical test does not provide enough evidence to conclude that the null hypothesis is false
 (2)
 > # ONLY 1 parameter (mean OR standard deviation ?) to fit from the sample S  STUPID ANSWER # # A stupid answer: the parameter to fit not being declared, the procedure should return # an error of the type "don(t know what is the paramater tio fit" ChiSquareSuitableModelTest(S, Normal(a, b), level = 0.5e-1, fittedparameters = 1): print(): WARNING("ChiSquareSuitableModelTest should return it can't fit a single parameter"); print():
 Chi-Square Test for Suitable Probability Model ---------------------------------------------- Null Hypothesis: Sample was drawn from specified probability distribution Alt. Hypothesis: Sample was not drawn from specified probability distribution Model specialization:    [a = -.2143e-1, b = .8489] Bins:                    10 Degrees of freedom:      8 Distribution:            ChiSquare(8) Computed statistic:      3.8 Computed pvalue:         0.874702 Critical value:          15.5073130558655 Result: [Accepted] This statistical test does not provide enough evidence to conclude that the null hypothesis is false
 (3)
 > ChiSquareSuitableModelTest(S, Normal(a, 1), level = 0.5e-1, fittedparameters = 1):  #CORRECT ANSWER print(): # verification m := Mean(S); print():
 Chi-Square Test for Suitable Probability Model ---------------------------------------------- Null Hypothesis: Sample was drawn from specified probability distribution Alt. Hypothesis: Sample was not drawn from specified probability distribution Model specialization:    [a = -.2143e-1] Bins:                    10 Degrees of freedom:      8 Distribution:            ChiSquare(8) Computed statistic:      16.4 Computed pvalue:         0.0369999 Critical value:          15.5073130558655 Result: [Rejected] This statistical test provides evidence that the null hypothesis is false
 (4)
 > ChiSquareSuitableModelTest(S, Normal(0, b), level = 0.5e-1, fittedparameters = 1):  #CORRECT ANSWER print(): # verification s := sqrt((add(S^~2) - 0^2) / N); print():
 Chi-Square Test for Suitable Probability Model ---------------------------------------------- Null Hypothesis: Sample was drawn from specified probability distribution Alt. Hypothesis: Sample was not drawn from specified probability distribution Model specialization:    [b = .8492] Bins:                    10 Degrees of freedom:      8 Distribution:            ChiSquare(8) Computed statistic:      6.4 Computed pvalue:         0.60252 Critical value:          15.5073130558655 Result: [Accepted] This statistical test does not provide enough evidence to conclude that the null hypothesis is false
 (5)
 >

## How to get the result of this limit?...

How to get the result of this limit? I don't get the result.

`limit(sum(1/(i*sqrt(i+1)+(i+1)*sqrt(i)), i = 1 .. n), n = infinity);`

With Mathematica, I got the output is 1.

## How to get a random number from the list?...

Hello. Let's say I have a list of many items. Well, let's list A:=[1,1.732,1.23,4.42,9,6.45,3.45,8.428,9.1,12]. How to get three numbers from it randomly?

## How to convert expression in hypergeom to integral...

It shows that odetest() did not verify a solution to ODE becuase solution was using hypergeom special functions. If the solution to the ODE was in integral form, then odetest() will verify it OK.

But what to do if the solution I want to verify is already in hypergoem? If I try odetest() it will fail to verify now. Then I can try to convert the solution to integral form and try again.

But when  using convert(sol,Int) followed by odetest() it did not work.

The solutions I try to verify are hand solutions or book solutions, and not coming from dsolve.

But some of them are the same solution that comes from dsolve() when not using the useInt option.

Also, I am doing this all inside a Maple program. It is not an interactive process. So I can't do plots and look at them to decide on anything. So verification must all be implemented in code.

The question is: Why did convert(hand_solution,Int) not give the same result as dsolve(ode,useInt)? Is there another way around this? (May be I am asking for too much in this one based on answers in the above link, So that is OK if not possible. But I really like the solution given when using "useInt" option. Much more clear than otherwise).

 > restart;
 > ode := diff(y(x), x)*(x^3 + 1)^(2/3) + (1 + y(x)^3)^(2/3) = 0; sol_int:=dsolve(ode,useInt); odetest(sol_int,ode); #OK now, since solution in integral form

 > hand_solution:= x*hypergeom([1/3, 2/3], [4/3], -x^3) + y(x)*hypergeom([1/3, 2/3], [4/3], -y(x)^3) + _C1 = 0; convert(hand_solution,Int); #Why this did not give same result as ABOVE?

 > odetest(%,ode); #does not give zero

 >

Maple 2019.1

## integral with constants...

It seems that the answer to my question is deleted!!!

So, I again repeat it.

How I can calculate this integral?

I want to calculate integral with the constants Aj]j=1,2.

The Amount of these constants  unknown this stage.

Thanks

INTEGRAL

## Cannot evaluate multivariable integral...

integral.mw

I am trying to evaluate any which way the integral:

`int(exp(-(sqrt(4*x^2+4*y^2+4*z^2)^3)), z = -sqrt(4-x^2-y^2).. sqrt(4-x^2-y^2),y=-sqrt(4-x^2)..sqrt(4-x^2),x=-2..2);`

The program just hangs, so i click on 'stop current operation'.

Then I tried:

`evalf(Int(exp(-(sqrt(4*x^2+4*y^2+4*z^2)^3)), z = -sqrt(4-x^2-y^2).. sqrt(4-x^2-y^2),y=-sqrt(4-x^2)..sqrt(4-x^2),x=-2..2));`

It returns the integral back unevaluated.

It's true that I could use a change of variables, changing to spherical coordinates would be best here. But I would like to know if I did set up the original Cartesian integral correctly. Is there some workaround I can apply to get a numeric answer. I am satisfied with a decimal approximation. Then I can compare to the change of variable result. An exact answer would be even better of course.

## how to make odetest() verify dsolve solution on th...

THis is another ode which I am not able to get odetest to give zero. Any one knows of a trick to verify this solution? It might be just that the solution is too complicated for odetest to verify?

 > restart;
 > ode:=diff(y(x),x)*(x^3+1)^(2/3)+(1+y(x)^3)^(2/3) = 0; sol:=dsolve(ode);

 > odetest(sol,ode);

 > simplify(%);

 >

Maple 2019.1, Physics 395

## Factoring a polynomial in exp...

This must be a simple question. I have a simple expression:

test := -2+exp(theta)+exp(-theta)

and want to get that factored as a polynomial in the variable exp(-theta).

That is of course easy by hand, but the same problem appears frequently, as a part in further simplifications. There must be an easy way to do it, but I cannot find it.

## How to draw the given data?...

How to draw the given data?

 >
 >
 >

## Using xx with pdsolve output = listprocedure...

pde := diff(u(x, t), x \$ 4) = diff(u(x, t), t \$ 2);

iv:= subs(L = 100, {u(0, t) = 0, u(L, t) = 0, u(x, 0) = sin(x), D[2](u)(x, 0) = 2*x, D[1, 1](u)(0, t) = 0, D[1, 1](u)(L, t) = 0});

de := pdsolve(pde, iv, numeric):

sa1 := de:-value(output = listprocedure);

sa1:=[x=proc() ... end proc,t=proc() ... end proc,u(x,t)=proc() .. end proc]

With the above procedure it works, but in the most compact form below it does not work.

pdsolve(pde, iv, numeric,output = listprocedure):

Error, (in pdsolve/numeric/par_hyp) invalid arguments for theta scheme: [output = listprocedure]

## hints on when NOT to use simplify?...

I have been using simplify() in number of places, and not really expecting it will do any harm. At worst, it will have no effect, or it will change the expression to different form, but the semantics will remain the same.

Until I noticed that odetest() fail on some of my solutions because I called simplify  on the solution before.

One example why this happens, is that Maple simplifies cos(2*x)*sqrt(1/cos(2*x)^2) to csgn(1/cos(2*x)) and this makes odetest fail. Adding assuming x::real has no effect on making odetest happy.

So now I changed simplify(sol) to simplify(sol,size) and this seems so far not to have this adverse effect.

My main reason for calling simplify  is to make the expression smaller. In Mathematica that is what I do, In Mathematica there is no "size" option to Simplify.

So now, I am very worried about calling simplify() as is.

Could some Maple experts share some of their experience on this? Should one call simplify() only when an explicit option, like size, trig, exp, etc....is also used and not call simplify as is?

 > restart;
 > ode:= diff(y(x),x) = 2+2*sec(2*x)+2*y(x)*tan(2*x); my_sol:= y(x) = ((2*x+sin(2*x))/(cos(2*x)*sqrt(1/cos(2*x)^2))+_C1)*sqrt(1+tan(2*x)^2); odetest(my_sol,ode);

 > #now simplify the solution first simplify(my_sol); odetest(%,ode);

 > simplify(my_sol) assuming x::real; odetest(%,ode);

 > simplify(my_sol,size); odetest(%,ode);

 > simplify(cos(2*x)*sqrt(1/cos(2*x)^2))

 >

## To get a free member from the expression...

Hello. Let's say I have expressions of different lengths - linear combinations of some functions with some coefficients. And there is a free member. Is there a way to get out of these expressions free member? That is func(A)=78.34