MaplePrimes Questions

Search Questions:

Latest Questions Latest Questions Feed

I am generating polynomials and I want to iterate each term in the polynomial and do something accordingly. I collect the first term. I wish to extract the tuples of 1,1,1 and 2,1,1 out and do some calculations.... Do you know how I could achieve that? Thank you:)

 

expr1 := mu*(h[1, 1, 1]+h[1, 1, 2]+h[1, 1, 3]+h[1, 1, 4])+J1*(h[1, 1, 1]*h[2, 1, 1]+h[1, 1, 2]*h[2, 1, 2]+h[1, 1, 3]*h[2, 1, 3]+h[1, 1, 4]*h[2, 1, 4])+2*J2*(h[1, 1, 1]*h[1, 1, 3]+h[1, 1, 2]*h[1, 1, 4]+h[1, 1, 3]*h[2, 1, 1]+h[1, 1, 4]*h[2, 1, 4]);
mu (h[1, 1, 1] + h[1, 1, 2] + h[1, 1, 3] + h[1, 1, 4]) + J1 (h[1,

1, 1] h[2, 1, 1] + h[1, 1, 2] h[2, 1, 2]

+ h[1, 1, 3] h[2, 1, 3] + h[1, 1, 4] h[2, 1, 4]) + 2 J2 (h[1,

1, 1] h[1, 1, 3] + h[1, 1, 2] h[1, 1, 4]

+ h[1, 1, 3] h[2, 1, 1] + h[1, 1, 4] h[2, 1, 4])
expand(expr1);
J1 h[1, 1, 1] h[2, 1, 1] + J1 h[1, 1, 2] h[2, 1, 2]

+ J1 h[1, 1, 3] h[2, 1, 3] + J1 h[1, 1, 4] h[2, 1, 4]

+ 2 J2 h[1, 1, 1] h[1, 1, 3] + 2 J2 h[1, 1, 2] h[1, 1, 4]

+ 2 J2 h[1, 1, 3] h[2, 1, 1] + 2 J2 h[1, 1, 4] h[2, 1, 4]

+ mu h[1, 1, 1] + mu h[1, 1, 2] + mu h[1, 1, 3]

+ mu h[1, 1, 4]

I'm taking my first steps with maple and pdsolve, trying to run the example in the maplesoft support page:

http://www.maplesoft.com/support/help/Maple/view.aspx?path=examples/pdsolve_boundaryconditions

which reads

>
> restart; with(PDEtools);
> U := diff_table(u(x, t));
>

and I get a solution that is different from the web page, and when i run

Im using maple 13. Any tips about what's wrong?

 

regards

One can write 

restart;
alias(C=binomial);
C(4,2);

or

restart;
C:=binomial;
C(4,2);

and then both work the same. In the first case, the replacement of "C" by "binomial" is done at parsing time before evluator gets hold of the code, while in the second case, the replacement is done at run-time (evaluation).

So alias will be more efficient and more safe, I assume.

Is that all there is to it, or are there other more subtle and important reasons to use alias vs. :=  when one want to bind long name to smaller ones to save on typing.

 

Root of answer ...

August 19 2014 iman 10

I am newbie in Maple, and trying to understand when to use operator `if` as I see in some code vs. normal if. This is in context if using map()

I noticed I can write

A:=[seq(i,i=1..10)];
f:=x->x^2;
map(x->`if`(x<5,f(x),NULL),A);

or

map(x->if x<5 then f(x) fi,A);

And they both work the same. When should one use `if` vs. if? with the case of `if` I had to give a third argument NULL for the else part, while with using direct "if", I did not have to give the "else" part.

Also, suppose I want to use  IF .. THEN .. ELIF ... FI, then how would this be done using the operator syntax? in normal "if", I can write

A:=[seq(i,i=1..10)];
f:=x->x^2;
map(x->if x<5 then f(x) elif x=5 then x else x-1 fi,A);

Actually if I understand better when `if` is meant to be used vs. where the normal "if", I might understand more its use. 

 

ps. I did look at the help here but did not see it recommend when to use over the other (unless I overlooked it)

 

 

 

 

Test_modify.mwGood Morning Everybody,

Can anybody demonstrate how I can convert the output from the procedure into an N X N Matrix depending on the nops from the attached file. Thanks everybody.

 

Regards,

 

Moses

 

Hello,

In a subsystem, i defined parameters like this in the "parameters" area :

 

In the "diagram" area, the parameters are not updated because i see this panel :

 

Do you know why the parameters are not updated (possibly only on visualization) ? And if yes, how i can do to visualize in this last panel the value of the parameters updated ?

Thanks a lot for your help

Hi,

 

I want to calculate a new position (X,Y,Z) for a cartesian model with 3 points (dX,dY,dZ) but  I got a problem, my point is a parameters, so I can't change it in the simulation in real time with a Input signal on the components. Does It exist a solution for convert a parameters to a variable to get a Input signal?

Exemple of my calcul:

eq:= [x(t)= dx+sin(dy/dz), y(t)=dy+20,z(t)=dz]

 

Thanks!

with(LinearAlgebra):
a:=Vector([1,2]);
b:=Matrix([[1,2],[1,2]]);

Say if I need a^T * b * a, I will do this:

VectorMatrixMultiply(Transpose(a), b);
VectorMatrixMultiply(%, a);

But this seems too long for such a simple matrix (and vector) computation. I am sure there must be an short way.

What if I need more computation, like

 

a^T * b * c*d*f*g* a, where c,d,f,g are other 2x2 matrices.
 If I were to use the above command, that'll take a long time to input.

Thanks,

Hello,

In my model, in order to better follow a analytical study, i would like to make some calculations with my paramters.

For example, I have defined :

xa=1

ya=2

R=sqrt(xa²+ya²)

I would define R in the parameters area so as to use it for some definitions in the definition of body (i use especially maplesim for multibody systems.)

How is it possible to define parameters thanks to relations ?

I am writing a code in maple and I need to run another code at the end,  something like external subroutine. Could you possibly help me about it? 

Thanks

f:=x+y+y;

diff(f,x);
diff(f,y);
diff(f,z);

What I hope to get is a vector with i-th entry being the dervative of f, differentiated w.r.s.t the i-th parameter, like this

Vector([1,1,1]);

 

Is there a more efficient (built-in) command to do this?

 

VectorCalculus[diff] does not do what I want.

 

Thanks,

 

casper

 

Hi

I am using the Map function from the Threads package on a quad core processor, it only seems to use one thread however. The Array I am processing holds over 2 million entries and takes over 10 hours to calculate (single threaded).

Is this behavoir normal? I already tried to define a tasksize but that didn't work.

Kind regards

Jasper

Hi there

I have have a 18*18 matrix which almost each of its element are in symbolic form. Now I need to have all of its eigenvectors. Unfortunately when I use the "Eigenvalues()" function in maple i got nothing. In fact I got the error which comes below.

Error, (in content/polynom) general case of floats not handled

I need to know if there's a solution to eliminate the error? If not, what can I do to determine the eigenvectors and eigenvalues in symbolic form?

I'll be appreciated your help

Hi Maple friends.

I have a plot. I click on the plot, and the blue border appears the around the plot. I press the delete key on my keyboard, and the plot is not deleted. Not deleted when I press the backspace key either. I can right-click on the plot and choose 'cut', but that just copies the plot to the clipboard.

So how can I delete a plot from the worksheet, without deleting anything else?

Thanks in advance.

3 4 5 6 7 8 9 Last Page 5 of 1044