Items tagged with simplify

Feed

1. There is this weird bug:

evalc(Re((Re(z)+I*Im(z))^2)) assuming z::complex;
                                2
                               z 

which looks like the assumption got lost somewhere along the way.

2. simplify and evalc can't automatically handle these:

simplify(z-Re(z)-I*Im(z));
                      z - Re(z) - I Im(z)

evalc(z-Re(z)-I*Im(z)) assuming z::complex;
                      z - Re(z) - I Im(z)

simplify(Re(z)^2+Im(z)^2-abs(z)^2);
                          2        2      2
                     Re(z)  + Im(z)  - |z| 

evalc(Re(z)^2+Im(z)^2-abs(z)^2) assuming z::complex;
                          2        2      2
                     Re(z)  + Im(z)  - |z| 

One way to make it work is to do subs(z=Re(z)+I*Im(z),...) and then pass it to evalc. But see point 1. Another way that sometimes work is convert(...,abs).

Side note on convert: convert(...,Re) allows Im as well as Re. I think that's not very useful: typically the point of convert is that I want to get rid of other functions.

3. evalc tends to leave functions of complex argument unexpanded:

evalc(conjugate(sin(z))) assuming z::complex;
                                /_\
                             sin\z/

The real and imaginary parts aren't separated. Again, one way to make it work is this:

evalc(conjugate(sin(Re(z)+I*Im(z)))) assuming z::complex;
       sin(Re(z)) cosh(Im(z)) - I cos(Re(z)) sinh(Im(z))

But see point 1. Also, using just Re(z) and Im(z) won't always give the simplest form.

In fact, even for Re(sin(z)), which is technically already the real part, I'd say it's not very useful for evalc to just give back Re(sin(z)). sin(Re(z))*cosh(Im(z)) is a more useful output, with functions applied only to real quantities.

Using x+I*y instead of z won't help with the simplify examples, but evalc seems to work fine when all variables are assumed to be real.

 

Why does

5103*`Ω`*(5*sqrt(7)+16)/((1+2*sqrt(7))^(3/2)*(7+2*sqrt(7))*(-2+sqrt(7))*(14+sqrt(7))*(2*sqrt(7)-1)*(4+sqrt(7)))

 

not simplify to

sqrt(1+2*sqrt(7))*`Ω`

 

???

It seems that simplify uses some transformations that aren't generically valid, and evalf relies on those transformations too:

 

nint := (fz, zrng) -> evalf(add(
  int(fz, op(1, zrng) = op([2, i], zrng) .. op([2, i+1], zrng)),
  i = 1 .. nops(op(2, zrng))-1));
f1 := z -> MeijerG([[1/2], []], [[], []], z);

simplify(f1(z));
                       sqrt(1/z) exp(-1/z)

evalf(f1(-1));
                              -9                
               -1.672586379 10   + 2.718281828 I

f1(-1.);
                              -9                
               -1.672586379 10   - 2.718281828 I

nint(GAMMA(1/2+y)*(-1)^y, y = [-infinity-I, -I, I, -infinity+I])/(2*Pi*I);
                             -11                
               6.652676619 10    - 2.718281828 I

So it seems that evalf uses the simplified form, but that form doesn't agree with the definition of MeijerG for negative z. The form that does would be 1/sqrt(z)*exp(-1/z).

 

f2 := z -> MeijerG([[], [1]], [[0, 2], []], z);

simplify(f2(z));
                    exp(-z) z + exp(-z) - 1

evalf(f2(1));
                         -0.2642411177

f2(1.);
                          0.7357588823

nint(GAMMA(-y)*GAMMA(2-y)/GAMMA(1-y), y = [infinity-I, -1-I, -1+I, infinity+I])/(2*Pi*I);
                      0.7357588823 - 0. I

The result of simplify is off by -1. Just evaluating f2(1) doesn't use that transformation rule, but evalf apparently does.

 

I have gotten an expression:

eq21 := collect(eq20, [exp(-sqrt(s)*x/sqrt(Dp)), exp(sqrt(s)*(-lh+x)/sqrt(Dp)), exp((-2*lh+x)*sqrt(s)/sqrt(Dp)), exp((lh-x)*sqrt(s+thetac)/sqrt(Dc))], simplify);

q(x, s) = exp(-sqrt(s)*x/sqrt(Dp))*_F1(s)+sqrt(Dp)*(-Dp*sqrt(s+thetac)*alpha1*pinf*s^2-2*Dp*sqrt(s+thetac)*alpha1*pinf*s*thetac-Dp*sqrt(s+thetac)*alpha1*pinf*thetac^2+A2*Dp*sqrt(s+thetac)*alpha1*s+A2*Dp*sqrt(s+thetac)*alpha1*thetac+Dc*sqrt(s+thetac)*alpha1*pinf*s^2+Dc*sqrt(s+thetac)*alpha1*pinf*s*thetac+A1*Dc*alpha1*s^2+A1*Dc*alpha1*s*thetac+A1*sqrt(Dc)*sqrt(s+thetac)*s^2+A1*sqrt(Dc)*sqrt(s+thetac)*s*thetac-A2*Dc*sqrt(s+thetac)*alpha1*s)*exp(sqrt(s)*(-lh+x)/sqrt(Dp))/((s+thetac)^(3/2)*(-sqrt(Dp)*alpha1+sqrt(s))*s*(Dc*s-Dp*s-Dp*thetac))+(sqrt(Dp)*alpha1+sqrt(s))*_F1(s)*exp((-2*lh+x)*sqrt(s)/sqrt(Dp))/(-sqrt(Dp)*alpha1+sqrt(s))+Dc*A1*exp((lh-x)*sqrt(s+thetac)/sqrt(Dc))/((Dc*s-Dp*s-Dp*thetac)*sqrt(s+thetac))-(-pinf*s-pinf*thetac+A2)/((s+thetac)*s)

I need to further simplify the coefficient of

exp(sqrt(s)*(-lh+x)/sqrt(Dp))

Would you like to give some tips?

Thanks.

 

In this expression,

q(x, s) = -(-(-thetac*s^(3/2)-s^(5/2)+(s^2+s*thetac)*alpha1*sqrt(Dp))*Dc*A1*exp((lh-x)*sqrt(s+thetac)/sqrt(Dc))+((alpha1*(s+thetac)*(-pinf*s-pinf*thetac+A2)*Dp^(3/2)+s*sqrt(Dp)*(A1*(s+thetac)*sqrt(Dc)-Dc*alpha1*(-pinf*s-pinf*thetac+A2)))*sqrt(s+thetac)+A1*sqrt(Dp)*s*Dc*alpha1*(s+thetac))*exp(sqrt(s)*(-lh+x)/sqrt(Dp))-(-_F1(s)*(-s*alpha1*(s+thetac)^2*Dp^(3/2)-s^(3/2)*Dp*thetac^2+thetac*(Dc-2*Dp)*s^(5/2)+(Dc-Dp)*s^(7/2)+sqrt(Dp)*s^2*Dc*alpha1*(s+thetac))*exp((-2*lh+x)*sqrt(s)/sqrt(Dp))+_F1(s)*(-s*alpha1*(s+thetac)^2*Dp^(3/2)-thetac*(Dc-2*Dp)*s^(5/2)+(-Dc+Dp)*s^(7/2)+s^(3/2)*Dp*thetac^2+sqrt(Dp)*s^2*Dc*alpha1*(s+thetac))*exp(-sqrt(s)*x/sqrt(Dp))+alpha1*(s+thetac)*(-pinf*s-pinf*thetac+A2)*Dp^(3/2)+(-pinf*(Dc-2*Dp)*thetac+A2*(Dc-Dp))*s^(3/2)-pinf*(Dc-Dp)*s^(5/2)-s*alpha1*Dc*(-pinf*s-pinf*thetac+A2)*sqrt(Dp)-sqrt(s)*Dp*thetac*(-pinf*thetac+A2))*sqrt(s+thetac))/((s+thetac)^(3/2)*s*((Dc-Dp)*s-Dp*thetac)*(sqrt(Dp)*alpha1-sqrt(s)))

 

I want to simplify the coeffcients of

exp((lh-x)*sqrt(s+thetac)/sqrt(Dc)), exp(sqrt(s)*(-lh+x)/sqrt(Dp)), exp((-2*lh+x)*sqrt(s)/sqrt(Dp)), exp(-sqrt(s)*x/sqrt(Dp)).

 

 

 

I am stumped with this trivial puzzle.  Let
z := arctan(x/sqrt(a^2-x^2));
                    
How do we simplify z to.

I tried all sorts of tricks with simplify(...) and convert(...), with assumptions, but did not get anywhere.  Any clues?

Versions: Maple 2016 and 2017.

restart;
sol:=dsolve(diff(y(x),x)= x/(sqrt(x^2-16))*1/(2*y(x)),y(x));

Gives

But the solution can also be written as

I just do not know how to transform the first solution to the second simpler one. I tried:

sol:=map(x->rhs(x),[sol]);
simplify(sol,radical);

Also tried simplify(sol,sqrt); simplify(sol,radical,symbolic); simplify(sol,size);

The simpler solution can be found as follows

restart;
sol:=dsolve(diff(y(x),x)= x/(sqrt(x^2-16))*1/(2*y(x)),y(x),'implicit');

But the term in the middle above is

Therefore the solution is really

eq:=y(x)^2-sqrt(x^2-16)-_C1 = 0;
solve(eq,y(x));

Which gives

What command to simplify the long solution to the shorter one obtained from the implicit?

 

I'm new of Mapel trying to get basics. 

How do I collect on the square terms in the numerator?

hi:

i'm using expand cmd, but surprisingly, not only execute the expand but execute simplify cmd. Is there any cmd only execute expand withoud simplify?

Best wishes,

from China

I did change of variables as below:

 


 

``

restart

Error, invalid input: with expects its 1st argument, pname, to be of type {`module`, package}, but received shareman

 

``

UP := Int(1/2*(K__ux0*u0(x, y, t)^2+K__vx0*v0(x, y, t)^2+K__wx0*w0(x, y, t)^2+`K__φx0`*phi(x, y, t)^2+`K__ψx0`*psi(x, y, t)^2), y = 0 .. b)+Int(1/2*(K__uxa*u0(x, y, t)^2+K__vxa*v0(x, y, t)^2+K__wxa*w0(x, y, t)^2+`K__φxa`*phi(x, y, t)^2+`K__ψxa`*psi(x, y, t)^2), y = 0 .. b)+Int(1/2*(K__uy0*u0(x, y, t)^2+K__vyb*v0(x, y, t)^2+K__wyb*w0(x, y, t)^2+`K__φyb`*phi(x, y, t)^2+`K__ψy0`*psi(x, y, t)^2), x = 0 .. a)+Int(1/2*(K__uyb*u0(x, y, t)^2+K__vyb*v0(x, y, t)^2+K__wyb*w0(x, y, t)^2+`K__φyb`*phi(x, y, t)^2+`K__ψyb`*psi(x, y, t)^2), x = 0 .. a):

varchange := {t = a*tau*sqrt(rho/A__ref), x = (1/2)*a*(Zeta+1), y = (1/2)*b*(eta+1), phi(x, y, t) = h*`#mover(mi("φ",fontstyle = "normal"),mo("&uminus0;"))`(Zeta, eta, tau), psi(x, y, t) = h*`#mover(mi("ψ",fontstyle = "normal"),mo("&uminus0;"))`(Zeta, eta, tau), u0(x, y, t) = h*`#mover(mi("u"),mo("&uminus0;"))`(Zeta, eta, tau), v0(x, y, t) = h*`#mover(mi("v"),mo("&uminus0;"))`(Zeta, eta, tau), w0(x, y, t) = h*`#mover(mi("w"),mo("&uminus0;"))`(Zeta, eta, tau)}:

``

Ut := PDEtools:-dchange(varchange, UP, [`#mover(mi("u"),mo("&uminus0;"))`, `#mover(mi("v"),mo("&uminus0;"))`, `#mover(mi("w"),mo("&uminus0;"))`, `#mover(mi("φ",fontstyle = "normal"),mo("&uminus0;"))`, `#mover(mi("ψ",fontstyle = "normal"),mo("&uminus0;"))`, Zeta, eta, tau], params = [a, b, rho, A__ref]):

Ut

Int((1/2)*((1/2)*K__ux0*h^2*`#mover(mi("u"),mo("&uminus0;"))`(Zeta, eta, tau)^2+(1/2)*K__vx0*h^2*`#mover(mi("v"),mo("&uminus0;"))`(Zeta, eta, tau)^2+(1/2)*K__wx0*h^2*`#mover(mi("w"),mo("&uminus0;"))`(Zeta, eta, tau)^2+(1/2)*`K__φx0`*h^2*`#mover(mi("φ",fontstyle = "normal"),mo("&uminus0;"))`(Zeta, eta, tau)^2+(1/2)*`K__ψx0`*h^2*`#mover(mi("ψ",fontstyle = "normal"),mo("&uminus0;"))`(Zeta, eta, tau)^2)*b, eta = -1 .. 1)+Int((1/2)*((1/2)*K__uxa*h^2*`#mover(mi("u"),mo("&uminus0;"))`(Zeta, eta, tau)^2+(1/2)*K__vxa*h^2*`#mover(mi("v"),mo("&uminus0;"))`(Zeta, eta, tau)^2+(1/2)*K__wxa*h^2*`#mover(mi("w"),mo("&uminus0;"))`(Zeta, eta, tau)^2+(1/2)*`K__φxa`*h^2*`#mover(mi("φ",fontstyle = "normal"),mo("&uminus0;"))`(Zeta, eta, tau)^2+(1/2)*`K__ψxa`*h^2*`#mover(mi("ψ",fontstyle = "normal"),mo("&uminus0;"))`(Zeta, eta, tau)^2)*b, eta = -1 .. 1)+Int((1/2)*((1/2)*K__uy0*h^2*`#mover(mi("u"),mo("&uminus0;"))`(Zeta, eta, tau)^2+(1/2)*K__vyb*h^2*`#mover(mi("v"),mo("&uminus0;"))`(Zeta, eta, tau)^2+(1/2)*K__wyb*h^2*`#mover(mi("w"),mo("&uminus0;"))`(Zeta, eta, tau)^2+(1/2)*`K__φyb`*h^2*`#mover(mi("φ",fontstyle = "normal"),mo("&uminus0;"))`(Zeta, eta, tau)^2+(1/2)*`K__ψy0`*h^2*`#mover(mi("ψ",fontstyle = "normal"),mo("&uminus0;"))`(Zeta, eta, tau)^2)*a, Zeta = -1 .. 1)+Int((1/2)*((1/2)*K__uyb*h^2*`#mover(mi("u"),mo("&uminus0;"))`(Zeta, eta, tau)^2+(1/2)*K__vyb*h^2*`#mover(mi("v"),mo("&uminus0;"))`(Zeta, eta, tau)^2+(1/2)*K__wyb*h^2*`#mover(mi("w"),mo("&uminus0;"))`(Zeta, eta, tau)^2+(1/2)*`K__φyb`*h^2*`#mover(mi("φ",fontstyle = "normal"),mo("&uminus0;"))`(Zeta, eta, tau)^2+(1/2)*`K__ψyb`*h^2*`#mover(mi("ψ",fontstyle = "normal"),mo("&uminus0;"))`(Zeta, eta, tau)^2)*a, Zeta = -1 .. 1)

(1)

simplify(Ut)

(1/4)*(b*(Int(K__ux0*`#mover(mi("u"),mo("&uminus0;"))`(Zeta, _a, tau)^2+K__vx0*`#mover(mi("v"),mo("&uminus0;"))`(Zeta, _a, tau)^2+K__wx0*`#mover(mi("w"),mo("&uminus0;"))`(Zeta, _a, tau)^2+`K__φx0`*`#mover(mi("φ",fontstyle = "normal"),mo("&uminus0;"))`(Zeta, _a, tau)^2+`K__ψx0`*`#mover(mi("ψ",fontstyle = "normal"),mo("&uminus0;"))`(Zeta, _a, tau)^2, _a = -1 .. 1))+b*(Int(K__uxa*`#mover(mi("u"),mo("&uminus0;"))`(Zeta, _a, tau)^2+K__vxa*`#mover(mi("v"),mo("&uminus0;"))`(Zeta, _a, tau)^2+K__wxa*`#mover(mi("w"),mo("&uminus0;"))`(Zeta, _a, tau)^2+`K__φxa`*`#mover(mi("φ",fontstyle = "normal"),mo("&uminus0;"))`(Zeta, _a, tau)^2+`K__ψxa`*`#mover(mi("ψ",fontstyle = "normal"),mo("&uminus0;"))`(Zeta, _a, tau)^2, _a = -1 .. 1))+a*(Int(K__uy0*`#mover(mi("u"),mo("&uminus0;"))`(_a, eta, tau)^2+K__vyb*`#mover(mi("v"),mo("&uminus0;"))`(_a, eta, tau)^2+K__wyb*`#mover(mi("w"),mo("&uminus0;"))`(_a, eta, tau)^2+`K__φyb`*`#mover(mi("φ",fontstyle = "normal"),mo("&uminus0;"))`(_a, eta, tau)^2+`K__ψy0`*`#mover(mi("ψ",fontstyle = "normal"),mo("&uminus0;"))`(_a, eta, tau)^2, _a = -1 .. 1)+Int(K__uyb*`#mover(mi("u"),mo("&uminus0;"))`(_a, eta, tau)^2+K__vyb*`#mover(mi("v"),mo("&uminus0;"))`(_a, eta, tau)^2+K__wyb*`#mover(mi("w"),mo("&uminus0;"))`(_a, eta, tau)^2+`K__φyb`*`#mover(mi("φ",fontstyle = "normal"),mo("&uminus0;"))`(_a, eta, tau)^2+`K__ψyb`*`#mover(mi("ψ",fontstyle = "normal"),mo("&uminus0;"))`(_a, eta, tau)^2, _a = -1 .. 1)))*h^2

(2)

``

``


 

Download simplifyss.mw

 

But I amezed when I use simplify command deteriorate my eq.

 

Why?

Hi all,

 

I am looking for a boolean logic check to see if a rational expression is simplified.

For example: x/x^2  =  1/x  I want something along the lines of issimplified(x/x^2)=FALSE

Similarily, (x^2-x-12)/(x-4) = x+3  so I would like some logic test to say (x^2-x-12)/(x-4) is NOT simplified.

 

Thanks in advance,

Mark

I am curious whether anyone here can come up with a way to simplify the expression x1 to 15*Pi/32 in fewer exact, symbolic steps. The following was performed in Maple 2016.2 for Linux.

restart;

x1 := arcsin(1/2*(2+(2+(2+2^(1/2))^(1/2))^(1/2))^(1/2));

arcsin((1/2)*(2+(2+(2+2^(1/2))^(1/2))^(1/2))^(1/2))

x2 := evalc(convert(x1,expln));

arctan((2+(2+(2+2^(1/2))^(1/2))^(1/2))^(1/2)/(2-(2+(2+2^(1/2))^(1/2))^(1/2))^(1/2))

x3 := convert(x2, expln);

((1/2)*I)*(ln(1-I*(2+(2+(2+2^(1/2))^(1/2))^(1/2))^(1/2)/(2-(2+(2+2^(1/2))^(1/2))^(1/2))^(1/2))-ln(1+I*(2+(2+(2+2^(1/2))^(1/2))^(1/2))^(1/2)/(2-(2+(2+2^(1/2))^(1/2))^(1/2))^(1/2)))

# non-Pro wolframalpha can simplify x3 to 15*Pi/32 (but not x2 or x1).
#

x4 := combine(x3);

((1/2)*I)*ln(-(I*2^(1/2)*((2+2^(1/2))*(2+(2+2^(1/2))^(1/2)))^(1/2)+I*(2*2^(1/2)+4)^(1/2)+I*2^(1/2)+(-1+I))/(I*2^(1/2)*((2+2^(1/2))*(2+(2+2^(1/2))^(1/2)))^(1/2)+I*(2*2^(1/2)+4)^(1/2)+I*2^(1/2)+1+I))

x5 := simplify(x4);

((1/2)*I)*(-ln(2)+ln(-(2+(2+2^(1/2))^(1/2))^(1/2)*(I*2^(1/2)*(2+2^(1/2))^(1/2)-I*2^(1/2)+1-I)))

x6 := expand(x5);

-((1/2)*I)*ln(2)+((1/4)*I)*ln(2+(2+2^(1/2))^(1/2))+((1/2)*I)*ln(-I*2^(1/2)*(2+2^(1/2))^(1/2)+I*2^(1/2)+(-1+I))

x7 := combine(x6);

-((1/4)*I)*(ln(-(1/2)*(2+2^(1/2))^(1/2)*(I*2^(1/2)+(-1-I)))+(2*I)*Pi)

simplify(x7,constant);

(15/32)*Pi

# It's a pity that last step worked while this next is inadequate.
simplify(x7);

-((1/4)*I)*ln(-(2+2^(1/2))^(1/2)*(I*2^(1/2)+(-1-I)))+((1/4)*I)*ln(2)+(1/2)*Pi

# Another way, using x7
simplify(evalc(x7));

(15/32)*Pi

# Another way, using x7
simplify(combine(expand(x7)));

(15/32)*Pi

 

Download simplify_example.mw

I am new user of Maple, couldn’t find solution for my problem in the last two days therefore I would like to turn to your community with my question. I am trying to replicate the calculations from a study to be sure about my understanding of the topic.

 

I cannot simplify the final equation even though the variables with their values are given. A screenshot and the file are attached, that might make easier to understand my problem.

I know what the solution should be. I cannot simplify/replace the values in the equation to get a simpler form; [(D0 - d1c - R)/ 2d1)]+c

 

Thank you if you have the time to help.

 

Joint_Pricing_Sol_.maple

Dear all,

I have the following problem: Maple does not simplify the denominator in the following example:

which gives

16*a^8*B/((dz*L*sqrt(s)*sqrt(s+c)*sqrt(L^2*s*(s+c)*dz^2+4*a^2)+L^2*s*(s+c)*dz^2+2*a^2)^2*(-dz*L*sqrt(s)*sqrt(s+c)*sqrt(L^2*s*(s+c)*dz^2+4*a^2)+L^2*s*(s+c)*dz^2+2*a^2)^2)

However, the result should be B. If only the denomiator is expanded it works: 

gives

16*a^8

which equals the nominator except for the B...

How can I use simplify in order to yield the desired result? 

Thanks a lot!

 

 

 

if I use the command below, I will get the right answer.

`assuming`([simplify((2*I)*deltas*Pi*BW*Ei(1, (2*I)*deltas*Pi*BW)-(2*I)*deltas*Pi*BW*Ei(1, -(2*I)*deltas*Pi*BW))], [real, BW > 0, deltas > 0, ts > 0, deltas <= ts, 2*BW*ts >= 1])

and the answer is :

2*BW*Pi*deltas*(Pi-2*Si(2*BW*Pi*deltas))

while I use the same command for the compliacated Ei function, it doesn't work any more, I don't know the reason.

 `assuming`([simplify(Ei(1, I*BW*Pi*deltas-(5*I)*BW*Pi*ts)-Ei(1, -I*BW*Pi*deltas+(5*I)*BW*Pi*ts), Ei)], [real, BW > 0, deltas > 0, ts > 0, deltas <= ts, 2*BW*ts >= 1])

 and it's reault is :

Ei(1,I*BW*Pi*deltas-5*I*BW*Pi*ts)-Ei(1,-I*BW*Pi*deltas+5*I*BW*Pi*ts)

 

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