Items tagged with expressions

Feed

I have a question that I hope someone can help with. We perform extreme value analysis on expressions. My this I mean that we evaluate expressions for each combination of min or max values of each variable in the expression. For example, the expression a*b+c*d has 4 variables and we would evaluate the expression for all of the 16 combinations of a,b,c, and d to determine the worst-case result. I understand that the worst case results may not occur at the extreme values of the variables, but that is a different question.

 What I would like to know is if there is a way to reduce the number of calculations by splitting the expression into independent parts. In the example above, the expression consists of 2 parts a*b and c*d. These parts could be evaluated separately. Each has 2 variables, and each would therefore requires  4 combinations of variables to determine the extreme values of the results. So in this case, the number of calculations is 4+4=8, which is half of the initial 16  runs as would be done with a full-factorial analysis. Also, because each calculation is done on only part of the original expression, each calculation takes less time.

Is there a way to find the independent parts of an arbitrary expression so that each independent part could be evaluated separately to speed processing?

Thanks


Suppose I type certain math expression like as follow:

F^5*alpha[5]+F^4*G*gamma[1]+F*G^4*gamma[3]+G^5*beta[5]+F^4*alpha[4]+G^4*beta[4]+F^3*alpha[3]+F^2*G*gamma[2]+F*G^2*gamma[4]+G^3*beta[3]+F^2*alpha[2]+F*G*gamma[5]+G^2*beta[2]+F*alpha[1]+G*beta[1]+delta[0]

F^5*alpha[5]+F^4*G*gamma[1]+F*G^4*gamma[3]+G^5*beta[5]+F^4*alpha[4]+G^4*beta[4]+F^3*alpha[3]+F^2*G*gamma[2]+F*G^2*gamma[4]+G^3*beta[3]+F^2*alpha[2]+F*G*gamma[5]+G^2*beta[2]+F*alpha[1]+G*beta[1]+delta[0]

(1)

But when I enter this expression, Maple gives totally different look to this expression, can I force Maple to print similar looking expression as I typed in command line ? I mean without change of  position of intermediates and coefficients.


Download Forcing_Maple_Output.mw

Regards

Dear All


As a result of certain computation, Maple produce following result:

exp(epsilon[10])*a[2]*epsilon[6]*epsilon[9]^2/exp(epsilon[3]):

How can I force Maple to produce result like:

exp(epsilon[10]-epsilon[3])*a[2]*epsilon[6]*epsilon[9]^2:

Similar to this; Maple produce result:

(exp(epsilon[10]))^2*a[1]:

How I can force Maple to produce it like:

exp(2*epsilon[10])*a[1]:

As an example; I need to simplify following expression in manner as described above

-exp(epsilon[10])*a[2]*epsilon[6]*epsilon[9]*epsilon[2]/exp(epsilon[3])-2*a[10]*epsilon[7]*epsilon[9]-a[10]*epsilon[7]*epsilon[2]-a[3]*epsilon[9]^2*epsilon[11]-a[3]*epsilon[11]*epsilon[5]+exp(epsilon[10])*a[7]*epsilon[2]+a[10]*epsilon[6]*epsilon[4]-2*a[3]*epsilon[6]*epsilon[4]+(exp(epsilon[10]))^2*a[1]/exp(epsilon[3])+exp(epsilon[3])*a[11]*epsilon[9]^2+exp(epsilon[3])*a[11]*epsilon[5]+2*exp(epsilon[10])*a[7]*epsilon[9]-(exp(epsilon[10]))^2*a[5]*epsilon[11]/(exp(epsilon[3]))^2-exp(epsilon[10])*a[2]*epsilon[7]/exp(epsilon[3])-2*exp(epsilon[10])*a[9]*epsilon[7]/exp(epsilon[3])+a[10]*epsilon[6]*epsilon[8]*epsilon[2]-a[3]*epsilon[11]*epsilon[9]*epsilon[2]-2*a[3]*epsilon[6]*epsilon[8]*epsilon[2]+2*a[10]*epsilon[6]*epsilon[8]*epsilon[9]-4*a[3]*epsilon[6]*epsilon[8]*epsilon[9]-(exp(epsilon[10]))^3*a[4]*epsilon[6]/(exp(epsilon[3]))^3+(exp(epsilon[3]))^2*a[6]*epsilon[4]/exp(epsilon[10])+exp(epsilon[3])*a[11]*epsilon[9]*epsilon[2]-2*a[10]*epsilon[1]+a[3]*epsilon[1]-2*exp(epsilon[10])*a[9]*epsilon[11]*epsilon[9]/exp(epsilon[3])-(exp(epsilon[10]))^2*a[8]*epsilon[6]*epsilon[2]/(exp(epsilon[3]))^2-exp(epsilon[10])*a[9]*epsilon[11]*epsilon[2]/exp(epsilon[3])-exp(epsilon[10])*a[2]*epsilon[6]*epsilon[9]^2/exp(epsilon[3])+2*(exp(epsilon[3]))^2*a[6]*epsilon[8]*epsilon[9]/exp(epsilon[10])-exp(epsilon[10])*a[2]*epsilon[6]*epsilon[5]/exp(epsilon[3])+(exp(epsilon[3]))^2*a[6]*epsilon[8]*epsilon[2]/exp(epsilon[10])-2*(exp(epsilon[10]))^2*a[8]*epsilon[6]*epsilon[9]/(exp(epsilon[3]))^2


Download Expression.mwExpression.mw

Regards

Hello,

I have a maple code, which some expressions have more that 80000 terms and I need to double integrate them. The terms have sine, cossine trigonometric functions.

I tried to used de MAP command, it works for the first expressions but, after a while, Maple displays an error message related to too large expression.

Do you know how to handle large expressions ?

Thank you.

Hi, I am completely new to Maple, and I need to use it to optimize my equations in order to make my PLC codes more compressed. I am calculating forward kinematics with the Denavit-Hartenberg method and as such I get long expressions. After a lot of google'ing and frustration, I thought I'd ask here in the hope that one of you might be able to assist me.

I have the following equations;

X := L10*cos(q5) - L16*(sin(q10)*(sin(q5)*sin(q8) - cos(q8)*(cos(q5)*cos(q6)*cos(q7) - cos(q5)*sin(q6)*sin(q7))) - cos(q10)*(sin(q9)*(cos(q8)*sin(q5) + sin(q8)*(cos(q5)*cos(q6)*cos(q7) - cos(q5)*sin(q6)*sin(q7))) + cos(q9)*(cos(q5)*cos(q6)*sin(q7) + cos(q5)*cos(q7)*sin(q6)))) - d2*(cos(q10)*(sin(q5)*sin(q8) - cos(q8)*(cos(q5)*cos(q6)*cos(q7) - cos(q5)*sin(q6)*sin(q7))) + sin(q10)*(sin(q9)*(cos(q8)*sin(q5) + sin(q8)*(cos(q5)*cos(q6)*cos(q7) - cos(q5)*sin(q6)*sin(q7))) + cos(q9)*(cos(q5)*cos(q6)*sin(q7) + cos(q5)*cos(q7)*sin(q6)))) + L15*(sin(q9)*(cos(q8)*sin(q5) + sin(q8)*(cos(q5)*cos(q6)*cos(q7) - cos(q5)*sin(q6)*sin(q7))) + cos(q9)*(cos(q5)*cos(q6)*sin(q7) + cos(q5)*cos(q7)*sin(q6))) - L11*cos(q5)*sin(q6) + d1*cos(q5)*cos(q6) - L13*sin(q5)*sin(q8) + L14*cos(q9)*(cos(q8)*sin(q5) + sin(q8)*(cos(q5)*cos(q6)*cos(q7) - cos(q5)*sin(q6)*sin(q7))) + L13*cos(q8)*(cos(q5)*cos(q6)*cos(q7) - cos(q5)*sin(q6)*sin(q7)) - L14*sin(q9)*(cos(q5)*cos(q6)*sin(q7) + cos(q5)*cos(q7)*sin(q6)) + L12*cos(q5)*cos(q6)*cos(q7) - L12*cos(q5)*sin(q6)*sin(q7);

Y := L10*sin(q5) - L9 + L16*(sin(q10)*(cos(q5)*sin(q8) - cos(q8)*(sin(q5)*sin(q6)*sin(q7) - cos(q6)*cos(q7)*sin(q5))) - cos(q10)*(sin(q9)*(cos(q5)*cos(q8) + sin(q8)*(sin(q5)*sin(q6)*sin(q7) - cos(q6)*cos(q7)*sin(q5))) - cos(q9)*(cos(q6)*sin(q5)*sin(q7) + cos(q7)*sin(q5)*sin(q6)))) + d2*(cos(q10)*(cos(q5)*sin(q8) - cos(q8)*(sin(q5)*sin(q6)*sin(q7) - cos(q6)*cos(q7)*sin(q5))) + sin(q10)*(sin(q9)*(cos(q5)*cos(q8) + sin(q8)*(sin(q5)*sin(q6)*sin(q7) - cos(q6)*cos(q7)*sin(q5))) - cos(q9)*(cos(q6)*sin(q5)*sin(q7) + cos(q7)*sin(q5)*sin(q6)))) - L15*(sin(q9)*(cos(q5)*cos(q8) + sin(q8)*(sin(q5)*sin(q6)*sin(q7) - cos(q6)*cos(q7)*sin(q5))) - cos(q9)*(cos(q6)*sin(q5)*sin(q7) + cos(q7)*sin(q5)*sin(q6))) + L13*cos(q5)*sin(q8) - L11*sin(q5)*sin(q6) + d1*cos(q6)*sin(q5) - L14*cos(q9)*(cos(q5)*cos(q8) + sin(q8)*(sin(q5)*sin(q6)*sin(q7) - cos(q6)*cos(q7)*sin(q5))) - L13*cos(q8)*(sin(q5)*sin(q6)*sin(q7) - cos(q6)*cos(q7)*sin(q5)) - L14*sin(q9)*(cos(q6)*sin(q5)*sin(q7) + cos(q7)*sin(q5)*sin(q6)) + L12*cos(q6)*cos(q7)*sin(q5) - L12*sin(q5)*sin(q6)*sin(q7);

Z := L15*(cos(q9)*(cos(q6)*cos(q7) - sin(q6)*sin(q7)) - sin(q8)*sin(q9)*(cos(q6)*sin(q7) + cos(q7)*sin(q6))) - L11*cos(q6) - L8 - d1*sin(q6) + L16*(cos(q10)*(cos(q9)*(cos(q6)*cos(q7) - sin(q6)*sin(q7)) - sin(q8)*sin(q9)*(cos(q6)*sin(q7) + cos(q7)*sin(q6))) - cos(q8)*sin(q10)*(cos(q6)*sin(q7) + cos(q7)*sin(q6))) - d2*(sin(q10)*(cos(q9)*(cos(q6)*cos(q7) - sin(q6)*sin(q7)) - sin(q8)*sin(q9)*(cos(q6)*sin(q7) + cos(q7)*sin(q6))) + cos(q8)*cos(q10)*(cos(q6)*sin(q7) + cos(q7)*sin(q6))) - L13*cos(q8)*(cos(q6)*sin(q7) + cos(q7)*sin(q6)) - L14*sin(q9)*(cos(q6)*cos(q7) - sin(q6)*sin(q7)) - L12*cos(q6)*sin(q7) - L12*cos(q7)*sin(q6) - L14*cos(q9)*sin(q8)*(cos(q6)*sin(q7) + cos(q7)*sin(q6));

 

I need to optimize these equations, but still keep them separate. I would like to use mutual expressions for the calculations within, but still as I said keep the outputs of X, Y and Z separate.

This is MATLAB code.

 

Thanks in advance for any help.

Hi all,

which alternative options fo I have to prove the equality of two algebraic expressions if testeq fails?

The case im reffering to can be seen in the following document:

https://dl.dropboxusercontent.com/u/29147149/Exam%202006%20Question%20A.mw

Equation 14-18

I am pretty sure that the expressions are equal. evalb just returns false because it does not simplify expressions.

I am using Maple 12 in Win 64. I have some difficulties in evaluating expressions in Maple. For example simply writing cos(x) then differentiating it w.r.t x. After writing cos(x) in 2D Math mode, I do right click for selecting diff but it does not work. The pointer turns in to busy mode and nothing comes to select. Also, I tried this operation in the tutorial file teaching differentiation, however problem persists.

For context, I'm designing a work sheet based around quantum tunneling. Currently I'm looking at the boundary conditions.

What I want to be able to do is to set the expression psi[1] equal to psi[2], but only for the value x = 0. Is this possible? I've tried using if statements, and I've considered converting these expressions into functions for this purpose, but I'm not having much luck. 

Thanks

Blanky

Hi, 

I have an expression F that has an addend which is a definite integral,-(int(del_u0(x)*(diff(N_xx(x), x)), x = 0 .. L)), and addends that are not, all the rest of them.

How can I create an expression that is the integrated addend only without the other ones?

In other words, how do i separate the integral term from the rest of them?

F := -(int(del_u0(x)*(diff(N_xx(x), x)), x = 0 .. L))+del_u0(L)*N_xx(L)-del_u0(0)*N_xx(0)+ibp2+ibp3

Thanks!

Shai

 

Say I have the following loops:

for C from 1 to 10 do
    r:=[]:
    for K from 2 to 10 do
    r:=[op(r),2*K+2*C-3];
    end do:
    print(r);
end do:

for C from 1 to 10 do
    r:=[]:
    for K from 2 to 10 do
    r:=[op(r),K*C+K+C-2];
    end do:
    print(r);
end do:

I wonder how could I write a procedure, say use expressions "2*K+2*C-3" and "K*C+K+C-2" as input arguments?

so I can call up like :

 

myfun(K*C+K+C-2) or myfun("K*C+K+C-2")

myfun(2*K+2*C-3)

 

I dont care whether the output(s) are lists, tables, or matrices.

My main difficulty is to get the expression to be procedure inputs.

Though if the output can be a  10 by 9 matrix, it's better.

Thanks,

 

casper

 

Dear guys!

I have two expressions in terms of one variable. For example A(t) and B(t). Now, I want to plot A in terms of B. What should I do?

I cannot obtain this relation analytically because both expressions in terms of "t" are very complicated. But I can plot both of them. Now, I need to plot A in terms of B.

Thanks a lot.



`ρ__rta` := proc (lambda) options operator, arrow; product(rho[l](lambda), l = 1 .. 4) end proc

Hello, I am a student of physics, actually I study Celestial Mechanics.

I am working on a Maple program that the output are very huge expressions of up to three thousand lines.

My objective is to select certain terms, the difficult to do that it's because when I save such expression into a archive.txt the terms are separated between two lines, what difficults a lot to create a AWK algoritm to do such a task.

What I want to do is to write these terms...

Please excuse me if this question is too basic or has been answered before, though I've spent a couple of hours searching for similar questions without any luck.

I have the following expression, which is given in terms of other expressions:

1 2 Page 1 of 2