mathematica simplify denominator - wolfram-mathematica

In this algebraic expression, how to force Mathematica to calculate first a common
denominator and then to simplify:
(32768 Sqrt[\[Pi]] Va)/((7/b^2 + 2/mua^2)^(3/2) mua^3) +
(32 Sqrt[\[Pi]] Va)/((b^2 + mua^2)^(3/2) (2/b^2 + 1/(b^2 + mua^2))^(3/2))
+ (6144 Sqrt[\[Pi]] Va)/((b^2 + mua^2)^( 3/2) (3/b^2 + 1/(b^2 + mua^2))^(3/2))
the expression is too long, this is only a part.

Use
Together[ (your expression here) ]

For this expression it works with Together[] and then Apart[]. But for a larger expression with 50 terms like these I used Expand[expression]//Factor, and then again Expand[expression] to separate the terms.

Related

How to simplify circuits

The answer to the question is A in case someone thinks Im cheating for a test or something. I really wan't to understand how to solve such questions. I am guessing there is some way to bring these brackets together and to get a simplified circuit but I don't understand it fully. Maybe something regarding truth tables?
abc' + a'bc' + a'b'c' + ab'c' initial expression
= (a + a')bc' + a'b'c' + ab'c' distributive law
= (T)bc' + a'b'c' + ab'c' additive inverse
= bc' + a'b'c' + ab'c' multiplicative identity
= bc' + (a' + a)b'c' distributive law
= bc' + (T)b'c' additive inverse
= bc' + b'c' multiplicative identity
= (b + b')c' distributive law
= (T)c' additive inverse
= c' multiplicative identity
The expression is equivalent to the inverse of c and so one logic gate is enough.

How to replace a Exponential function with a series in a complex expression using sympy or MMA?

I have a function like this :
The Funtion in MMA
the express for MMA code:
1/(-0.00001 + accT)^11 3.03226 (3.7499 - 8.57119 accT +
4.99983 accT^2 + 0.600048 accT^3 - 1.50004 accT^4 +
1. accT^5) (0.285697 + 0.0000119995 accT - 0.599976 accT^2 -
2.*10^-14 accT^3 + 1.5*10^-9 accT^4 - 0.00006 accT^5 +
1. accT^6) (-1. + E^(
3/2 (1 - (1.56078 (-0.00001 + accT))/phVel)^2)) phVel^2
I want to integrate accT in (0,1).
I have try lots of ways to integrate the function. Fox example,set the Lower limit of integration in 0.0000001 or split integral interval to every 0.01 then Multiply by the express,i.e,Rectangular method, loop i in [0.01,100]:
express1+=0.01*express(i)
but all fail.
so I try to using series to expand E^(3/2 (1 - (1.56078 ( -0.00001 + accT))/phVel)^2),and use the result replace Exponential function.
import sympy as sy
#like picture
express = .....
expressionSeries = sy.exp( 3/2 (1 - (1.56078 (-0.00001 +accT))/phVel)**2),
expressionSeries = sy.series(expressionSeries,accT,0,5)
expression = expression.subs(sy.exp( 3/2 (1 - (1.56078 (-0.00001 +accT))/phVel)**2),expressionSeries)
the code dosen't work.
The integrate result should integrate(express)~phVel^7
You have a factor of 1/(-0.00001 + accT)^11 and so when accT==0.00001 it looks like you will have infinity.
You might try to find
Simplify[
Limit[Integrate[yourfunction,{accT,0,a}],a->0.00001,Direction->"FromBelow"]+
Limit[Integrate[yourfunction,{accT,a,1}],a->0.00001,Direction->"FromAbove"]
]
but that looks like it might be adding -infinity and infinity and the result of that can be anything.
Lots of things about this question and this response really worry me.

Getting the equation for the line of intersection using Mathematica

I have a nasty expression that I am playing around with on Mathematica.
(-X + (2 X - X^2)/(
2 (-1 + X)^2 ((1 + 2 (-1 + p) X - (-1 + p) X^2)/(-1 + X)^2)^(3/2)))/X
I graphed it along with the plane z = 0 where X and p are both restricted from 0 to 1:
Plot3D[{nasty equation is here, 0}, {p , 0, 1}, {X, 0, 1}]
I decided it would be interesting to obtain the equation for the intersection of the plane generated from the nasty equation and z = 0. So I used solve:
Solve[{that nasty equation == 0}, {p, X}, Reals]
and the output was even nastier with some results having the # symbol in it ( I have no idea what it is, and I am new to Mathematica). Is there a way to get an equation for the nice line of intersection between the nasty equation and z = 0 where p and X are restricted from 0 to 1? In the graph generated from Plot3D I see that the line of intersection appears to be some nice looking half parabola looking thing. I would like the equation for that if possible. Thank you!
For complicated nasty equations Reduce is often more powerful and less likely to give you something that you will later find has hidden assumptions inside the result. Notice I include your constraint about the range of p and X to give Reduce the maximum amount of
information that I can to help it produce the simplest possible solution for you.
In[1]:= Reduce[(-X + (2 X-X^2)/(2 (-1 + X)^2 ((1 + 2 (-1 + p) X - (-1 + p) X^2)/
(-1 + X)^2)^(3/2)))/X == 0 && 0 < X < 1 && 0 < p < 1, {X, p}]
Out[1]= 0<X<1 && p == Root[12 - 47*X + 74*X^2 - 59*X^3 + 24*X^4 - 4*X^5 + (-24 +
108*X - 192*X^2 + 168*X^3 - 72*X^4 + 12*X^5)*#1 + (-48*X + 144*X^2 - 156*X^3 +
72*X^4 - 12*X^5)*#1^2 + (-32*X^2 + 48*X^3 - 24*X^4 + 4*X^5)*#1^3 & , 1]
Root is a Mathematica function representing a root of a usually complicated polynomial
that would often be much larger if the actual root were written out in algebra, but we
can see whether the result is understandable enough to be useful by using ToRadicals.
Often Reduce will return several different alternatives using && (and) and || (or) to
let you see the details you must understand to correctly use the result. See how I
copy the entire Root[...] and put that inside ToRadicals. Notice how Reduce returns
answers that include information about the ranges of variables. And see how I give Simplify the domain information about X to allow it to provide the greatest possible simplification.
In[2]:= Simplify[ToRadicals[Root[12 - 47 X + 74 X^2 - 59 X^3 + 24 X^4 - 4 X^5 +
(-24 + 108 X - 192 X^2 + 168 X^3 - 72 X^4 + 12 X^5) #1 + (-48 X + 144 X^2 -
156 X^3 + 72 X^4 - 12 X^5) #1^2 + (-32 X^2 + 48 X^3 - 24 X^4+ 4 X^5)#1^3&,1]],
0 < X < 1]
Out[2]= (8*X - 24*X^2 + 26*X^3 - 12*X^4 + 2*X^5 + 2^(1/3)*(-((-2 + X)^8*(-1 +
X)^2*X^3))^(1/3))/(2*(-2 + X)^3*X^2)
So your desired answer of where z= 0 will be where X is not zero, to avoid 0/0 in
your original equation, and where 0 < X < 1, 0 < p < 1 and where p is a root of that
final complicated expression in X. That result is a fraction and to be a root you
might take a look at where the numerator is zero to see if you can get any more
information about what you are looking for.
Sometimes you can learn something by plotting an expression. If you try to plot that final result you may end up with axes, but no plot. Perhaps the denominator is causing problems. You can try plotting just the numerator. You may again get an empty plot. Perhaps it is your cube root giving complex values. So you can put your numerator inside Re[] and plot that, then repeat that but using Im[]. Those will let you plot just the real and imaginary parts. You are doing this to try to understand where the roots might be. You should be cautious with plots because sometimes, particularly for complicated nasty expressions, the plot can make mistakes or hide desired information from you, but when used with care you can often learn something from this.
And, as always, test this and everything else very carefully to try to make sure that no mistakes have been made. It is too easy to "type some stuff into Mathematica, get some stuff out", think you have the answer and have no idea that there are significant errors hidden.

Faster alternative to NSolve

I have an equation, which I am trying to solve using NSolve in Mathematica. Here is how I do it:
T == (0.000242895 E^(-(2.09472*10^11/(5.70068*10^8 +
7.76206*10^12 T))))/(1 +
0.969073 E^(-(4.18945*10^11/(5.70068*10^8 + 7.76206*10^12 T))) -
1.96883 Cos[8.77331*10^6/(2.28027*10^9 + 7.76206*10^12 T)])
NSolve[T == (0.000242895 E^(-(2.09472*10^11/(5.70068*10^8 +
7.76206*10^12 T))))/(1 +
0.969073 E^(-(4.18945*10^11/(5.70068*10^8 + 7.76206*10^12 T))) -
1.96883 Cos[8.77331*10^6/(2.28027*10^9 + 7.76206*10^12 T)])
, {T}, Reals]
The problem is that it takes a long time (~1min) to find a solution. Is there a faster way to obtain a solution other than using NSolve?
The denominator of your expression goes through zero at approximately T=215. The other solution is T=0. If you want the non-zero solution simply use
FindRoot[denom,{T,T0}]
where T0 is most any positive number. This takes about a millisecond.

How can I get rid of irritating prefactor of one in Mathematica?

I am trying to refine algebraic expressions into a convenient form using Mathematica to make sure I don't drop a sign or make some other trivial slip. After a lot of swearing, I have come to accept that this is not a deterministic process and I will have to do it step by step and also that the algebraic manipulation palette is my friend. However, there is still one thing that's driving me nuts. Sometimes mathematica spits out expressions with these seemingly extraneous leading ones. For example, right now I'm looking at:
0.5*(1.*Log[-1.*a^2 + 1.*bigr^2] - 1.*Log[1.*a^2 - 2.*a*bigr + 1.*bigr^2])
when I would much rather be looking at:
0.5*(Log[-a^2 + bigr^2] - Log[a^2 - 2.*a*bigr + bigr^2])
It's more than just a cosmetic problem because it confuses Factor[] when I try to apply it to some of the obvious quadratic factorizations in the above expression. Any clean fixes?
your = 0.5*(1.*Log[-1.*a^2 + 1.*bigr^2] - 1.*Log[1.*a^2 - 2.*a*bigr + 1.*bigr^2])
your /. {1. -> 1, -1. -> -1}
(* -> 0.5 (Log[-a^2 + bigr^2] - Log[a^2 - 2. a bigr + bigr^2]) *)
The dot after the 1 tells mathematica to treat the number as a non-exact quantity. So for example
1. * 1/2
(* -> .5 *)
but
1 * 1/2
(* -> 1/2 *)
Use exact quantities in your calculations (1, 2, 1/2) instead of decimal numbers (1., 2. ,0.5) if you need exact results
expr = 0.5*(1.*Log[-1.*a^2 + 1.*bigr^2] - 1.*Log[1.*a^2 - 2.*a*bigr + 1.*bigr^2]);
Convert all approximate numbers to precise:
expr // Rationalize
1/2 (Log[-a^2 + bigr^2] - Log[a^2 - 2 a bigr + bigr^2])
Selectively:
expr /. x_ /; x == 1 -> 1
0.5 (Log[-1. a^2 + bigr^2] - 1. Log[a^2 - 2. a bigr + bigr^2])

Resources