Carl Love

Carl Love

28055 Reputation

25 Badges

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

MaplePrimes Activity


These are answers submitted by Carl Love

Wow, it's a very interesting example. And you seem to have the same programming philosophy as me. Anyhow, you can evaluate your expression like this:

eval(subs(z= 0.5, laplace= inttrans[laplace], r));

 

Here it is. Please let me know if this is correct.

Am:= m-> Matrix(m+1, m+1, (i,j)-> (-1)^(j-i)*binomial(m,i-1)*binomial(m-i+1, j-i)):    
Am(9);

Please stop using that module version of RandomCompositions. Use the procedure version that I posted about an hour after I posted the module. I even explained to you in detail how the procedure worked.

RandomCompositions:= proc(n::posint, k::posint)
local
     C,
     Compositions:= [seq(C-~1, C= combinat:-composition(n+k, k))],
     Rand:= rand(1..nops(Compositions))
;
     ()-> Compositions[Rand()]
end proc:

R:= RandomCompositions(8,6):
n:= 2^13:
S:= 'R()' $ n:
T:= map(lhs=rhs/n, Statistics:-Tally(op~([S])));

plot([op]~(T), style= point, symbolsize= 16);

Your sys is a module, so start with

exports(sys);

We see that tf is an export. Each module member is accessed with the :- operator. So,

sys:-tf;

The resulting object is a Matrix, so, finally

sys:-tf[1,1];

eval([seq(y=45*r*t, t= 2..150)], r= 5);

How about this?

subsindets(map([op], [op](ex_expr1)), indexed, h-> [op(0,h), [op](h)]);

Put the legend option on the individual plots. Then the display will merge them.

restart:
with(DynamicSystems):
with(plots):
sys := TransferFunction(1/(s^2+0.2*s+1)):
p1:=ResponsePlot(sys, Step(),duration=50,color=red, legend= "step"):
p2:=ImpulseResponsePlot(sys,50, legend= "impulse");
display([p1,p2],axes=boxed, title=`step and impulse reponses`);

Suppose that you call your C with symbolic arguments, so that it returns unevaluated:

C(n,m);

If you use C:= binomial, then the output will be binomial(n,m). But if you use alias, then the output will be C(n,m). This is very useful when you use an alias for a lengthy RootOf expression---one of its common uses.

There are two main differences between an `if` expression and a if statement. The first is that `if` is an expression, so it can appear as part of another expression. For example, `if` can be the first argument to seq. There is only one place where an if statement can appear as an expression: when it appears immediately after the -> of an arrow procedure (and this is only allowed in 1D input).

The second difference is that `if` can return unevaluated. For example,

ex:= `if`(x > 3, 1, 2);

eval(ex, x= 4);

     1

Here's how to build a compound `if` expression equivalent to if - elif - else expression that you gave:

[seq(`if`(x<5, f(x), `if`(x=5, x, x-1)), x= A)];

Note that I was able to use seq instead of map, which would not be possible with if. I think that seq is more efficient in this case because map involves a user-procedure call for each element of A.

In the cases that you present, it is mathematically impossible to get an answer any better than RootOf. Look up the Abel-Ruffini theorem.

Please put your Questions in the Questions section, not the Posts section. This is at least the third Question of yours that I've moved from the Posts section.

I don't see any changes that you've made since the last time that you asked about this code. There are very serious problems in your code such that it makes no sense to ask the above Question until those other issues are addressed.

First, the inverse tangent function is arctan, not atan. Second, you cannot make an assignment inside a return statement (or any other statement). Unlike C, in Maple an assignment is not an expression that can be part of another expression. Third, what's the point of having a loop if you're always going to return on the first iteration?

Correct these and then maybe we can discuss the rest.

All that you need is

a^%T . b . a

You do not need to use with(LinearAlgebra) in order to use these operators.

No subgroup in the set {8, 9, 10} is highlighted because none of them is normal.

G:= GroupTheory:-SymmetricGroup(4):
GroupTheory:-DrawSubgroupLattice(G);


A:= DerivedSeries(G);

map2(diff, x+y+z, <x,y,z>);

If the other code is in a text file, then use read. If it is in a string, then use parse. See ?read and ?parse .

First 293 294 295 296 297 298 299 Last Page 295 of 395