MaplePrimes Questions

Thank you

Your answer makes sense if Maple evaluates from innermost to outermost, so the substitution in T2c takes place AFTER Test is evaluated with a symbolic value of "n".

 But it doesn't explain why the "assuming" examples work - or don't work. If "Test" is evaluated first, then none of the examples should work; if the assumption is passed through "simultaneously" (whatever that means), then the wording of the error message doesn't make sense...

Hi there, I'm trying to write an Algoritm to solve a Stable Marriage Problem and have written what I think should work but it doesn't.  Any hints or tips on how to fix it would be greatly appreciated!

 

stableMatching:= proc(M,W)
 local n,i,j,k,c,d,g,Mm,Ww,s:
    g:=0:
    c:=0:
 with(ArrayTools):
    n:=max(Size(M)):
       Mm := Array(1..n): #stores...

The attached file demonstrates that a substitution into a piecewise function appears (sometimes) to execute the wrong half of the function.

If I use "assuming" instead of substitution, the assumption appears to get through to the piecewise function, but only sometimes.

I don't understand why this happens. Can anyone clarify what is going on? See below.

Thank you.

 

______________________________________________________________

Dear friends,

 

I can compute,  with Maple 14, summe1:

> summe1= sum( sum( (`if`(1 < x , 1, 0))*   x*j, x=0..2), j=0..2);

 

However, when I modify  summe1 to summe2, I get an error message:

 

> summe2= sum( sum( (`if`(1 < x+j , 1, 0))*  (x*j), x=0..2), j=0..2);

 

> Error, (in eval/if) cannot determine if this expression is true or false: 1 < j

A simple question.

In Mathematica there is a function Boole:

Boole[expr]
yields 1 if expr is True and 0 if it is

I want to mix nicely formatted text and code, with the ability to hide the code and variable scoping

Something like

Some blah blah
{ First part of code snippet with scope 1
More blah blah
Second part of code snippet with scope 1}
Yet more blah blah
{ Second code snippet with scope 2 }

In Mathematica I would use the "Module" keyword, but there does not seem to be an equivalent in Maple, and I am not sufficiently...

I am new to using maple and I have an equation (z:= 7*x[1]+11*x[3]-10*x[4]+26*x[6]) which i would like to turn into a sequence of coefficient of x's i.e (7,0,11,-10,0,26). How would I go about doing this?

Hi everybody;

I have question about my calculation. my questions maybe looks like very simple.

>restart:
>lambda:=-1; alpha:=0.5;  N:=1;  m:=ceil(alpha);

                             lambda := -1
                ...

restart; with(Physics); Setup(mathematicalnotation = true):

am := Annihilation(N); ap := Creation(N)

Setup(op = {b[1], b[2], b[3]})

alg := seq(%Commutator(ap, b[i]) = 0, i = 1 .. 3), seq(%Commutator(am, b[i]) = 0, i = 1 .. 3), %Commutator(b[1], b[2]) = b[3], %Commutator(b[1], b[3]) = -Physics[`*`](2, b[1]), %Commutator(b[2], b[3]) = Physics[`*`](2, b[2])

q := %Commutator(Physics[`.`](ap+am, b[2]), b[1])

p := expand(q)

ans := sort(p, [a, b])

Hey folks I have a question about how to use solutions from fsolve in future calculations without copying and pasting.

 

Here is the code...

 

Order := 13:
f := x -> -x + x^2 - x^3 + add(a[i]*x^i,i=4..11):
A := n -> coeff(series(f(f(x)), x), x^n):
fsolve({seq(A(k) = 0, k=5..12)}, {seq(a[j], j=4..11)});

 

Now this gives values of a[k] from a[4] to a[11] but then if I were to type a[5] in the...

I am trying to write my own procedure for the revised simplex method. I have defined my matrix and vectors and obviously my objective function I am trying to optimise. However I am having trouble with programming my entering and leaving variables.

For example I have the sequence 0, -20, 12. I need the smallest positive number i.e. 12 but how do I say this corresponds to the variable x[8] and thus in the simplex method the vector P[8] enters?

If you need any...

I got the range result as limit

ki:= t -> (sum(alpha1(S[j])*(exp(2*I*k*delta*t)-exp(S[j]*t))/((2*I*k*delta-S[j])*Q1(S[j])),j=1..3));limit(ki(t),t=infinity);
where : k,delta are constant and sum(alpha1([sj]),j=1..3) is number

the output is:

-.1294653014455612741589137389024249282843455188351695736221586639528345838460087707530271384645825938-0.8233085340292186435280681029574142108148445032573172243750416705060582056155292536631305980808392462e-1*I...

Hi, I am new to using maple and am having problems.

I have 3 values called R[1], R[2], and R[3] which correspond to 0, -20, 12 respectively. I would like to be able to find and output the smallest positive integer. Is there a maple function to do this? 

Thanks in advance for any help.

if i define

 

r[1]=4

r[2]=-7

r[3]=2

r[4]=-1

 

how can I find the number r that is the minimum, and define it as x?

so in this case, the minimum is -7 (r[2]), so i would want to define x as 2. 

p := (g+Delta*g*Zeta/omega-g*Zeta)*a[1]*b[2]+(g+Delta*g*Zeta/omega-g*Zeta)*a[2]*b[1]+(-Delta*g*Zeta/omega+g-g*Zeta)*a[2]*b[2]+(-Delta*g*Zeta/omega+g-g*Zeta)*a[1]*b[1]

q := factor(add(op(i, p), i = 1 .. 2))

q := g*(omega+Delta*Zeta-Zeta*omega)*(a[1]*b[2]+a[2]*b[1])/omega

here,throuth factor ,simplify the expression .yet,if i want the expression like this:

(g+Delta*g*Zeta/omega-g*Zeta))*(a[1]*b[2]+a[2]*b[1])

how do i?

thanks

First 1928 1929 1930 1931 1932 1933 1934 Last Page 1930 of 2434