Items tagged with expression

Feed

Does Maple have build-in function, which when given an expression that depends on x and y, will separate it to a product of two functions, one that depedns on x only and the other that depends on y only?

The input mathematical expression is known to be seperable.

For example, If the input is

((3*y + y^2)*3*x)/(x + sin(x))

Then I'd the Maple function to take the above and return list or set of two parts  {(3*y + y^2)   ,     3*x/(x + sin(x) } (if it can't separate it, it can return null).

The API can be something as  

 f,g = find_product_functions(expression,[x,y])

Something like this is used on determining for example if RHS of first order ODE is separable in order to solve it more easily.  collect() does not really work for this. So Maple allready does this internally in its ODE solver when it checks if ODE is separable or not. But is the function available for users?

 

Sorry for the simple subject.  Using unapply we can convert an expression to a function. 

a:=x^2+sin(x)

a:=unapply(a,x)

               a:= x-> x^2+sin(x)

How do you go the other way.  That is convert a function to an expression?

Hi, I wondered if anyone knows a way to separate out addition (or subtraction) terms in an equation.

For example given eqn1:

eqn1:= (1/2)*p+1+(-4*p^2-p-1)/(3*p^3+7*p^2+2*p+2)

I would like to get the first rational term before the first plus (or minus) sign. In this case it would be (p/2).

This is a trivial example shown above but the real value in this is that I want to customize my own factorizations using the pratial fraction function of Maple. In this case I would not know eqn1 before hand but it would be the solution to some previous factorization and I need just the first term (before the first plus sign).

If anyone knows any tips or tricks that will set me on the right path to doing this it is most appreciated.

Hello people in mapleprimes,

I want to modify the following expression a to b. For it, I used c code.
But, as seen in d, just using c returns a. Originally, I intended phi being between 0 and 1, so
that 1-phi >0. Isn't any better way to modify a to b? and it is better to have maple sort expression remembering 1-phi to be positive, and to have maple give any priority to it in modifying a to b.

a:=(-2*theta+1)*phi/(phi-1)+theta;
b:=(2*theta-1)*phi/(-phi+1)+theta;
c:=simplify(-1*numer(op(1,aa)))/simplify((-1)*denom(op(1,aa)))+theta;
d:=simplify(c)
(-2*theta+1)*phi/(phi-1) + theta

I will be very glad if you borrow me your idea.

Thank you in advance.

I'm looking to leanr the sign and to simplify a very long expression , how can i do this ? can anyone help me thank you in a

advance.

Hello!

Hope everything fine with you. Please check the following program

restart; a := 0; b := 1; Rd := .5; Ra := .2; Nc := .6; e := .2; Nr := .3; H := .9; Digits := 20;
with(LinearAlgebra);
L[0] := 1; L[1] := a+1-x;
M := 4; K := 1;
for n while n <= M do
L[n+1] := expand(-((x-2*n-a-1)*L[n]+(n+a)*L[n-1])/(n+1))
end do; printlevel := 2;
for m from 0 while m < M do
for n to 2^(K-1) do
psi[n, m] := simplify(sqrt(m+1/2.)*2^((1/2)*K)*(eval(L[m], x = 2^K*x-2*n+1)))
end do
end do;
f1 := simplify(sum(sum(c[p, q]*psi[p, q], q = 0 .. M-1), p = 1 .. 2^(K-1)));
u := collect(f1, [x], recursive);

u := -3.5276684147527874541*c[1, 3]*x^3+(4.4721359549995793928*c[1, 2]+21.166010488516724724*c[1, 3])*x^2+(-3.4641016151377545871*c[1, 1]-13.416407864998738178*c[1, 2]-34.394767043839677677*c[1, 3])*x+c[1, 0]+3.4641016151377545871*c[1, 1]+7.8262379212492639373*c[1, 2]+14.992590762699346680*c[1, 3]

f := 1+sum(A[i]*(x^(i+1)-(i+1)*x), i = 1 .. M-2)

f:=1+A[1]*(x^2-2*x)+A[2]*(x^3-3*x)

 

I want to equate the like powers of "x" in f ( mention as red) and u ( mention as red) for any values of M make a system of equations as

Eq[1]:=-3.5276684147527874541*c[1, 3] = A[2];

Eq[2]:=4.4721359549995793928*c[1, 2]+21.166010488516724724*c[1, 3] = A[1];

Eq[3]:=-3.4641016151377545871*c[1, 1]-13.416407864998738178*c[1, 2]-34.394767043839677677*c[1, 3] = -2*A[1]-3*A[2];

Eq[4]:=c[1, 0]+3.4641016151377545871*c[1, 1]+7.8262379212492639373*c[1, 2]+14.992590762699346680*c[1, 3] = 1;

and solve them for any values of A[1] and A[2];

Also attached the program Equate.mw

With my best regards and sincerely.

Muhammad Usman

School of Mathematical Sciences 
Peking University, Beijing, China

What is the difference between the Expression Palette and the Layout Palette? First I thought that the Layout Palette is supporting the entering of names with e.g. sub- and superscripts, but I learned (the hard way) that the templates of the Layout Palette are "mathematically active".

What is the meaning of the colours green and violett in both palettes?

Quite often when i use maple I generate expressions that are of vast length, that with a pen and paper can be reduced in length by carefully factorizing, multiplying out and dividing through.

I am wondering if i am missig somethig- if this is a problem all maple users deal with, or if its just a limitation of the program.

Today, maple generated:

d*B[2211](t)/dt = 2*k[a2]*beta*k[d2]*B[2211]*(alpha*beta*R[b]*k[a1]^2+alpha*beta*R[b]*k[a1]*k[a2]+2*alpha*R[b]*k[a1]*k[d1]+2*alpha*R[b]*k[a1]*k[d2]+alpha*R[b]*k[a2]*k[d1]+alpha*R[b]*k[a2]*k[d2]+beta*k[a1]*k[d1]+beta*k[a1]*k[d2]+k[d1]^2+3*k[d1]*k[d2]+2*k[d2]^2)
/(alpha*beta^2*R[b]*k[a1]^2*k[a2]+alpha*beta^2*R[b]*k[a1]*k[a2]^2+alpha*beta*R[b]*k[a1]^2*k[d1]+alpha*beta*R[b]*k[a1]^2*k[d2]+3*alpha*beta*R[b]*k[a1]*k[a2]*k[d1]+3*alpha*beta*R[b]*k[a1]*k[a2]*k[d2]+alpha*beta*R[b]*k[a2]^2*k[d1]+alpha*beta*R[b]*k[a2]^2*k[d2]+alpha*R[b]*k[a1]*k[d1]^2+3*alpha*R[b]*k[a1]*k[d1]*k[d2]+2*alpha*R[b]*k[a1]*k[d2]^2+2*alpha*R[b]*k[a2]*k[d1]^2+3*alpha*R[b]*k[a2]*k[d1]*k[d2]+alpha*R[b]*k[a2]*k[d2]^2+beta^2*k[a1]*k[a2]*k[d1]+beta^2*k[a1]*k[a2]*k[d2]+2*beta*k[a1]*k[d1]^2+3*beta*k[a1]*k[d1]*k[d2]+beta*k[a1]*k[d2]^2+beta*k[a2]*k[d1]^2+3*beta*k[a2]*k[d1]*k[d2]+2*beta*k[a2]*k[d2]^2+2*k[d1]^3+7*k[d1]^2*k[d2]+7*k[d1]*k[d2]^2+2*k[d2]^3)
+(-2*k[d1]-2*k[d2])*B[2211]
+2*k[d1]*B[2211]*(alpha*beta*R[b]*k[a1]*k[a2]+alpha*beta*R[b]*k[a2]^2+alpha*R[b]*k[a1]*k[d1]+alpha*R[b]*k[a1]*k[d2]+2*alpha*R[b]*k[a2]*k[d1]+2*alpha*R[b]*k[a2]*k[d2]+beta*k[a2]*k[d1]+beta*k[a2]*k[d2]+2*k[d1]^2+3*k[d1]*k[d2]+k[d2]^2)*k[a1]*beta
/(alpha*beta^2*R[b]*k[a1]^2*k[a2]+alpha*beta^2*R[b]*k[a1]*k[a2]^2+alpha*beta*R[b]*k[a1]^2*k[d1]+alpha*beta*R[b]*k[a1]^2*k[d2]+3*alpha*beta*R[b]*k[a1]*k[a2]*k[d1]+3*alpha*beta*R[b]*k[a1]*k[a2]*k[d2]+alpha*beta*R[b]*k[a2]^2*k[d1]+alpha*beta*R[b]*k[a2]^2*k[d2]+alpha*R[b]*k[a1]*k[d1]^2+3*alpha*R[b]*k[a1]*k[d1]*k[d2]+2*alpha*R[b]*k[a1]*k[d2]^2+2*alpha*R[b]*k[a2]*k[d1]^2+3*alpha*R[b]*k[a2]*k[d1]*k[d2]+alpha*R[b]*k[a2]*k[d2]^2+beta^2*k[a1]*k[a2]*k[d1]+beta^2*k[a1]*k[a2]*k[d2]+2*beta*k[a1]*k[d1]^2+3*beta*k[a1]*k[d1]*k[d2]+beta*k[a1]*k[d2]^2+beta*k[a2]*k[d1]^2+3*beta*k[a2]*k[d1]*k[d2]+2*beta*k[a2]*k[d2]^2+2*k[d1]^3+7*k[d1]^2*k[d2]+7*k[d1]*k[d2]^2+2*k[d2]^3)

quite clearly there are expressions in there that can be factorised by (k[a1]+k[a2]) and the two quotients have the same denominator. Is there any way of minimizing the length of this expression by factorizing where appropriate, merging denominators when appropriate etc?

I am not sure why p is assigned to 1 when I do a logic problem.

The letter p should stay as p and not be assigned to one. I suspect it has something to do with a statement that is always true. This is annoying because sometimes I have expressions with p in a formula later on, and I didn't realize p has been assigned to 1. And I can't use p in a logical formula either since it's already been assigned to 1.

Hello,

Lets say I have some expression F that is a function of n and N like, F=n+N-1 and I want to express that in terms of x, where x=n/N. How would I do this in maple? Thanks in advance. 

 

I noticed Maple gives different order of term (but still correct) when variable y or z is used, vs. other letters in this computation.

In this example below, integral results are given, using one letter of the alphabet at a time in the integrand. 

Only when the variable is y or z, Maple shows expression in different form from all the others (negative sign pulled out). The result are correct ofcourse, but was wondering why this hapens only for these two variables? I would have expected that variable name (letter used) should not make any difference to the final form.

restart;
interface(rtablesize=infinity):
chars:=[seq(parse(StringTools:-Char(i)),i=97..122)]: #generate a..z variables, may be there is better way?
Matrix([seq([chars[i0],simplify(int((c0^2 - c1^2)/(chars[i0] - x0+I*c3), x0))],i0=1..nops(chars))]);


Gives (this below. Notice the very last 2 entries below)

Is this something common in Maple? Does it depend on the computation being performed? Can a user do something to tell Maple not to change order/form of expression depending on what variable letter is used?

 

This sequence has a special name does anyone know what it is? i mean id look it up on oeis but unfortunately the asthetics of their presentation dont meet my strict standards, so yes i did work out an expression for it but if anyone knows the easiest in a singular expression.. very helpful right now.

 

1, 1, 2, 2, 3, 3, 4, 4, 5, 5

Hi,

I am trying to do a numerical approximate method 'method of multiple scales'. And in doing so I am getting following equation.

restart

junk := -n*v_SDD*x[1](T[0], T[1], T[2])+x[1](T[0], T[1], T[2])+(D[1, 1](x[1]))(T[0], T[1], T[2])+2*kappa*(D[1](x[1]))(T[0], T[1], T[2])+n*v_SDD*x[1](T[0]-tau_1, T[1], T[2])-psi*n*x[1](T[0]-tau_1, T[1], T[2])+psi*n*x[1](T[0], T[1], T[2])

-n*v_SDD*x[1](T[0], T[1], T[2])+x[1](T[0], T[1], T[2])+(D[1, 1](x[1]))(T[0], T[1], T[2])+2*kappa*(D[1](x[1]))(T[0], T[1], T[2])+n*v_SDD*x[1](T[0]-tau_1, T[1], T[2])-psi*n*x[1](T[0]-tau_1, T[1], T[2])+psi*n*x[1](T[0], T[1], T[2])

(1)

evalf(subs(x[1](T[0], T[1], T[2]) = R(T[1], T[2])*sin(omega*T[0]+phi(T[1], T[2])), %))

-1.*n*v_SDD*R(T[1], T[2])*sin(omega*T[0]+phi(T[1], T[2]))+R(T[1], T[2])*sin(omega*T[0]+phi(T[1], T[2]))+(D[1, 1](x[1]))(T[0], T[1], T[2])+2.*kappa*(D[1](x[1]))(T[0], T[1], T[2])+n*v_SDD*x[1](T[0]-tau_1, T[1], T[2])-1.*psi*n*x[1](T[0]-tau_1, T[1], T[2])+psi*n*R(T[1], T[2])*sin(omega*T[0]+phi(T[1], T[2]))

(2)

``


Download question3.mw

Now I need to substitute x_1(T0,T1,T2)=R(T1,T2)sin(omega*T0+phi(T1,T2)) in the expression and evaluate it.  But on substituting, it is not solving for the 'D' operator. In a similar line if I will have a differential term like

D1(x1)(T0-tau_1,T1,T2) and I have to substitute x1(T0-tau_1,T1,T2) then how can i do it?

Please help me regarding it.

Thanks and regards

Sunit

Hello people in mapleprimes,

I have an equation called aa in the following.

alias(`&delta;x`=dx, `&Delta;x`=Dx,`&Delta;y`=Dy,`&Delta;z`=Dz):
aa:=Dz=f(x+Dx,y+Dy)-f(x,y);

As for modification of this expression, I ask your favor to teach me.

Then, I want to change this aa to D[1](f)(x+theta__1*Dx,y+Dy)*Dx+D[2](f)(x,y+theta__2*Dy)*Dy.

But, to do so, I have to split aa into the one including -f(x,y+Dy)+f(x,y+Dy) between two terms

of aa.

But, as maple cancels these terms, I can't do so. How can I insert two terms, then

obtain the expression  D[1](f)(x+theta__1*Dx,y+Dy)*Dx+D[2](f)(x,y+theta__2*Dy)*Dy?

 

Thanks in advance.

taro

Hi, I am new to maple, but I think that my question should be simple.

I have a matrix where each element is an expression. I want to compute the matrix for different constant and to save it without crushing the previous matrix. 

If the file that I joined, I have a first part where the constant are defined. In the second part the expression of the matrix is defined. Finally, I compute each matrix with different constant. Each results is called C_p0, C_s0, C_g0. When I called them back, only the last matrix computed remains.

I would like to be able to save each matrix to performed operation on them later.

Thank you. 

 

Forum_Question1.mw

Homogénéisation

 

restart; with(plots); with(DifferentialGeometry); with(LinearAlgebra); with(Physics)

  NULL

Paramètre des matériaux

 

p[p] := [34.68, 34.82]:
NULL

 

NULLNULL

Tenseurs Élémentaires

 

NULL

Tenseur de rigidité

 

V := 1/((1+upsilon[23])*(-2*upsilon[12]*upsilon[21]-upsilon[23]+1)); G[12] := E/(2*(1+upsilon[12])); C[11] := (-upsilon[23]^2+1)*V*E[1]; C[22] := (-upsilon[12]*upsilon[21]+1)*V*E[2]; C[12] := upsilon[21]*(1+upsilon[23])*V*E[2]; C[23] := (upsilon[12]*upsilon[21]+upsilon[23])*V*E[2]; C[44] := (1/2)*(-2*upsilon[12]*upsilon[21]-upsilon[23]+1)*V*E[2]; C[55] := E[6]; C[33] := C[22]; C[13] := C[12]; C[66] := C[55]; C[21] := C[12]; C[32] := C[23]; C[iso] := Matrix(6, 6, {(1, 1) = C[11], (1, 2) = C[12], (1, 3) = C[12], (1, 4) = 0, (1, 5) = 0, (1, 6) = 0, (2, 1) = C[21], (2, 2) = C[22], (2, 3) = C[23], (2, 4) = 0, (2, 5) = 0, (2, 6) = 0, (3, 1) = C[21], (3, 2) = C[32], (3, 3) = C[22], (3, 4) = 0, (3, 5) = 0, (3, 6) = 0, (4, 1) = 0, (4, 2) = 0, (4, 3) = 0, (4, 4) = C[44], (4, 5) = 0, (4, 6) = 0, (5, 1) = 0, (5, 2) = 0, (5, 3) = 0, (5, 4) = 0, (5, 5) = C[66], (5, 6) = 0, (6, 1) = 0, (6, 2) = 0, (6, 3) = 0, (6, 4) = 0, (6, 5) = 0, (6, 6) = C[66]})

Matrice de rigidité

 

upsilon[23] := upsilon[p]:

Matrix([[C[11], C[12], C[12], 0, 0, 0], [C[21], C[22], C[23], 0, 0, 0], [C[21], C[32], C[22], 0, 0, 0], [0, 0, 0, C[44], 0, 0], [0, 0, 0, 0, C[66], 0], [0, 0, 0, 0, 0, C[66]]])

(1.2.1.1.1)

upsilon[23] := upsilon[s]:

Matrix([[C[11], C[12], C[12], 0, 0, 0], [C[21], C[22], C[23], 0, 0, 0], [C[21], C[32], C[22], 0, 0, 0], [0, 0, 0, C[44], 0, 0], [0, 0, 0, 0, C[66], 0], [0, 0, 0, 0, 0, C[66]]])

(1.2.1.1.2)

upsilon[23] := upsilon[g]:

Matrix([[C[11], C[12], C[12], 0, 0, 0], [C[21], C[22], C[23], 0, 0, 0], [C[21], C[32], C[22], 0, 0, 0], [0, 0, 0, C[44], 0, 0], [0, 0, 0, 0, C[66], 0], [0, 0, 0, 0, 0, C[66]]])

(1.2.1.1.3)

``

C[p0];

Matrix([[C[11], C[12], C[12], 0, 0, 0], [C[21], C[22], C[23], 0, 0, 0], [C[21], C[32], C[22], 0, 0, 0], [0, 0, 0, C[44], 0, 0], [0, 0, 0, 0, C[66], 0], [0, 0, 0, 0, 0, C[66]]])

(1)

``

 

1 2 3 4 5 6 7 Last Page 1 of 9