## Likelihood function and finding some constants...

Hello Friends

I have a critical problem that I wish to solve it with maple

suppose we have a list like following: y_obs=(2,4,8,7,9,52,35,478,52) and corresponding variance σy=(.2,.3,.5,.87,.1.2,.22,.78,.99,1.5)
we know y as the function of x described such as y_theoric=x+p and minimizing X is

X=Sigma [(y_theoric-y_obs)^2]/σy which includes the sum of nine numbers...

the question is:

How we can find p from likelihood function and plot general behavior of y versus of x through two above series?

for example this solution used in article under the names Hubble parameter data constraints on dark energy by Yun Chen and Bhatra Ratra (Physics Letters B)

Thank you

## How do I choose two coordinates points over four p...

Hello everyone! I am currently solving on a basic coordinates points for my final year project. This is a part of my coding in maple.

ans := solve({eq5, eq6}, {P2, Q2});
{P2 = 3.222860033, Q2 = 3.170614592},

{P2 = 1.572224939, Q2 = 5.670614592}

I am finding the points of P2 and Q2. From there after solving for eq5 and 6 it will gives two points for P2 and two points for Q2. So how am i going to choose the points using maple coding without copy paste the answer?

Really appreciate if any of us can help me. Thank you in advanced :)

## extracting coefficients of exponential functions...

Consider for instance the following equation:

Eq:=(a-4)*exp(4*x)+(b+1)*exp(2*x)+(c-2)=0

How can I list the coefficients of the exponential functions and also solve the equation for the constant parameters

a, b, and c?

I tried

[coeffs(collect(lhs(EQ), exp), exp)] =~ 0;

but it did not work. Thank you for your help.

## What does this plot look like?...

I mean

```restart;
plots:-implicitplot(sqrt(b)*sqrt(1-4*p/b)-2*arctan(sqrt((9*p/b-22201/10000)/(9/4-9*p/b))) = 0, b = 0 .. 5,
p = 0 .. 5, gridrefine = 2, rational);``` I find the above result unsatisfactory.

## Differentiating in a sum with arguments from a lis...

Hi, my problem is that I have a set of variables stored in a list, then when I try to sum with differentiation inside the sum, Maple immediately tries to differentiate before summing, thus returning zero.

So I define a list coords := [t, r, theta, varphi], then call sum(diff(r^2, coords[k]), k = 1 .. 4), however Maple does the differentiation first, so it becomes 0 instead of 8r.

I attached the maple worksheet with what I did, on the first line I define the list with variables, on the second line I show that maple evaluates diff(r^2, coords[k]) to zero before doing the sum, where k is what is being summed over, on the third line I show that it copes fine if a specific element of the list is called, on the fourth line I show that summation over elements of the list is fine, and the last two lines show an example of the kind of thing I would like to do

Is there a way to make this work?

## How can I see, if the result of numeric integratio...

Dear Maple Primes,

could you, please, help me with numeric integration? I’m new in numeric integration and can’t reach desired precision of a result.
Here is the integral f(xmax) that I try to compute for different values of xmax from the interval 0.025..0.24 :

f:=(xmax)->Int(K*F*Int(G*F,x=x..xmax,method=integrationmethod),x=x0..xmax,method=integrationmethod)

where x0 is lower limit of outer integral, x0 := 0.025

and K, F and G are functions of x

K:=x-x0

F:=(a1+a2*x+a3*x2+a4*x5)/(b1*x+b2*x2+b3*x6)

G:=exp(c1+c2*x+c3*x7)

with

a1:=8e3; a2:=6e4; a3:=3e4; a4:=1.8e8;
b1:=9.2e17; b2:=1.1e18; b3:=4.6e21;
c1:=8.202046; c2:=-12.31377; c3:=-818043.42;

Please, notice, that G (as well as G*F) is a steeply decreasing function on the interval x = 0.025..0.24.

I get "a seemingly correct" result (that means that f increases as xmax intreases), when I try to plot f(xmax) for the following "guessed" options

Digits:=15
integrationmethod:=_d01akc
plot(f,0.21..0.24,color=black)

What is puzzling me is that I get a different "seemingly correct" result, when I modify the integral f by,
at fist, multiplying G by a constant (for example Const:=1e20; G:=Const*exp(c1+c2*x+c3*x7) )
and, second, plotting the f divided by this constant:

plot(f/Const,0.21..0.24,color=red)

The following Figure presents the values of f plotted versus xmax with (red curve) and without (black curve) using of the constant Const: Dear Primes, could you, please, comment on this difference? Because the only indicator that I have (from the analysis of G, F and K) is that f must be a monotonically (and stricktly) increasing function of xmax.

Please, find the maple worksheet in attachment.

Thank you in advance!
Maks

for_primes_numeric_integration_v02.mw

## How do I find the maximize and minimize of this fu...

I want to find the maximize and minimize of the function
f:=x->(cos(x)+sqrt(3)*sin(x))/(cos(x)+sin(x)+2);
I tried
minimize(f(x), x, location = 'true');
and
maximize(f(x), x, location = 'true');
But I didn't get the results.  How do I find the maximize and minimize of above funciton?

## How to fix for-loop slowdown...

Hello,

I have a very large expression I'm tring to average (by doing limit(1/L*int(<expr>,t=-L..L),L=infinty) ). However, given that this expression is so large (sum of 11k terms), I'm was looking for ways to speed up the calculation and use less RAM.

I found that applying the lim@int seperately to each term of the sum helps. Also, since my integrand has various functions of other variables (eg. f(x), g(y), etc), Maple seems to go faster if I freeze those functions using frontend.

However, the problem I'm running into is that, as I'm running through my for-loop to apply lim@int to each term, Maple starts running slower and slower, as well as taking more and more RAM. Additionally, it doesn't go to completion because it runs out of stack space.

Is there an optimization trick to avoid this problem? I've tried garbage collecting after each iteration; that helps the RAM problem (at a cost of speed), but it still slows down over time.

I've attached my code: MWE.maple. Fair warning: on a non-server computer, it is liable to run very slow.

## convert Ei1 to Ei...

Is it possible to convert E1(x) to Ei(x) explicitly?

In particular I have this expression which is real, but imaginary numbers appear due to the definition of Ei1 for negative arguments.

(-exp(j*z)*Ei(1, j*z)+I*Pi*exp(-j*z)+exp(-j*z)*Ei(1, -j*z))/(2*j)

j>0,z>0

Thank you

## Can fsolve in this maplesoft appication be explore...

In the application whose link is below, an error message results when I right click the fsolve command and select explore.

https://www.maplesoft.com/applications/view.aspx?SID=119851

I would like to explore changes to several of the parameters in the equations named "sys", especially the value of Qoutflow. Can this be done and, If so, how can the solved values, Q1, Q2, Q3, and H be graphed as the slider values of individual parameters values are modified?

## fetch the dsolve event time ...

1) How can i get the event time. This example 0.69313.

2) I don't want to see the Warning.How can i do it?

`Warning, cannot evaluate the solution further right of .69314729, event #1 triggered a halt`

## Error, (in dsolve/numeric/bvp/convertsys) unable t...

how i can dsolve this equations and  convert the equations to an explicit first-order system ?

Also parameter 'p' is unknown and shoud be found.

Error, (in dsolve/numeric/bvp/convertsys) unable to convert to an explicit first-order system
error2.mw

 > > > with(PDEtools, casesplit, declare);L:=0.75e-4: (1)
 > eq1:=0.2079268293e-3*(diff(psi(x), x, x))-101.2059621*(diff(u(x), x, x))-101.2059621*(diff(w(x), x))*(diff(w(x), x, x)); ## eq2:=0.2079248162e-3+29.57317072*psi(x)-29.57317072*(diff(w(x), x))-1.996189024*10^(-9)*(diff(psi(x), x, x))-1.996189024*10^(-9)*(diff(w(x), x, x, x)); ## eq3:=151.8089432*(diff(w(x), x))^2*(diff(w(x), x, x))+101.2059621*(diff(u(x), x, x))*(diff(w(x), x))+101.2059621*(diff(u(x), x))*(diff(w(x), x, x))-0.2079268293e-3*(diff(psi(x), x, x))*(diff(w(x), x))-0.2079268293e-3*(diff(w(x), x, x))*(diff(psi(x), x))+29.57317070*(diff(w(x), x, x))-29.57317072*(diff(psi(x), x))-1.996189024*10^(-9)*(diff(psi(x), x, x, x))-1.996189024*10^(-9)*(diff(w(x), x, x, x, x))-p*(diff(w(x), x, x));   (2)
 > >  (3) ## A strange interface bug...

The procedure F computes the smallest prime factor of  ithprime(n)-2

`F := n -> ifactors((ithprime(n)-2)):`

F(11);
29
Strangely, print(F)  must be interrupted!
print(F);
Warning,  computation interrupted

Also,

`F := n -> ifactors((ithprime(n)-2));`

Warning,  computation interrupted
Warning,  computation interrupted

(F is defined, only the display fails).
This happens only for interface(typesetting=extended).
In Maple 2017 it was OK.

## Error, numeric exception: division by zero...

how I can remove this error.

Error, numeric exception: division by zero

code2.mw

## Possible bug with pdsolve and assuming?...

Hello,

I was trying to apply some assumptions to a pdsolve command and noticed a strange error. Here's a minimal working example.

```restart():

pdsolve(diff(f(t,x),t) = 0, {f(t,x)}, ivars = {x, t}) assuming x::real:```

returns

`Error, (in simpl/relopsum) invalid terms in sum: diff(f(t,x),t) = 0`

Is this indeed a bug, or is it expected behavior?

﻿