Items tagged with expression

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

I know that whattype() is used to find the basic data type of an expression. Unfortunately that information is rarely useful. How can I dig down deeper and get Maple to tell me more about the expression?

I read somewhere that there is a properties() procedure that does that but I cannot find that procedure.

Thanks.

Hello people in mapleprimes,

I have an equation called aa in the following.

alias(`δx`=dx, `Δx`=Dx,`Δy`=Dy,`Δ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)

``

 

Dear Forum, 

 

I am a new Maple user, and its symbolic prowess is really amazing. So we are trying to interface it with a C library. I want to generate some C code through Maple, and am trying the CodeGeneration package. 

But the default conversion of C(a, b) is b = C language equivalent of expression a.

Now this should be fine for most purposes, but the C library that we are working with, "ACADOToolkit" in this case, requires the equations to be formatted in a certain way. So, I need the following equation in C:

 

f << dot(v) == (u-0.2*v*v)/m

 

Now the LHS part of == is to be hard-coded, but we want to generate the equation on the right using maple. Even if I define an equation as 

eq1:= diff(v(t),t)=(u(t)-0.2*v(t)*v(t))/m(t) and then use C(rhs(eq1)), I get the result in the form of cg = u - 0.2 ...., whereas I want this to be assigned to something else, in this case - "f << dot(v)= ".

 

How can I achieve this ?

 

Thanks 

Chintan Pathak 

Research Scholar, 

University of Washington

 

How can I simplify $\sqrt{1−r^2\exp(2i\theta)}$ in Maple. I could do it by hand but I need this type of simplification later for far more complicated expressions.  I allready tried to enter this as a complex number using II, but simplify(...,'symbolic') didn't simplify this expression. Any suggestion?

While performing integration of some expessions I bumped into a strange problem. My expession consists of quite a lot of terms, but here I present the susbset of only 2. If I integrate it as a whole maple does not want to solve it, and leaves it as there was no closed expression to this integral. But if I split this sum and integrate the parts, it all works fine. What is happening here? What do I miss? I used simplify and allvalues but didn't change a thing...

Is there a way to split my terms into list, integrate one by one and they recreate the solution by summing the parts? Its a bit of a workaround, but surely better that doing it manually (I have around 50 terms). I use Maple 2015

Thanks,

Jeremi


Suppose I have a triplet a[5], a[6], a[7]and an expression given as below:

V[5]*a[5]+V[6]*a[6]+V[7]*a[7]+V[2]+V[9]

How I can list all possible forms of above expression for triplet "(a[5], a[6], a[7])->(a[5], a[6], a[7]), (a[5], a[6], 0), (a[5], 0, a[7]), (0, a[6], a[7]), (a[5], 0, 0), (0, a[6], 0 ), (0, 0, a[7]), (0, a[6], 0), (0, 0, 0) "etc


Download triplet.mw

Regards

Hi,

can you please help me with the usage of applyrule? I have the following problem that I cannot isolate. I have a rule that I want to apply, but instead of applying the rule to the expression, the rule seems to be applied to itself. In an isolated worksheet everything is fine:

restart;

rule:=abs(''a''::algebraic)^2=''a''^2;

abs('a'::algebraic)^2 = 'a'^2

(1)

 

myexp:=abs(548.477146186283171377723+radius_motor*q_mot_vec_2(t)-l_wire_0[2])^2

abs(548.477146186283171377723+radius_motor*q_mot_vec_2(t)-l_wire_0[2])^2

(2)

applyrule(rule,myexp);

(548.477146186283171377723+radius_motor*q_mot_vec_2(t)-l_wire_0[2])^2

(3)

rule

abs(a::algebraic)^2 = a^2

(4)

 


Download applyrule.mw

What happens when I try to use this rule in my script is this:

restart;

#read "some_long_script.mpl":

rule:=abs(''a''::algebraic)^2=''a''^2;

abs('a'::algebraic)^2 = 'a'^2

(1)

applyrule(rule,abs(x)^2)

abs(x)^2

(2)

rule

a::algebraic^2 = a^2

(3)

 

>
 

I want to clarify, that the script that is read before applying those rules does not apply a similar rule. Also the variables rule and x were free. Can you please help me to locate the problem?

Thanks!

Honigmelone

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