Carl Love

Carl Love

28035 Reputation

25 Badges

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

MaplePrimes Activity


These are answers submitted by Carl Love

I will assume that all images are in the same size matrix. Each image should be considered as one-dimensional dataset. Singularity of the matrix form of those datasets makes no difference. Then we compute the covariance between the datasets. Suppose that P is a list of the matrices. Then do

Statistics:-CovarianceMatrix(convert~(P, Vector));

That's all! If the images are in matrices of different sizes, let me know.

The commands inv() and pinv() and the entire linalg package and even the constructors matrix and vector were superceded more than 15 years ago. The newer commands are much easier to use.

If you have further questions, please post your Maple worksheet.

I know that you have some interest in physics. Make an order-of-magnitude approximation of the number of atoms in the whole Universe. You may find the necessary data in the ScientificConstants package. Compare to 9^(9^2). For the sake of argument, let's say that one bit of data requires at least one atom, which is a ridiculous under approximation. What can you conclude?

Using the hint from Acer: Set

GCD:= Typesetting:-mn("gcd");

Then in the typeset title part of the plot command, use GCD for gcd. This is for display purposes only, not for the actual computation of gcds.

Use

TypeTools:-AddType(
   'Variable',
   v-> v::'indexed' and op(0,v)::{'identical'('x', 'y'), 'Variable'}
):
VarsParams:= e-> selectremove(type, indets(e, 'name'), 'Variable'):
CountVP:= e-> nops~([VarsParams(e)]):

Now if e is any expression (list, etc.), then CountVP(e) will return the number of variables and parameters.

Just take whatever command you used for the first plot, and replace el1 with

piecewise(ta1 <= 1 and ta2 >= 0, el1, undefined)

I'm a bit confused when you say "polar coordinates". What is the radial coordinate, r? Is it phi or theta?

Use solve(evalc(Im(...))). For example

solve(evalc(Im(x*ln(y))), {x,y});

The command evalm has no use in modern Maple. It is causing your problem. Simply remove it.

I recall myself and others showing you the copy command with respect to records a few weeks ago, and also discussing last name evaluation. The two concepts are related in a somewhat coincidental way: All structures that use last name evaluation also require copy. One of the uses of eval is to get past the last name to the actual structure. But eval is not a substitute for copy.

1. Do both the integral and the simplification with assuming a > 0. The eval is unnecessary.

2. Include the option allsolutions to solve. The z assuming complex is unnecessary.

What you want to display can be displayed by

`q*`(z) = piecewise(2/3 < z and z <= 1, 0, 1/3 < z and z <= 2/3, 1, 0 <= z and z <= 1/3, 2);

Of course, you can arrange it so that the values in the expression are filled in programmatically.

You could define an operator for double factorial:

`&!`:= x-> doublefactorial(x);

Then use it as, for example,

5&!2;

The 2 could be anything. It's simply there because a second argument is required.

Radicals aren't considered functions, and even sqrt gets converted to a form with an exponent, either 1/2 or -1/2. Try

hasradical:= e-> hastype(e, 'anything'^'fraction')

This is your third consecutive Question where the answer has been, essentially, "use unapply rather than ->" How can we improve your learning of this?

Yes, the dimension is the number of equations of the form variable=variable in (one branch of) solve's output. It is trivial to count these. If we have

Soln:= [solve(...)];

then

Dims:= (S::set(`=`))-> nops(select(evalb, S));
Dims~(Soln);

returns the dimensionality of each corresponding solution branch. This only handles branches that are sets of equations, which is the most-common case, but solve can return inequalities and piecewise expressions also.

Here is a procedure for it:

Conditioned:= proc(
   event::{relation, set(relation)},
   cond::{relation, set(relation)}, 
   RV::name= RandomVariable &under Statistics:-RandomVariable
) 
uses St= Statistics;
local 
   Event:= `if`(event::relation, {event}, event),
   Cond:= `if`(cond::relation, {cond}, event)
;
   if nargs=3 then 
      (Event,Cond):= subs(lhs(RV)= St:-RandomVariable(rhs(RV)), [Event, Cond])[]
   fi;
   #union used rather than intersection because Probability considers a set
   #of relations to represent the intersection of the corresponding events. 
   St:-Probability(Event union Cond)/St:-Probability(Cond)
end proc:

The procedure can be used like this:

Conditioned(X^2 > 12, X > 2, X= Poisson(2));

or like this:

Y:= Statistics:-RandomVariable(Poisson(2)):
Conditioned(Y^2 > 12, Y > 2);

 

First 169 170 171 172 173 174 175 Last Page 171 of 395