Carl Love

Carl Love

28115 Reputation

25 Badges

13 years, 136 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are answers submitted by Carl Love

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);

 

Try command eliminate instead of solve. In cases where solve returns nothing, eliminate returns partial solutions and residual equations. Pay particular attention to the number of these residual equations.

You can get the matrix from Excel to Maple by

M:= ExcelTools:-Import(...);

You can plot that matrix directly (converting to ordered triples not necessary) by

Statistics:-ScatterPlot3D(M, lowess, ...);

See help pages ?ExcelTools,Import and ?Statistics,ScatterPlot3D. In particular, ScatterPlot3D has many options for refining the plot.

First 170 171 172 173 174 175 176 Last Page 172 of 396