## Items tagged with subs

hi..

I dont know why ''Y'' in this code does not calculate?

Also in Determinant  should exist term ''Omega''!!!

however this term not apear!!

thanksZrO2.mw

 >
 > with(LinearAlgebra):
 > with(LinearAlgebra):
 > with(VectorCalculus):
 > E_c:=200e9:
 > rho_m:=2702:
 > rho_c:=5700:h:=1:Digits:=200:

## too blind to see...

I probably worked too hard, but this result seems strange to me:

In a second example (not shown here, but in atttached file) all goes well. It is probably very simple, but at this moment I better go for a walk outside.

best regards,

Harry Garst

mapleprimes.mw

## Substitute in procedure desn't work...

I have a procedure that uses substitute. Below is my code

my_proc:=proc(func::+)
... #some calculatin

subs([x[1] = 2, x[2] = 1], func);

end proc;
func:=5 + x[1]*x[2] + 10*x[1];
my_proc(func);

But when I call the procedure, her body is no substitution. What is the error? I can't understand what I did wrong?

## problem with subs rule...

subs.mw

hi...i have a problem with subs rule

thanks

 > eq81a:=m*diff(w(x,t),t$2)+c*diff(w(x,t),t)+E*Is*diff(w(x,t),x$4)+(P-f[p]*cos(Omega*t)-E*A/(2*l)*int(diff(w(x,t),x)^2,x=0..l))*diff(w(x,t),x$2)=0;  (1)  > bc81a:=B[1](w(0,t))=0,B[2](w(0,t))=0,B[3](w(l,t))=0,B[4](w(l,t))=0;  (2)  > nondimRule1:=w(x,t)=l*w[n](x/l,t/T);  (3)  > nondimRule2:=x=l*x[n],t=T*t[n],Omega=Omega[n]/T,P=P[n]*E*Is/l^2,f[p]=f[n]*E*Is/l^2,c=c[n]*sqrt(E*Is*m)/l^2,A=2*alpha*Is/l^2;  (4)  > intRule1:=Int(D[1](w[n])(x[n],t[n])^2,l*x[n]=0..l)=l*int(D[1](w[n])(x[n],t[n])^2,x[n]=0..1);  (5)  > dropnRule:=w[n]=w,x[n]=x,t[n]=t,c[n]=c,P[n]=P,f[n]=f,Omega[n]=Omega;  (6)  > eq81b:=convert(expand(l^3/(E*Is)*subs(int=Int,nondimRule2,intRule1,dropnRule,value(subs(nondimRule1,eq81a)))),diff);  >  > TRule;=solve(coeff(lhs(eq81b),diff(w(x,t),t$2))=1,{T})[1];

## Problem with instruction subs of Maple...

Hi, i have a problem with subs instruction. I'd like to change a function D(s) with symbol d/ds d(t), but i won't to calculate derivate, I want only change symbol. Thanks a lot.

## How to substitute algebraic variables and function...

I have a set of 15 equations in state space form, and I'm just trying to program a way to substitute all variables representing the time derivates as for example x__s_dot (t) as diff(x__s (t), t)  and diff( x__s_dot (t),t) as diff(x__s (t), t,t) so I can manipulate my equations easier.

The last half of the list xx has the variables that I want to substitute, the x,y and u (with respective diff(x__s (t), t) ) variables are always constant, but in the case of zeta, eta and u I might have indexes from 1 to n , in this case just 1 and 2.

I tried a bunch of methods including creating vectors with the seq, op commands and substituting them into my original equations with subs, algsubs but none of the things I programmed worked the way I wanted, I ended up with a very inefficient way , doing it manually, but the point is that I wanted to automate this bit. I've been doing maple for about 2 weeks and I still struggle a lot with it, I would greatly appreciate any guidence/advice.

My original equations are actually much bigger and my original code too, I tried to shorten it a bit just for making my problem simpler to understand but the equations still look really big here, If there is another way to format this question please do advice so.

EDIT : I think my last code was hard to understand because my equations were too big and it looked all messy and horrible, I edited to show just one vector of variables, I think that if it works here, it should work on the rest of my code:

 > interface(rtablesize=50):
 >
 > nq := 15;             xxUNDOT := [ seq ( xx[i], i = 1..nq),              seq ( diff(xx[i],t), i = 1..nq)];
 (1)
 > DOTL := [ seq ( xx[i], i = 1..nops(xx)) ]: DOTR := [ seq ( xxUNDOT[i], i = 1..nops(xx))]: Vector[column](DOTL),Vector[column](DOTR); for i from nq+1 to nops(xx) do newxx    := subs[inplace][eval](   op(i,DOTL) = op(i,DOTR) ,xx): end do:
 (2)
 > Vector[column](newxx);
 (3)

I tried to make a for loop that substitutes each variable one by one, but it only seems to work for the last term, I don't know why, please help or suggest another method? I also have diff(x__s,t,t) terms in my equations, not just diff(x__s,t), but I guess only by specifying the first derivate it should work?

Thanks.

## why algsubs fails here but subs work?...

Maple newbie here.

I do not understand why algsubs do not replace the symbol in the denominator in the following example, but does replace it in the numerator. This is on Maple 2017 on windows 7

Here is the expression

sol := u(x, t) = Sum((2*cos((1/2)*Pi*_Z1)+
2+4*(-1)^(1+_Z1))*sin(Pi*_Z1*x/L)*
exp(-k*Pi^2*_Z1^2*t/L^2)/(Pi*_Z1),
_Z1 = 1 .. infinity);

I wanted to replace _Z1  with n

But algsubs will not replace _Z1 in the denominator as seen in this screen shot but subs does:

From help, my impression is that algsubs is superset of subs. Only case where algsubs will not do what subs does is, according to help:

 The algsubs command goes recursively through the expression . Unlike the subs command it does not substitute inside indexed names, and function calls are applied to the result of a substitution

But There is no indexed names here?

Can someone please explain why algsubs fails to do the substitution in the denominator in this example?

## Manipulation of derivative symbolically ...

Dear friend,

please suggest a way for manipulation of derivative of a function symbolically. Assume

Typesetting[Suppress]([f(x)]);
Ex1 :=expand(diff(f(x+y)+x*f(x-y), x)^2)+expand(diff(f(x-y)-y*f(x+y), x)^2);

Result is as needed:

Ex1 := (D(f))(x+y)^2+2*(D(f))(x+y)*f(x-y)+2*(D(f))(x+y)*x*(D(f))(x-y)+f(x-y)^2+2*f(x-y)*x*(D(f))(x-y)+x^2*(D(f))(x-y)^2+(D(f))(x-y)^2-2*(D(f))(x-y)*y*(D(f))(x+y)+y^2*(D(f))(x+y)^2

But later I cannot use D(f) as a function. Expressions

subs((D(f)) = (t -> 1-t), Ex1);
subs(diff(f(x),x) = (t -> 1-t), Ex1);

do not handle it as a function.

## Remove subscripts from functions in list and group...

I have a list of functions which looks like this:

RR:={F[l, m-2, n-1], F[l, m+2, n], F[l, m+2, n-1], F[l-1, m+1, n-2], ...}

I wish to remove the first and second arguments from the functions, so only leaving the third argument containing the n's. I then wish to group these remaining terms together to shorten the list. i.e.

RR:={F[n-1], F[n], F[n-2]}


I have used the 'subsop' command with 1 and 2 specified as NULL in a loop, but I was wondering if there is a better way to do it? I like to avoid loops where possible and use some inbuilt Maple magic to make it tidier and (usually) more efficient.

-Yeti

## subs based on a variable...

I'm trying to use subs to substitute an unknown variable with a number in a Matrix

My Matrix is called values and I have the following

change := f2:

subs(change = 5, values):

This does nothing but when I have the following, it works as expected (All f2 in the Matrix values are replaced with 5)

subs(f2,values):

I'm wondering if its trying to find and replace 'change'. If this is the case how can I get it to use whats assigned to the variable. (I've tried eval(change) but that doesn't work either)

Many thanks

## an error occurred, diff received 0...

Hello, I have a function defined as

g :=  (x, y)->diff(u1(x, y), x, x)+diff(u2(x, y), x, y).

I want to define another function as follows

f :=  (y) ->subs(x = 0, g(x, y)) ,

Now, when I want to calculate numerical values for the new function f(0), f(0.1), f(0.2),..... and so on. The following massage appear

Error, (in f) invalid input: diff received 0, which is not valid for its 2nd argument.

What is the problem here.

Amr

## How to change summation index of Sum from PDE sol...

Hello.

I have a Pde solution in from of the sum.

pde := diff(u(x, t), t) = diff(u(x, t), x\$2)

symbolic := pdsolve([pde, u(x, 0) = 1, u(0, t) = 0, u(1, t) = 0])

symbolic := u(x, t) = Sum(-(2*((-1)^_Z9-1))*sin(_Z9*Pi*x)*exp(-Pi^2*_Z9^2*t)/(Pi*_Z9), _Z9 = 1 .. infinity)

I tried a subs or eval command dosen't work.

Thanks.

 >
 >
 >
 >
 >
 (1)
 >
 (2)
 >
 (3)
 >
 (4)
 >

## How to substitute one predefined PDE equation into...

Hi,

I am trying to substitute an general function pde expression I have derived in maple into another general function pde expression but cannot seem to find a method that works.

Attached is an example worksheet - any help offered would be much appreciated.

Thanks

## Why wouldn't subs work?...

Hello people in maple primes

I have a question, which is about the matrix shown in http://www.mapleprimes.com/questions/217852-HOW-I-Convert-Root-Of-In-To-Another-Common-Form

Why can't C below be shown with beta?

A := Matrix(3, 3, [[-a, a, 0], [0, 0, -sqrt(l*b*c*(j+k))/(j+k)], [2*j*sqrt(l*b*c*(j+k))/((j+k)*l), 2*k*sqrt(l*b*c*(j+k))/((j+k)*l), -c]]);
B:=subs(l*b*c*(j+k)=alpha,A);
C:=subs(j*alpha^(1/2) = beta,B);
e:=subs(alpha^(1/2) = gamma,B);

Best wishes.

taro

## Fundamental theorem of calculus...

Hello people in mapleprime,

Though I wrote the title as Fundamental theorem of calculus,

what I am considering is just how to continue the chain of codes in calculation.

restart;

#I defined F__0 as

F__0:=x->Int(f(t),t=a..x);

#Then, the difference between a primitive function of f(x), F(x), and F__0 is no more than a constant C, so I write.

bb:=F(x)-F__0(x)=C;

#Then, substituting "a" into equation "bb", I obtain the value of F(a)

bb1:=subs(x=a,bb):cc:=simplify(%);

#Then, I substituted the value of C in "bb1" into "bb,"  obtaining the following "cc1."

cc1:=subs(isolate(cc,C),bb);

#And, then, I isolated the term of Int(f(t),t=a..x)  in cc1,

dd:=isolate(cc1,Int(f(t), t = a .. x));

#And, then, I substitute x=b into the outcome of dd, and obtain the final equation.

subs(x=b,dd);

Surely, with the above code, I could get the fundamental theorem. But, it looks in a little roundabout way.

So, I thought I would ask here about whether there aren't any better ways to do the fundamentally the same thing or

hints to improve the above code.