Items tagged with subs subs Tagged Items Feed

Cause CodeTools:-Test will not eval the paramater:

f := x -> x+1;

y := 2;

CodeTools:-Test( f(1), 2); # this will work as normal

CodeTools:-Test( f(1), y); # this will not work because `y` will not eval as 2


So current my solution is

test := subs(y=2, () -> CodeTools:-Test( f(1), y));




I don't know is there any more proper solution for this.

More general, is there a way to force evaluate an `uneval` parameter?


Hi Everyone,

I have an expression that contains a second order derivative: EXPR:=ay''(x) + bz'(x) + cf'(x)+... The variable y  obeys an ordinary differential equation, y''(x) = f(y,x). I would like to replace the second order deriavtive in my expression with f(y,x). So far I have tried applyrule([y''(x)=f(y,x)],EXPR), subs(y''(x)=f(y,x),EXPR) and algsubs(y''(x)=f(y,x),EXPR) and nothing seems to work. Any helpful suggestions?


Hi again,


I am lost... again. I worked with the Physics package and have obtained my result in form of a lengthy equation of commutators of non-commuting objects. So basically my problem is solved, except that I now want to compute some examples to see, if everything is correct. For that purpose I want to replace now the non-commuting objects with explicit matrices, compute the result and see if it agrees with numerical studies. However, I have no clue which command to use, because if I try it with subs, then the multiplication is of the wrong type and Maple won't multiply my matrices. I tried to use eval but wasn't successful.

Here is an exampe to see what I mean.


Thank you for your time



The following MWE shows what I mean:




    local eq;



    return eq;

end proc:


test();  # yields -[-MZ,MY] - [MZ,MY]


%  # yields 0



Any ideas how I can solve this? I would like to return the simplified version.


How can I substitute a function in a matrix? This is what I tried but it's not working at all:

T := GenerateMatrix([lign1, lign2, lign3, lign4],[x, y, z], augmented);

Then I'd like to substitute another function with lign1:

T2:=subs(lign1=lign5, T);

But T2 = T and that wasn't really the point.


Sorry if the answer is obvious no amount of searching has helped me so far. I hope this question isn't too ridiculous.


kappa := Vector(7, [1,w[1]*(1-phi+phi*(1-1/(1+exp(-mu[p]-tau[p3]))))+(1-w[1])*

Download kappa.txt

Here is the expression, I am trying to simplify, given a set of rules.

I have tried different substitutions, using simplify with side rules, applyrule, eval, subs, algsubs.

But none seem to be working as the way I want them to be.


Is there a better way?





Do anyone know the keyboard shortcut to the standard subsribt in Maple 18 on a macbook with OS X? 




I'm working on a complex problem in Composite Materials. I've gotten to a near-result 6x6 matrix, with several cells containing polynomial denominators. I have an equation for simplifying these, which boils the polynomials down to a single variable, but I can't seem to get it to substitute in. Can anyone help me solve this? The problem is also time-sensitive.


a problem of subs...

August 17 2014 taro 110

Hello people in mapleprimes,


I want to modify the next equation: 

(**)  a:=sigma*omega*alpha = mu(H, H)*s*omega*gamma1*L+mu(F, H)*s*L-mu(F, H)*s*L*gamma1;

to be

(***)    sigma*omega*alpha = mu(H, H)*s*omega*gamma1*L+(1-gamma1)*mu(F, H)*s*L;


For that, first I defined b as


, and substituted this to a with



But, what I could obtain was only the orignal equation (**) not (***).

Please tell me how to use subs to this problem to obtain (***)。

Thanks in advance.



I know


works well as for what I wrote (**) as above.

But, originally, it was a result from substituting various equations into an equation.

For it, (****) does not work well.  



Hi there

I'm taking my first steps with maple and my question is not exactly briliiant

Putting in a simple way, I'm trying to solve sth that looks like this

> li := a*[cos(7*x+8*x*y+9*y)*cos(-7*x-8*x*y-9*y)];
             a [cos(7 x + 8 x y + 9 y) cos(-7 x - 8 x y - 9 y)]

and i want to replace


getting (if i do it by hand)

> algsubs(7*x+8*x*y+9*y = 20*y, li);
                    a [cos(20 y) cos(-7 x - 8 x y - 9 y)]

my question, is there an elegant way to do it? sth that would look like this?



thank you for any tips

Hi There

I'm getting started with maple and facing a doubt about using subs, somehow it does not seem to work, this is my expression:


> restart;
> theta := omega*t-k*x;
                                omega t - k x
> phi[1] := -(1/2)*H*c*cosh(k*(z+h))*sin(theta)/sinh(k*h);
                   H c cosh(k (z + h)) sin(-omega t + k x)
                                 2 sinh(k h)              
> diff(phi[1], t, t);
                H c cosh(k (z + h)) sin(-omega t + k x) omega
              - ----------------------------------------------
                                 2 sinh(k h)                  
> td := simplify(subs(z = 0, %));
                   H c cosh(k h) sin(-omega t + k x) omega
                 - ----------------------------------------
                                 2 sinh(k h)               
> simplify(subs(cosh(k*h)/sinh(k*h) = 1/tanh(k*h), %));
                   H c cosh(k h) sin(-omega t + k x) omega
                 - ----------------------------------------
                                 2 sinh(k h)               
I cannot subs cosh/sinh = tanh. I would like to know why.

Any tips? Thank you

So suppose in one maple worksheet, I run:

>assume(w, real); y:=2*w;
>save y, "test.m";

And then I open another, and run

>read "test.m";

The substitution won't work, while it works if I don't make any assumptions about the variable w.  However, in the piece of code I'm actually running (this snippet is just to illustrate the problem), I need to make the assumption that w is real for solving a system of equations (otherwise maple seems to run out of memory).  Is there a way to save my result y in such a way so that I can make substitutions for w later?

Hi everyone,

I wanted to plot the fourier series up to a given order of a step function using the code I attached, to change the order I used a sum with upper boundary M. When setting M to a particular value and plotting the function the result is obtained within a second, when on the otherhand using plot(subs(M=11,...),...) it takes close to a minute to produce a picture.

This might be a misuse of subs, in any case, I wanted to share my experience and maybe get an explanation about why this takes that much longer.




f := proc (t) options operator, arrow; sum(-4*sin((2*n+1)*t)/(Pi*(2*n+1)), n = 0 .. M) end proc

proc (t) options operator, arrow; sum(-4*sin((2*n+1)*t)/(Pi*(2*n+1)), n = 0 .. M) end proc


plot(subs(M = 11, f(t)), t = 0 .. 2*Pi)


M := 11; plot(f(t), t = 0 .. 2*Pi)



I wish to substitute Re=W[0]/V[0] in the expression V[0]/W[0] * diff(u(t),t). I tried using the subs command but it didn't work. Any help would be appreciated !

1 2 3 4 Page 1 of 4