Carl Love

Carl Love

28055 Reputation

25 Badges

12 years, 363 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are replies submitted by Carl Love

@Milos Bilik If you extract specific columns, as in M[2.., 4], M[2.., 7], then they already are Vectors; no further conversion is needed.

@Markiyan Hirnyk 

The NonIsomorphicGraphs command is much more useful for this purpose than the IsIsomorphic command that I used. Unfortunately, neither of these commands is listed on the help page ?GraphTheory. If they had been, I would've used NonIsomorphicGraphs.

@Milos Bilik 

If M is the Matrix, then do the extraction as M[2.., [4,7]]. That says "rows 2 to the end, columns 4 and 7". Converting dates to floating point is probably more complicated. I'd need to see the date format to see what you mean.

Your graph is very likely a cluster graph. Look up "graph clustering" in Google. You will need to use an algorithm for identifying the clusters. I don't know if there is any algorithm for this already in GraphTheory. Once the clusters are identified, it is easier to draw a meaningful representation of  the graph. Do a Google image search on "cluster graph" to see what I mean.

@aamirkhan 

kernelopts(version);

 

@LaineTrance 

RationalRoots:= proc(f::And(polynom(integer), satisfies(f-> nops(indets(f,name))=1)))
uses NT= numtheory;
local x:= indets(f,name)[], p, q, r;
     r:= select(
          r-> eval(f, x= r) = 0,      
          {0, seq(seq([p/q, -p/q][], p= NT:-divisors(tcoeff(f))), q= NT:-divisors(lcoeff(f)))}
     );
     if r = {} then printf("No rational roots") end if;
     r
end proc:

I also can run your worksheet without error.

@Doug Meade Maple's dsolve does support the numerical solution of BVPs. For example,

dsolve({diff(y(x),x$2) - y(x) = sin(x), y(0)=0, y(1)=0}, numeric);

     proc(x_bvp) ... end proc

@acer wrote:

Carl, you wrote that the problem was also exhibited when the problematic subsection was not empty. When it was not empty did it have a title?

There probably was at least a moment when it had a body but no title:  When trying to delete the subsection, I probably deleted the title first and then the body. But I've also probably done that many other times without it causing a problem.

What happened to the Answers to this Question? This was important material that I need to refer back to! If you look at the number of Replies in the Active Conversations list, it says that there are 10.

@John Fredsted Thank you. It works.

@AndreMenezes 

I think that I see where you're going with this. Maple's ability to convert between formal products and formal sums is very limited. You're better off just defining the log-likelihood function straight away.

Computing a maximum likelihod estimator.

restart:

 

Define the pdf:

fx:= x-> theta*exp(-theta*x);

proc (x) options operator, arrow; theta*exp(-theta*x) end proc

Verify it's a pdf.

int(fx(x), x= 0..infinity);

limit(-exp(-theta*x)+1, x = infinity)

simplify(%) assuming theta > 0;

1

Define a general log-likelihood function.

LogLH:= (pdf::procedure)-> sum(ln(pdf(x[k])), k= 1..n):

Apply it to our pdf.

LogLH(fx);

sum(ln(theta*exp(-theta*x[k])), k = 1 .. n)

LH:= simplify(%) assuming positive;

n*ln(theta)-theta*(sum(x[k], k = 1 .. n))

Maximize LH with respect to the parameter theta.

est:= solve(diff(LH, theta), theta);

n/(sum(x[k], k = 1 .. n))

Apply second-derivative test.

eval(diff(LH, theta$2), theta= est);

-(sum(x[k], k = 1 .. n))^2/n

Obviously that's negative if the variables are positive. So the maximum-likelihood estimator for theta is the reciprocal of the arithmetic mean of the data.


Download Likelihood.mw

 

@AndreMenezes There are several ways. It would be best if you told me what your goal is. The most basic way is

Pfx:= unapply(prod, x);

A problem with that is that I suspect that you want n to represent the number of elements in x, and the function above doesn't encapsulate that. This does

Pfx:= ()-> mul(fx(x), x= args);

Then you can do

Pfx(x,y,z);

or apply Pfx to any number of arguments.

@Kitonum It's not entirely clear what the OP wants, but I assumed that they wanted the new to equal the old F, so k1 must contain C, and k2 must contain L. But perhaps you're correct that it's the linear terms of CL, and x1 that are wanted.

@tomleslie I think that everything in the OP's code works as it did 10 years ago. These are after all documented features, and they're still documented. If the OP were trying to use undocumented features that worked 10 years ago, that would be a different matter.

First 403 404 405 406 407 408 409 Last Page 405 of 709