nm

11378 Reputation

20 Badges

13 years, 42 days

MaplePrimes Activity


These are questions asked by nm

If I want to make a display of data, say 2 columns of data, with a heading on top of each column, how would one go about this in Maple? This will be for display purposes only (say for final result of a homework result, etc..)  

In Mathematica, I use the Grid command. I am not sure how to do this in Maple. I could not find Grid like command in Maple.

I can generate the data in 2 sequences  in Maple, but need to insert a heading, and also need to insert frame around eveything.

Here is an example:

f:=x->x^2;
g:=x->x^3;
data=[seq([i,f(i),g(i)],i=0..5)];
    #data = [[0, 0, 0], [1, 1, 1], [2, 4, 8], [3, 9, 27], [4, 16, 64], [5, 25, 125]]

The above data has 3 columns, 6 rows. I need to insert first row also called {"index","f","g"} and then display all in nice table form. This is how I would do the above in Mathematica to give idea of what I looking for

f[x_] := x^2;
g[x_] := x^3;
data = Table[{i, f[i], g[i]}, {i, 0, 5}]
    (* {{0, 0, 0}, {1, 1, 1}, {2, 4, 8}, {3, 9, 27}, {4, 16, 64}, {5, 25, 125}} *)

And this is below the part I do not know how to emulate in Maple:

data = Insert[data, {"i", "f(i)", "g(i)"}, 1]
    #   {{"i", "f(i)", "g(i)"}, {0, 0, 0}, {1, 1, 1}, {2, 4, 8}, {3, 9, 27}, {4, 16, 64}, {5, 25, 125}}
    # now use Grid to format with frame around everything
Grid[data, Frame -> All]

sometimes, the maple server goes in a loop and runs full CPU. Waiting makes no difference. It just hanged. Even stopping the computation from the UI makes no difference (i.e. cliking on the "interrupt the current evaluation" button). Only way I found is go to task manager and terminate the mserver.exe by force.

The problem now is that I have to close Maple and start all over again. Since I can't start a new computation or do anything if the server is down.

I am just asking if there is a better way to do all this. For illustration, this int() command below hangs the server, so you can try the same thing I am seeing. This is on Maple 18.02, windows 7, 64 bit.

Make sure to save all your work before running this. This is just one example. I have many more where maple hangs like this (i.e. the interrupt does not terminate anything and the server keeps running)

y := 1;
z := 2 + x + y;
s := 1/2;
m2 := 5325;
m1 := 5279;
mz := 106055/10;

int1 =evalf(int(1/z^3 *(x + y + 2* x*y)* (1 + s^2/(2 *m2^2* z)) *exp(-(m2^2*x + m1^2*y)/s^2 + (mz^2 *(x + y + 2 *x*y))/(2* s^2* z)), x=0..1));

After I do

restart;
plot(cos);

Now I right-click on the plot, and from the menu change the "line" to "dashed" style, so the plot becomes like this:

Now I would like to obtain the Maple plot command that would have generated the above plot, so I can use the command later in my script.  I could not find a menu option to show the Maple command.

Maple 18.02 on windows 7

I'd like to implement this in Maple, but being a newbie having hard time getting the syntax right:



This is what I tried:

a:='a';
f:= i->product( `if`(evalb(i<>j),(a-z(j))/(z(i)-z(j)),NULL),j=1..3);

but it is not skipping the i=j case, since when I call it with f(1) I get division by zero.

f(1);
Error, (in product) numeric exception: division by zero

Tried also

f:= i->product(`if`(evalb(not(i=j)),(a-z(j))/(z(i)-z(j)),NULL),j=1..3);
and few other things. I think the reason it fails is deeper than my level of Maple undertstanding.

How would you do this in Maple?

I am really baffled by this. I was starting to think Maple control system is good, only to find I get an error when I try to obtain the controllability Gammian for a state space system which is time varying.  Maple only seem to support a non-time varying A,B,C,D for this function.  Can someone please confirm this, or may be I am doing something wrong?

I was trying to verify my hand solution for a HW using Maple.

----------------------
restart:
alias(DS=DynamicSystems):
A:=Matrix( [[2,-exp(t)],[exp(-t),1]]);
B:=Matrix([[0],[1]]);
sys:=DS:-StateSpace(A,B);  #created OK
m:=DS:-Grammians(sys);

Error, (in DynamicSystems:-Grammians) symbolic value(s) in model: t, exp(t), exp(-t)
---------------------------------------------------

If the system is time invariant, then it works. Example from help:

-------------------------------------------------
restart:
alias(DS=DynamicSystems):
aSys := DS:-StateSpace( <<-5,3>|<3,-4>>, <<2,3>>, <<1,0>|<0,1>>, <<0,0>> ):
m:=DS:-Grammians(aSys);
---------------------------------

The main advantage of using computer algebra system for control system is to be able to do things using symbolic which is much more powerful than just numerical computation as with Matlab. There is nothing in the above linked to help page that says Maple does not support time varying state space for this function (unless I missed it).

Is it possible to add support for LTV in Maple 19?

ps. note that the ControllabilityMatrix works on LTV:

m:=DS:-ControllabilityMatrix(sys); #OK

But I wanted the Grammian.

First 184 185 186 187 188 189 190 Last Page 186 of 200