Community RSS Feed
http://community.wolfram.com
RSS Feed for Wolfram Community showing any discussions in tag Mathematics sorted by activeHow can I display graphic objects in a 3D-Plot, during an Animation?
http://community.wolfram.com/groups/-/m/t/1229147
Hello
My Goal is to animate a function together with graphical objects.
So far, I couldn't find any analogical examples on the web or the documentation.
Here is what I have:
Animate[Plot3D[{(−1)(x^2+y^2)n+n,nSin[y],Graphics3D[Arrow[{{5,5,5},{0,0,0}}]]},{x,−5,5},{y,−5,5},PlotRange→{−4,8},PlotPoints→50,Mesh−>All],{n,0,5,0.02}]
The Programm seems to ignore my Graphics3D[ ] command. I would expect an error message if i wrote some nonsence, but it did not occur.
It should display shown functions in an animation, together with an animated arrow in one window. Instead, I get to see both functions only. Also interresting: if i put the animation expressions in different order, mathematica will display the arrow and the functions in sepparate Windows:
Animate[{Graphics3D[Arrow[{{n,5,5},{0,0,0}}]],Plot3D[Sin[y]n,{x,0,5},{y,0,5}]},{n,0,5,0.02}]
I am sitting on this for weeks now, the Wolfram community is my last resort.
Please help.
Marc
Marc Graefenstein2017-11-24T16:24:30ZPlot a phase portrait of two complex ODE
http://community.wolfram.com/groups/-/m/t/1228087
Hi, I have two ODE's, which list as:
y = x' and y' = -i*b*x -c
where b and c are exponential constants. How can I generate a phase portrait of this ODE in wolfram alpha?
Thanks!Ser Man2017-11-24T09:34:41ZReplace an "Except" element of a matrix under a Table?
http://community.wolfram.com/groups/-/m/t/1224574
Dear Friends,
In a "For" operation, I have a table defined by indices i & j. Any (i, j)th element of this table consist of the elements of matrix f[m] (6X1 matrix), where m is the element (Integer) on which "For" loop is running.
During the "For" loop I want to replace the terms f[m][[k] by f[m-1][[k]], where k is a number other than the indices i & j for the (i, j)th element.
When I tried to use
`/.f[m][[X-]] -> f[m-1][[X]]`,
I am getting the following error message --
Part::pkspec1: The expression x$_ cannot be used as a part specification.
Could there be an alternative way to achieve this ??
thanks for the help in advance !S G2017-11-19T01:59:09ZUse symbolic vectors for physics?
http://community.wolfram.com/groups/-/m/t/1226443
Dear all
It is possible to use Symbolic Vector to perform the typical vector operations we use in Physics (for example, electromagnetism)? I mean, for example, applying vector identities to vector fields, like
rot ( rot (A)) = grad( div(A)) - laplacian(A)
o, more interesting for me, to obtain dispersion relations from differential equations. I have seen the documentation for symbolic vectors and tensors, but I assume that there should be more detailed information somewhere. There is already a thread on a closely related subject
http://community.wolfram.com/groups/-/m/t/1127218
but I am not able to obtain a practical conclusion.
Is there an example or tutorial of these type of calculations with Mathematica?
Thank you. Best wishes.
Carlos Soria-Hoyo
Sevilla
SPAINCarlos Soria-Hoyo2017-11-22T09:23:01ZPlot data as ListContourPlot inside a circle/disk ?
http://community.wolfram.com/groups/-/m/t/1226511
I've data points for cylindrical coordinates that I need to plot as a contour plot in a circle. the plot is being generated as x-y plot .. I need it to be in cylindrical ordinate so 2D would be a disk or a circle .. is there anyway to generate this ?Omar Habib2017-11-22T12:47:01ZMake a proper Classic Klein Bottle in version 11.20 of Mathematica?
http://community.wolfram.com/groups/-/m/t/1224031
Everything works fine in version 10, but in Version 11.20 there is a slice taken out of the Klein Bottle image...It does this no matter what version of the code I use in Version 11.2. It also does it while making a stylized Klein Bottle described here...
http://members.wolfram.com/jeffb/visualization/klein.shtml
Here is an example of code that makes a faulty output...Can someone come up with code that makes a proper Klein Bottle without a slice taken out out it in Version 11.20?
klein[u_, v_] := Module[{
bx = 6 Cos[u] (1 + Sin[u]),
by = 16 Sin[u],
rad = 4 (1 - Cos[u]/2),
X, Y, Z},
X = If[Pi < u <= 2 Pi, bx + rad Cos[v + Pi], bx + rad Cos[u] Cos[v]];
Y = If[Pi < u <= 2 Pi, by, by + rad Sin[u] Cos[v]];
Z = rad Sin[v];
{X, Y, Z}
]
ParametricPlot3D[klein[u, v], {u, 0, 2 Pi}, {v, 0, 2 Pi},
Axes -> False, Boxed -> False, ViewPoint -> {1.4, -2.6, -1.7}]
![enter image description here][1]
[1]: http://community.wolfram.com//c/portal/getImageAttachment?filename=werrwrrw.png&userId=11733Roy Scott2017-11-18T01:58:23ZPairs Trading with Copulas
http://community.wolfram.com/groups/-/m/t/1111149
**Introduction**
In a previous post, [Copulas in Risk Management][1], I covered the theory and applications of copulas in the area of risk management, pointing out the potential benefits of the approach and how it could be used to improve estimates of Value-at-Risk by incorporating important empirical features of asset processes, such as asymmetric correlation and heavy tails.
In this post I take a different tack, to show how copula models can be applied in pairs trading and statistical arbitrage strategies.
This is not a new concept - it stems from when copulas began to be widely adopted in financial engineering, risk management and credit derivatives modeling. But it remains relatively under-explored compared to more traditional techniques in this field. Fresh research suggests that it may be a useful adjunct to the more common methods applied in pairs trading, and may even be a more robust methodology altogether, as we shall see.
**Traditional Approaches to Pairs Trading**
Researchers often use simple linear correlation or distance metrics as the basis for their statistical arbitrage strategies. The problem is that statistical relationships may be nonlinear or nonstationary. Correlations (and betas) that have fluctuated in a defined range over a considerable period of time may suddenly break down, producing substantial losses.
A more sophisticated technique is the Kalman Filter, which can be used as a means of dynamically updating the the estimated correlation or relative beta between pairs (or portfolios) of stocks, a technique I have written about in the post Statistical Arbitrage with the Kalman Filter.
Another commonly employed econometric technique relies on cointegration relationships between pairs or small portfolios of stocks, as described in my post on Developing Statistical Arbitrage Strategies Using Cointegration. The central idea is that, in theory, cointegration is a more stable and reliable basis for assessing the relationship between stocks than correlation.
Researchers often use a combination of methods, for example by requiring stocks to be both cointegrated and with stable, high correlation throughout the in-sample formation period in which betas are estimated.
In all these cases, however, the challenge is that, no matter how they are derived or estimated, statistical relationships have a tendency towards instability. Even a combination of several of these methods often fails to detect signs of a breakdown in statistical relationships. There is even evidence that cointegration models are no more robust or reliable than simple correlations. For example, in his paper On the Persistence of Cointegration in Pairs Trading, Matthew Clegg assess the persistence of cointegration among U.S. equities in the calendar years 2002-2012, comprising over 860,000 pairs in total. He concludes that “the evidence does not support the hypothesis that cointegration is a persistent property”.
**Pairs Trading in the S&P500 and Nasdaq Indices**
To illustrate the copula methodology I will use an equity pair comprising the S&P 500 and Nasdaq indices. These are not tradable assets, but the approach is the same regardless and will serve for the purposes of demonstrating the technique.
We begin by gathering daily data on the indices and calculating the log returns series. We will use the data from 2010 to 2015 as the in-sample “formation” period, and test the strategy out of sample on data from Jan 2016-Feb 2017.
![enter image description here][2]
![enter image description here][3]
![enter image description here][4]
![enter image description here][5]
![enter image description here][6]
The chart below shows a scatter plot of daily percentage log returns on the SP500 and NASDAQ indices.
![enter image description here][7]
![enter image description here][8]
**MODELING**
**Marginal Distribution Fitting**
In the post Copulas in Risk Management it was shown that the returns series for the two indices were well-represented by Student T distributions. I replicate that analysis here, estimating the parameters by maximum likelihood and proceed from there to test each distribution for goodness of fit. In each case, the Student T distribution appears to provide an adequate fit for both series.
![enter image description here][9]
![enter image description here][10]
![enter image description here][11]
![enter image description here][12]
**Copula Calibration**
We next calibrate the parameters for the Gaussian copula by maximum likelihood, from which we derive the joint distribution for returns in the two indices via Sklar’s decomposition. This will be used directly in the pairs trading algorithm. As pointed out previously, there are several alternatives to MLE, including the Method of Moments, for example, and these are listed in the Mathematica documentation for the EstimatedDistrubution function.
![enter image description here][13]
![enter image description here][14]
![enter image description here][15]
![enter image description here][16]
![enter image description here][17]
![enter image description here][18]
**Pairs Trading with the Copula Model**
Once we have successfully fitted marginal distributions for the two series and a copula distribution to describe their relationship, we are able to derive the joint distribution. This means that we can directly calculate the joint probability of each pair of data observations. So, for instance, we find that the probability of a return in the S&P500 of 5% or more, together with a return in the Nasdaq of 1% or higher, is approximately 0.2%:
![enter image description here][19]
![enter image description here][20]
So the way we test our model is to calculate the daily returns for the two indices during the-out-of sample period from Jan 2016 to Feb 2017 and compute the probability of each pair of daily observations. On days where we see observation pairs with abnormally low estimated probabilities, we trade the pair accordingly over the following day.
Naturally, there are multiple issues with this simplistic approach. To begin with, the indices are not tradable and if they were we would have to account for transaction costs including the bid-offer spread. Then there is the issue of determining where to set the probability threshold for initiating a trade. We also need to decide on criteria to try to optimize the trade holding period or trade exit rules. And, finally, we need to think about trade expression: for example, we might attempt to trade both legs passively, perhaps crossing the spread to fill the remaining leg when an order for one of the pairs is filled.
But none of these issues are specific to the copula approach - they apply equally to all of the methods discussed previously. So, for the sake of clarity, I am going to ignore them. In this analysis I pick a threshold probability level of 15% and assume we hold the trade for one day only, opening and closing the trade at the start and end of the day after we receive a signal. In computing the returns for each trade I ignore any transaction costs.
First, we gather data for the test period:
![enter image description here][21]
Next, we use the estimated joint distribution to compute the probability of each daily observation of index returns. We gather the daily returns series and associated probability series into a single temporal variable:
![enter image description here][22]
![enter image description here][23]
We plot the time series of index returns and associated probabilities as follows:
![enter image description here][24]
![enter image description here][25]
![enter image description here][26]
![enter image description here][27]
**Trade Signal Generation**
The table below lists the index returns and joint probabilities over the first several days of the series. The sequence of trade signals is as follows:
After a very low probability reading for 2016/1/4, we take equally weighted positions short the S&P500 Index and long the Nasdaq index on 2016/1/5. We close the position at the end of the day, producing a total return of 0.44%. Similar signals are generated on 2016/1/6, 2016/1/7, 2016/1/8, 2016/1/13 , 2016/1/15 and 2016/1/20 (assuming a 15% probability threshold). We take the reverse trade (Buy the S&P500, Sell the Nasdaq) on only one occasion in the initial part of the sample, on 2016/1/14.
![enter image description here][28]
![enter image description here][29]
**Pairs Trading Strategy Results**
We are now ready to apply the trading algorithm to the entire sample and chart the resulting P&L.
![enter image description here][30]
![enter image description here][31]
![enter image description here][32]
![enter image description here][33]
**Comment on Strategy Performance**
The performance of the strategy over the out-of-sample period, at just under 4%, can hardly be described as stellar. But this is largely due to the dampening of volatility seen in both indices over the last year, which is reflected in the progressively lower volatility of joint probabilities over the course of the test period. Such variations in signal frequency and trading strategy performance are commonplace in any statistical arbitrage strategy, regardless of the methodology used to generate the signals.
The obvious remedy is to create similar trading algorithms for a large number of pairs and combine them together in an overall portfolio that will produce a sufficient number of signals and trading opportunities to make the performance sufficiently attractive. One of the benefits of statistical arbitrage strategies developed in this way is their highly efficient use of capital, since the combination of long and short positions minimizes the margin requirement for each trade and for the portfolio as a whole.
Finally, it is worth noting here that, in principle, one could easily create similar copula-based arbitrage strategies for triplets, quadruplets, or any (reasonably small) number of assets. The principle restriction lies in the increasing difficulty of estimating the copulas and joint densities, given the slow convergence of the MLE method.
**Recent Research**
In the last few years several researchers have begun exploring the application of copulas as a basis for statistical arbitrage. In their paper “Nonlinear dependence modeling with bivariate copulas: Statistical arbitrage pairs trading on the S&P 100”, Krauss and Stubinger apply the copula approach to pairs drawn from the universe of S&P 100 index constituents, with promising results. They conclude that their “findings pose a severe challenge to the semi-strong form of market efficiency and demonstrate a sophisticated yet profitable alternative to classical pairs trading”.
In the paper by Rad, et al., cited below, the researchers compare several different methods for pairs trading strategies. They find that all of the tested methods produce economically significant returns, but only the performance of the copula-based approach remains consistent after 2009. Further, the copula method shows better performance for its unconverged trades compared to those of the other methods.
**Conclusion**
The application of copulas to statistical arbitrage strategies is an interesting and relatively under-explored alternative to the usual distance and correlation based methods. In addition to its sound theoretical underpinnings, the copula approach appears to offer greater consistency in performance compared to traditional techniques, whose efficacy has declined since the financial crisis on 2008/09. The benefits of the approach must be weighed against its greater computational complexity, although with the growth in the power of modeling software in recent years this represents less of an obstacle than it has previously.
**References**
Clegg., M., , On the Persistence of Cointegration in Pairs Trading, Jan. 2014
Krauss, C. and Stubinger , J., Nonlinear dependence modeling with bivariate copulas: Statistical arbitrage pairs trading on the S&P 100, Institut für Wirtschaftspolitik und Quantitative Wirtschaftsforschung, No 15/2015.
Rad, H., Kwong, R., Low, Y. and Faff, R., The profitability of pairs trading strategies: distance, cointegration, and copula methods, Quantitative Finance, DOI: org/10.1080/14697688.2016.1164337, 2015
[1]: http://jonathankinlay.com/2017/01/copulas-risk-management/
[2]: http://community.wolfram.com//c/portal/getImageAttachment?filename=PairsTradingwithCopulas_1.gif&userId=773999
[3]: http://community.wolfram.com//c/portal/getImageAttachment?filename=PairsTradingwithCopulas_2.png&userId=773999
[4]: http://community.wolfram.com//c/portal/getImageAttachment?filename=7037Fig1.png&userId=773999
[5]: http://community.wolfram.com//c/portal/getImageAttachment?filename=PairsTradingwithCopulas_3.gif&userId=773999
[6]: http://community.wolfram.com//c/portal/getImageAttachment?filename=PairsTradingwithCopulas_4.gif&userId=773999
[7]: http://community.wolfram.com//c/portal/getImageAttachment?filename=PairsTradingwithCopulas_5.png&userId=773999
[8]: http://community.wolfram.com//c/portal/getImageAttachment?filename=PairsTradingwithCopulas_6.gif&userId=773999
[9]: http://community.wolfram.com//c/portal/getImageAttachment?filename=PairsTradingwithCopulas_7.gif&userId=773999
[10]: http://community.wolfram.com//c/portal/getImageAttachment?filename=PairsTradingwithCopulas_8.png&userId=773999
[11]: http://community.wolfram.com//c/portal/getImageAttachment?filename=PairsTradingwithCopulas_10.gif&userId=773999
[12]: http://community.wolfram.com//c/portal/getImageAttachment?filename=4282Fig2.png&userId=773999
[13]: http://community.wolfram.com//c/portal/getImageAttachment?filename=PairsTradingwithCopulas_16.gif&userId=773999
[14]: http://community.wolfram.com//c/portal/getImageAttachment?filename=PairsTradingwithCopulas_17.png&userId=773999
[15]: http://community.wolfram.com//c/portal/getImageAttachment?filename=PairsTradingwithCopulas_18.png&userId=773999
[16]: http://community.wolfram.com//c/portal/getImageAttachment?filename=PairsTradingwithCopulas_19.gif&userId=773999
[17]: http://community.wolfram.com//c/portal/getImageAttachment?filename=PairsTradingwithCopulas_20.png&userId=773999
[18]: http://community.wolfram.com//c/portal/getImageAttachment?filename=PairsTradingwithCopulas_21.gif&userId=773999
[19]: http://community.wolfram.com//c/portal/getImageAttachment?filename=PairsTradingwithCopulas_22.png&userId=773999
[20]: http://community.wolfram.com//c/portal/getImageAttachment?filename=PairsTradingwithCopulas_23.png&userId=773999
[21]: http://community.wolfram.com//c/portal/getImageAttachment?filename=PairsTradingwithCopulas_24.gif&userId=773999
[22]: http://community.wolfram.com//c/portal/getImageAttachment?filename=PairsTradingwithCopulas_25.gif&userId=773999
[23]: http://community.wolfram.com//c/portal/getImageAttachment?filename=PairsTradingwithCopulas_26.gif&userId=773999
[24]: http://community.wolfram.com//c/portal/getImageAttachment?filename=PairsTradingwithCopulas_27.png&userId=773999
[25]: http://community.wolfram.com//c/portal/getImageAttachment?filename=PairsTradingwithCopulas_28.gif&userId=773999
[26]: http://community.wolfram.com//c/portal/getImageAttachment?filename=PairsTradingwithCopulas_29.png&userId=773999
[27]: http://community.wolfram.com//c/portal/getImageAttachment?filename=PairsTradingwithCopulas_30.gif&userId=773999
[28]: http://community.wolfram.com//c/portal/getImageAttachment?filename=PairsTradingwithCopulas_31.gif&userId=773999
[29]: http://community.wolfram.com//c/portal/getImageAttachment?filename=2430Fig3.png&userId=773999
[30]: http://community.wolfram.com//c/portal/getImageAttachment?filename=PairsTradingwithCopulas_32.gif&userId=773999
[31]: http://community.wolfram.com//c/portal/getImageAttachment?filename=PairsTradingwithCopulas_33.gif&userId=773999
[32]: http://community.wolfram.com//c/portal/getImageAttachment?filename=PairsTradingwithCopulas_34.png&userId=773999
[33]: http://community.wolfram.com//c/portal/getImageAttachment?filename=PairsTradingwithCopulas_35.gif&userId=773999Jonathan Kinlay2017-05-30T17:41:07Z[✓] Plot rational functions?
http://community.wolfram.com/groups/-/m/t/1225057
Please, could any body help me? I want to plot graphics of elementary rational functions like f(x)=1/x, or g(x)= (x^2+1)/(x^2-4), what I got is not correct. I have tried to indicate the intervals of the domain of the function with inequalities but it does not work, for instance for g(x): -6<x<-2, -2<x<2, 2<x<6. I understand is a problem with x values that make zero the denominator. I attach a file with the examples. Thank you very much.
----------
Plot[f[x] = 1/x, {x, -6, 6}, PlotStyle -> Directive[RGBColor[1, 0, 0], AbsoluteThickness[2.25],
Arrowheads[{-.05, .05}]], GridLines -> {Range[-6, 6, 1], Range[-6, 6, 1]},
Ticks -> {Range[-6, 6, 1], Range[-6, 6, 1]}] /. Line -> Arrow
![enter image description here][1]
Plot[f[x] = (1 + x^2)/(-4 + x^2), {x, -6, 6}, PlotStyle -> Directive[RGBColor[1, 0, 0],
AbsoluteThickness[2.25], Arrowheads[{-.05, .05}]], GridLines -> {Range[-6, 6, 1], Range[-6, 6, 1]},
Ticks -> {Range[-6, 6, 1], Range[-6, 6, 1]}] /. Line -> Arrow
![enter image description here][2]
[1]: http://community.wolfram.com//c/portal/getImageAttachment?filename=asdf43qtwrhgs.png&userId=11733
[2]: http://community.wolfram.com//c/portal/getImageAttachment?filename=4356yehtgfsd.png&userId=11733Salvador Benjamin P. R.2017-11-20T08:20:42ZIs Dr. Chung's symbolic package access available?
http://community.wolfram.com/groups/-/m/t/1225366
Dr. Chung recently received a reward from Wolfram for his symbolic package. Does anyone know how to gain access?
here is his book:
[book][1]
defunct link:
http://symbcomp.gist.ac.kr/
defunct 2011 sample:
http://library.wolfram.com/infocenter/Conferences/8063/
[1]: https://link.springer.com/chapter/10.1007/978-3-662-44199-2_4Kay Herbert2017-11-21T04:30:43Z[✓] Color Function not correctly mapping to range?
http://community.wolfram.com/groups/-/m/t/1224856
Observe the following code:
nd[y_, a_, b_, n_] := (Binomial[b - a + 1, y]*Sum[((-1)^i)*Binomial[y, i]*((y - i)/(b - a + 1))^n, {i, 0, y}]);
mycolorfun = Function[Blend[{Black, Purple, Blue, Green, Yellow, Orange, Red, White}, Rescale[#, {0, 1}]]]
Manipulate[
ArrayPlot[Table[nd[y, 1, K, n], {K, 1, 25}, {n, 1, 25}],
ColorFunction -> mycolorfun, DataReversed -> True, Frame -> True,
FrameTicks -> Automatic,
FrameLabel -> {Rotate["K", -90 Degree], "N"}], {y, 1, 15, 1}]
Notice how when the slider is moved up to y=15, there is a white square that appears at N = 25 and K = 21:
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/8Qutc.png
My goal is for the color function to map the individual value of the output of my function to a color as dependent on its closeness to 0 or 1 (since my function is a probability density function, this makes sense).
However, look what happens when you check the actual value of the function for N = 25 and b=K=21:
nd[15, 1, 21, 25.0]
(out) 0.268495
I get 26%! 26% should be mapping to a color somewhere around Purple/Blue, but it's getting mapped all the way up to the color white! White is what's supposed to be mapped to when the output of my function is really close to 1! Clearly something is amiss here, and I cannot figure out what it is. Can somebody please explain what is going on and what I need to do to get the desired color output?John Travolski2017-11-19T17:59:19ZTurn this system of differential equations into a single equation?
http://community.wolfram.com/groups/-/m/t/1224952
Consider the following code:
{
0 == -voltageC0[t] - 2*voltageC0''[t] + 2*voltageC1''[t],
0 == -voltageC1[t] - 2*voltageC1''[t] + 2*voltageC0''[t]
}
I am able to solve this system using DSolve, but now I want to do something different. I want to convert it into a single differential equation, expressed in terms of voltageC0 without reference to voltageC1, in this form:
0 == a0*voltageC0[t] + a1*voltageC0'[t] + a2*voltageC0''[t] + a3*voltageC0'''[t]
I show a 3rd-order solution as an example, but that is just for example of the target form, and the actual order may turn out to be more or less than 3 for all I know.
I want to find what the values of a0, a1, etc. are. Does Mathematica have facilities to help with this? I believe the conversion should be possible, but I don't understand the process for converting.Joe Donaldson2017-11-20T01:58:40ZWhy does the WolframKernel exit on OS X without a trace during Integrate?
http://community.wolfram.com/groups/-/m/t/1222503
I am trying to calculate a quantity from its density in 3D over a rectangular 2D window frame the following way:
mflxx = Integrate[
mi3ret[[1, 1]], {y, -w/2,
w/2}, {z, -(c/2 + zf + d/2), -(c/2 + zf + d/2 + h)}]
where `mi3ret[[1,1]]` is a fairly long expression containing only elementary functions of the `x,y` and `z` variables, and it is the x-component of a 3D vector function. It also contains some constant parameters, like `a,b,c`. `zf,d,h` are additional constants for the definite integral. After a long calculation the `WolframKernel` is killed by the OS without any message or CrashReport. So, after rebooting the machine and running just Mathematica and the Activity Monitor, I made some screenshuts to see, how the memory is used and put the memory related value into lists. See notebook attached, where the 0 minute is really after about one and half hours into the run. The machine is an early 2011 Early MacPro with 64GB memory and a 500GB Flashdrive partitioned into two 250GB partition. So, the questions are:
1. Why the `WolframKernel` is killed without a trace?
2. Can the OS tuned in such a way that `Integrate` can finish its run?
3 Is there a command or function in Mathematica that would alert to the coming
doom and would allow the examination of the status of the machine, including the status of the `WolframKernel`?
4. Is it possible to configure Mathematica to use, for disk based intermediate storage, the partition that have more free space, /the boot drive itself has 150GB, the other partition has 230GB free space/ ?
Thanks ahead,
JánosJanos Lobb2017-11-15T04:29:13Z[✓] Solve/Reduce systems with an array of variables?
http://community.wolfram.com/groups/-/m/t/1224718
As a simple example I want to reduce the equation d1+2*d2==2, where d1 and d2 are either 0 or 1. This is easy:
In[147]:= Reduce[{d1 + 2 d2 == 2, d1 == 0 || d1 == 1,
d2 == 0 || d2 == 1}, {d1, d2}]
Out[147]= d1 == 0 && d2 == 1
But if I use an array d[i] instead of d1, d2 for the unknown variables, I cannot get it to work. The following seems to be syntactically correct, but it does not work:
In[152]:= Reduce[{d[1] + 2 d[2] == 2,
ForAll[i, d[i] == 0 || d[i] == 1]}, d]
During evaluation of In[152]:= Reduce::nsmet: This system cannot be solved with the methods available to Reduce.
Out[152]= Reduce[{d[1] + 2 d[2] == 2, \!\(
\*SubscriptBox[\(\[ForAll]\), \(i\)]\((d[i] == 0 || d[i] == 1)\)\)},
d]
Of course this example ist extremely simplified. I need some solution for a large d-Array of variables and some equation containing them.Werner Geiger2017-11-19T13:54:34Z[✓] Solve a cubic equation?
http://community.wolfram.com/groups/-/m/t/1222449
Please look at this outcome:
![enter image description here][1]
As you see, all 3 roots are complex numbers. But this equition has a real root at least 1.
This is 0.1736 ... (exactly sin 10 degrees).
![enter image description here][2]
Where is my fault?
[1]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ucuncuDD_forumSoru1.PNG&userId=1222434
[2]: http://community.wolfram.com//c/portal/getImageAttachment?filename=ucuncuDD_forumSoru2.PNG&userId=1222434Metin Guney2017-11-15T09:21:51Z[GIF] Microcosm (Stereographic projection of cube grid)
http://community.wolfram.com/groups/-/m/t/1225032
![Stereographic projection of cube grid][1]
**Microcosm**
This is conceptually very simple: take a $7 \times 7$ grid of unit cubes in space, normalize to the unit sphere, stereographically project to the plane, then apply a rotation to the original grid of cubes. Here's the code:
Stereo[p_] := 1/(1 - p[[-1]]) p[[;; 2]];
With[{n = 3, cols = RGBColor /@ {"#4EEAF6", "#291F71"}},
Manipulate[
Graphics[
{Opacity[.5], CapForm[None], cols[[1]], Thickness[.006],
Line[
Flatten[
Transpose[
Table[
Stereo[Normalize[#]] & /@
{{t,
y Cos[θ] - z Sin[θ],
z Cos[θ] + y Sin[θ]},
{y, t Cos[θ] - z Sin[θ],
z Cos[θ] + t Sin[θ]},
{y, z Cos[θ] - t Sin[θ],
t Cos[θ] + z Sin[θ]}},
{z, -n - 1/2, n + 1/2}, {y, -n - 1/2, n + 1/2}, {t, -n - 1/2.,
n + 1/2, 1/20}],
{2, 3, 4, 1, 5}],
2]
]
},
PlotRange -> 1, Axes -> False, ImageSize -> 540, Background -> cols[[-1]]],
{θ, 0, π/2}]
]
[1]: http://community.wolfram.com//c/portal/getImageAttachment?filename=rotateStereo12c.gif&userId=610054Clayton Shonkwiler2017-11-20T05:51:30Z[✓] Avoid crooked line in $\log(\frac{a+1}{c+1})$ contour plot?
http://community.wolfram.com/groups/-/m/t/1224136
I plotted contour plot of this formula by Wolfram Alpha
$$\log(\frac{a+1}{c+1}), 0 < a < 1000, 0 < c < 1000$$
![enter image description here][1]
In the above figure, there is a crooked line in the bottom part. If I plot this, there is no crooked line.
$$\log(\frac{a}{c}), 0 < a < 1000, 0 < c < 1000$$
Why there is crooked line in the first case?
[1]: http://community.wolfram.com//c/portal/getImageAttachment?filename=a7xLc.gif&userId=11733Jayong Kim2017-11-18T08:36:17ZAvoid syntax problems in the following functions?
http://community.wolfram.com/groups/-/m/t/1224968
Good evening! I am working on a quantum mechanics problem using Mathematica and when I typed in the functions I need, I keep getting syntax problem saying " Expression imcomplete, more input needed". I have no idea what is going on. Will anyone help me with it? Thank you so much!!!
Input:
\!\(\*SuperscriptBox[\(J\), \('\)]\)[D_] :=
N[E, 10]^2/(
4*\[Pi]*Quantity[1, "ElectricConstant"]*
Quantity["BohrRadius"]) (1/D -
Exp[-2*D] (1/D + 11/8 + (3 D)/4 + D^2/6))
Getting:Syntax::sntxi
Input:
(J^')[D_]:=N[E,10]^2/(4*\[Pi]*Quantity[1, "ElectricConstant"]*Quantity["BohrRadius"]) (1/D-Exp[-2D]*(1/D+11/8+(3D)/4+D^2/6))
\!\(\*SuperscriptBox[\(K\), \('\)]\)[D_] :=
N[E, 10]^2/(
20*\[Pi]*Quantity[1, "ElectricConstant"]*
Quantity[
"BohrRadius"]) (-Exp[-2*D] (-25/8 + 23/4 D + 3 D^2 + 1/3 D^3) +
6/D (\[CapitalDelta]^2 (N[EulerGamma, 10] + Log[D]) +
\!\(\*SuperscriptBox[\(\[CapitalDelta]\), \('\)]\)^2*
ExpIntegralEi[-4 D] - 2*\[CapitalDelta]*
\!\(\*SuperscriptBox[\(\[CapitalDelta]\), \('\)]\)*
ExpIntegralEi[-2 D]))
Getting:Syntax::sntxiMinghui Wang2017-11-20T03:29:49ZEvaluate this integral?
http://community.wolfram.com/groups/-/m/t/1224875
Is there a way to help Mathematica evaluate the following integral?
Integrate[((4*Log[((p1 - p3)^2 + \[Omega]^2)/((p1 + p3)^2 + \[Omega]^2)]*
Log[((p1 - p4)^2 + \[Omega]^2)/((p1 + p4)^2 + \[Omega]^2)])/(p3*p4))*(Sin[p1]/p1),
{p1, 0, Infinity}, Assumptions -> Element[p1 | p3 | p4 | \[Omega], Reals],
Assumptions -> p1 > 0 && p3 > 0 && p4 > 0]
or alternatively
Integrate[Limit[Integrate[((4*Log[(p1 - p3 + \[Omega])/(p1 + p3 + \[Omega])]*
Log[(p1 - p4 + \[Omega])/(p1 + p4 + \[Omega])])/(p3*p4))*(Sin[p1]/p1), {p1, 0, Infinity},
Assumptions -> Element[p1 | p3 | p4, Reals]], \[Omega] -> 0], {p1, 0, Infinity},
Assumptions -> Element[p1 | p3 | p4 | \[Omega], Reals]]Arny Toynbee2017-11-19T23:42:57Z[✓] Implement an external function to a discretionary notebook?
http://community.wolfram.com/groups/-/m/t/1224634
Hey guys,
I've got a function which computes the propagation of uncertainty for a given function. It is called "fehler" and an example would be:
fehler[Sin[2*a], a]
which gives me
2 Sqrt[\[CapitalDelta]a^2 Cos[2 a]^2]
So basically the syntax is fehler[function, variable1, variable2,...]. The whole file is attached to the post, the credit goes to some random guy from my university, unluckily I could not figure out who made this function.
Now I'd like to make this function usable inside every notebook, because right now I always use it externally which is not really nice. So for example if i have a random notebook it should work like this:
(*random notebook*)
fehler= (*this is the code i need*)
a = 1; b=2; const=9;
fehler[a*const+b*2, a, b]
(*the output should like this*) Sqrt[const^2 \[CapitalDelta]a^2 + 4 \[CapitalDelta]b^2]
So that in every notebook I use i can simply use the "fehler"-function to calculate to propagation of uncertainty without having to use it globally. I tried to make this possible for a long time, but the main problem is that the existing fehler-function requires to clear all Variables with ClearAll["Global`*"]; before executing fehler. It is important that the output can be further used as a function, and not is simply a (numerical) result.
Do you guys have an idea how I can solve this problem? It would help me (and other students) a lot, if we could the function inside our notebooks and not externally.
Thanks you and best regards,
TobiasTobias Mitterdorfer2017-11-19T00:27:13ZReplace some terms in an expression by an abbreviation?
http://community.wolfram.com/groups/-/m/t/1224451
I have a symbolic expression (don't ask why, that doesn't matter), say:
exp1 = 2 n (r + h) Sin[\[Pi]/n]
Since I know, that n*Sin[\[Pi]/n] is something special (namely \[Pi] for large n), I want to replace that terms by an abbreviation pn:
pn = n Sin[\[Pi]/n]
and get something like exp2 from exp1 using that abbreviation. I.e.:
exp2 = 2 (r+h) pn
I tried several things like Replace, Reduce, Evaluate and the like, but could get no reasonable result. Does anybody know, how to do that kind of things?Werner Geiger2017-11-18T19:22:14Z[✓] Convert DiscretePlot3D to 2D plot with a Color Function?
http://community.wolfram.com/groups/-/m/t/1224586
Observe the following wolfram Mathematica code:
nd[y_, a_, b_, n_] := (Binomial[b - a + 1, y]*Sum[((-1)^i)*Binomial[y, i]*((y - i)/(b - a + 1))^n, {i, 0, y}]);
Animate[DiscretePlot3D[nd[i, 1, n, j], {j, 1, 15}, {i, 1, 15}, ExtentSize -> Full, ColorFunction -> "DarkRainbow"], {n, 1, 50, 1}]
nd is just the name of a discrete probability density function of 4 variables that I have defined earlier on. What I would really like to do is make this a 2 dimensional grid of squares where the value of nd is shown only by the color as opposed to both the color and the height; in other words, I don't want it to be 3D. Of course, I can rotate what I have to get a top down view, but this isn't exactly ideal:
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/W83BS.png
I would much prefer to eliminate the third dimension altogether and have a simple grid where the output of nd is shown by a change in color of the squares in the 2D grid. Is this possible in Mathematica? If so, how would I do this? Thank you.John Travolski2017-11-19T04:41:20ZDynamical Systems with Applications using Mathematica, 2nd Edition
http://community.wolfram.com/groups/-/m/t/1224393
The book "Dynamical Systems with Applications using Mathematica, 2nd Edition" has been published:
http://www.springer.com/us/book/9783319614847
The notebook (and other files) to accompany the book can be downloaded here:
http://library.wolfram.com/infocenter/Books/9563/
Best wishes
StephenStephen Lynch2017-11-19T08:52:45ZSimplify of -Sqrt[r] >= 0 where r is real
http://community.wolfram.com/groups/-/m/t/1224276
Am I missing something? Assuming r is real, the only r that can satisfy -Sqrt[r]>=0 is zero.
$Assumptions = {r \[Element] Reals};
FullSimplify[-Sqrt[r] >= 0]
yields `Sqrt[r] <= 0`
rather than `r==0`Paul Reiser2017-11-18T18:56:53Z[✓] Simplify powers, (x^n)^(1/n) to x?
http://community.wolfram.com/groups/-/m/t/1224078
Mathematica fails to simplify the following, even with the Assumptions I give it:
In[59]:= FullSimplify[(xe^n)^(1/n),
Assumptions -> {xe \[Element] Reals, n \[Element] integers, n > 0}]
Out[59]= (xe^n)^(1/n)
Does anyone know how to get Mathematica to simplify (x^n)^(1/n) to x?Kenneth Miller2017-11-18T07:01:16ZRandom variables transformation?
http://community.wolfram.com/groups/-/m/t/1224436
Hi,
I am trying to transform a PDF function of x to a PDF function of r using Mathematica, noting that r=x^2 and the PDF of x is as below:
f[x_] := (( (4 Sqrt[π]) (μ^(μ +
0.5)) (h^(μ)) (x^(2 μ)))/((Gamma[μ]) (H^(μ -
0.5)) ((Ω)^(μ +
0.5)))) (E^((-2 (μ) (h) (x^2))/(Ω))) *
BesselI[μ - 0.5, 2 h x^2 μ/Ω]
Anyone can help of how could I do this?
BR,Wisam Abbasi2017-11-18T18:23:34ZThe 27_4 Configuration in Barycentrics
http://community.wolfram.com/groups/-/m/t/1224304
A configuration is a set of points and lines such that $n$ points are on each line and $n$ lines go through each point. Here are a few 4-configurations:
![4-configurations][1]
In [barycentric coordinates](http://community.wolfram.com/groups/-/m/t/947771), both lines and points can be represented as triples. If point $P$ is on line $L$, then the dot product $P.L=0$. For awhile now I've wondered if a self-dual barycentric configuration existed where the point set and line set used the same set of triples. The answer is YES, they exist. Here's a $24_3$ configuration. I've found about 120 of these.
set243 = {{-1, 1, 2}, {-1, 2, 1}, {-1, 2, 3}, {-1, 2, 4}, {-1, 3, 2}, {-1, 4, 2}, {0, 1, 2}, {0, 2, 1}, {1, 2, -1}, {2, 1, -1}, {2, 3, -1}, {2, 4, -1}, {3, 2, -1}, {4, 2, -1}, {1, 2, 0}, {2, 1, 0}, {2, -1, 1}, {1, -1, 2}, {3, -1, 2}, {4, -1, 2}, {2, -1, 3}, {2, -1, 4}, {2, 0, 1}, {1, 0, 2}};
tri=Reverse[{{Sqrt[3]/2,-(1/2)},{0,1},{-(Sqrt[3]/2),-(1/2)}}];
FromBarycentrics[{m_,n_,o_},{{x1_,y1_},{x2_,y2_},{x3_,y3_}}]:={m*x1+n*x2+(1-m-n)*x3,m*y1+n*y2+(1-m-n)*y3};With[{full=Union[Flatten[{#, RotateRight[#,1],RotateLeft[#,1]}&/@{{-1,1,2},{-1,2,1},{-1,2,3},{-1,2,4},{-1,3,2},{-1,4,2},{0,1,2},{0,2,1}},1]]},
Graphics[{EdgeForm[Black],Tooltip[Line[#[[2]]],Style[Row[Switch[Sign[#],-1,Style[ToString[Abs[#]],Red],0,Style[ToString[Abs[#]],Darker[Green]],1,Style[ToString[Abs[#]],Blue]]&/@#[[1]]],16,Bold]]&/@Table[{full[[k]],Sort[FromBarycentrics[#/Total[#],tri]&/@Select[full,full[[k]].#==0&]]},{k,1,Length[full]}],White,{Disk[FromBarycentrics[#/Total[#],tri],.075],Black, Style[Text[Row[Switch[Sign[#],-1,Style[ToString[Abs[#]],Red],0,Style[ToString[Abs[#]],Darker[Green]],1,Style[ToString[Abs[#]],Blue]]&/@#],FromBarycentrics[#/Total[#],tri]],16,Bold]}&/@full}]]
![Config 24_3][2]
I also found a single $27_4$ configuration.
config274={
{-2,-1,4},{-2,1,3},{-1,1,1},{-1,2,0},{-1,2,1},{-1,3,2},{-1,4,2},{0,1,2},{1,1,2},
{-1,4,-2},{1,3,-2},{1,1,-1},{2,0,-1},{2,1,-1},{3,2,-1},{4,2,-1},{1,2,0},{1,2,1},
{4,-2,-1},{3,-2,1},{1,-1,1},{0,-1,2},{1,-1,2},{2,-1,3},{2,-1,4},{2,0,1},{2,1,1}}
With[{full=Union[Flatten[{#, RotateRight[#,1],RotateLeft[#,1]}&/@{{-2,-1,4},{-2,1,3},{-1,1,1},{-1,2,0},{-1,2,1},{-1,3,2},{-1,4,2},{0,1,2},{1,1,2}},1]]},
Graphics[{EdgeForm[Black],Tooltip[Line[#[[2]]],Style[Row[Switch[Sign[#],-1,Style[ToString[Abs[#]],Red],0,Style[ToString[Abs[#]],Darker[Green]],1,Style[ToString[Abs[#]],Blue]]&/@#[[1]]],16,Bold]]&/@Table[{full[[k]],Sort[FromBarycentrics[#/Total[#],tri]&/@Select[full,full[[k]].#==0&]]},{k,1,Length[full]}],White,{Disk[FromBarycentrics[#/Total[#],tri],.07],Black, Style[Text[Row[Switch[Sign[#],-1,Style[ToString[Abs[#]],Red],0,Style[ToString[Abs[#]],Darker[Green]],1,Style[ToString[Abs[#]],Blue]]&/@#],FromBarycentrics[#/Total[#],tri]],7]}&/@full}]]
![27_4][3]
It's easy to check. The following code gives a list of 27 4's.
Length /@ Table[Select[config274, config274[[n]].# == 0 &], {n, 1, 27}]
We can make a graph of these triples.
Graph[#[[1]] <-> #[[2]] & /@ Select[Subsets[Sort[config274], {2}], #[[1]].#[[2]] == 0 &], VertexLabels -> "Name"]
![graph 27_4][4]
Whether there is a 5-configuration with this method is something I'm still running.
[1]: http://community.wolfram.com//c/portal/getImageAttachment?filename=config-4.jpg&userId=21530
[2]: http://community.wolfram.com//c/portal/getImageAttachment?filename=config24_3.jpg&userId=21530
[3]: http://community.wolfram.com//c/portal/getImageAttachment?filename=27_4.jpg&userId=21530
[4]: http://community.wolfram.com//c/portal/getImageAttachment?filename=graph274.jpg&userId=21530Ed Pegg2017-11-18T15:03:30ZSimplify a complicated solution by a simpler way?
http://community.wolfram.com/groups/-/m/t/1176517
eq50 has given a complicated solution, and it should be simplified into the sum of several proper-fraction-alike parts.
I can get a simpler one in eq55, but it takes 5 abstruse steps and isn't the simplest yet.
Can you give a easy and straight way?
In[159]:= eq12 = (cinf \[Theta]c \[Lambda])/(s + \[Theta]c) - (
E^((lh - x) /Sqrt[Dc ] Sqrt[s + \[Theta]c]) F1 Sqrt[
Dc ] \[Lambda])/
Sqrt[ (s + \[Theta]c)] /. {Sqrt[Dc] F1 \[Lambda] -> A1,
cinf \[Theta]c \[Lambda] -> A2}
Out[159]= A2/(s + \[Theta]c) - (
A1 E^(((lh - x) Sqrt[s + \[Theta]c])/Sqrt[Dc]))/Sqrt[s + \[Theta]c]
In[160]:= eq13 = s *q[x, s] - Dp*D[q[x, s], {x, 2}] - pinf + eq12 == 0
Out[160]= -pinf + A2/(s + \[Theta]c) - (
A1 E^(((lh - x) Sqrt[s + \[Theta]c])/Sqrt[Dc]))/Sqrt[
s + \[Theta]c] + s q[x, s] - Dp
\!\(\*SuperscriptBox[\(q\), \*
TagBox[
RowBox[{"(",
RowBox[{"2", ",", "0"}], ")"}],
Derivative],
MultilineFunction->None]\)[x, s] == 0
In[161]:= eq14 = \[Alpha]1*(q[x, s] /. x -> lh) - (D[q[x, s], x] /.
x -> lh) == 0
Out[161]= \[Alpha]1 q[lh, s] -
\!\(\*SuperscriptBox[\(q\), \*
TagBox[
RowBox[{"(",
RowBox[{"1", ",", "0"}], ")"}],
Derivative],
MultilineFunction->None]\)[lh, s] == 0
In[162]:= eq15 = (D[q[x, s], x] /. x -> +\[Infinity]) == 0
Out[162]=
\!\(\*SuperscriptBox[\(q\), \*
TagBox[
RowBox[{"(",
RowBox[{"1", ",", "0"}], ")"}],
Derivative],
MultilineFunction->None]\)[\[Infinity], s] == 0
In[163]:= eq50 =
Assuming[(lh - x) < 0 && s > 0 && (s + \[Theta]c) > 0 && Dp > 0 &&
Dc > 0 && \[Alpha]1 > 0,
DSolve[{eq13, eq14, eq15}, q[x, s], {x, s},
GeneratedParameters -> B4]] // Simplify // Normal
Out[163]= {{q[x,
s] -> (E^(-(Sqrt[s]/Sqrt[Dp] + Sqrt[s/
Dp]) x) (-A2 (-Dc s +
Dp (s + \[Theta]c)) (-4 E^(Sqrt[s/Dp] (lh + x)) Sqrt[Dp/s]
s Sqrt[s/Dp] Sqrt[s + \[Theta]c] Sqrt[
Dp s (s + \[Theta]c)] -
Dp (E^((2 Sqrt[s] x)/Sqrt[Dp])
s (Sqrt[s/Dp] + \[Alpha]1) (s + \[Theta]c) +
E^(2 Sqrt[s/Dp] x)
s (Sqrt[s/Dp] + \[Alpha]1) (s + \[Theta]c) -
2 E^(Sqrt[s/Dp] (lh + x)) Sqrt[s/
Dp] (2 s^2 +
2 s \[Theta]c + \[Alpha]1 Sqrt[s + \[Theta]c] Sqrt[
Dp s (s + \[Theta]c)]))) +
Sqrt[s/
Dp] (1/(Sqrt[s/Dp] Sqrt[s + \[Theta]c])
Dp pinf (-2 E^(Sqrt[s/Dp] (lh + x)) Sqrt[s/
Dp] (Sqrt[Dp/s] s^4 Sqrt[Dp s (s + \[Theta]c)] +
5 Sqrt[Dp/s] s^3 \[Theta]c Sqrt[
Dp s (s + \[Theta]c)] +
6 Sqrt[Dp/s] s^2 \[Theta]c^2 Sqrt[
Dp s (s + \[Theta]c)] +
2 Sqrt[Dp/s] s \[Theta]c^3 Sqrt[
Dp s (s + \[Theta]c)] +
Sqrt[Dp/s] s^(5/2) Sqrt[s + \[Theta]c] Sqrt[
s (s + \[Theta]c)] Sqrt[Dp s (s + \[Theta]c)] -
s \[Alpha]1 Sqrt[
Dp^3 s^5 (s + \[Theta]c)] - \[Alpha]1 \[Theta]c \
Sqrt[Dp^3 s^5 (s + \[Theta]c)]) -
Dp (s + \[Theta]c) (E^((2 Sqrt[s] x)/Sqrt[Dp])
s (Sqrt[s/Dp] + \[Alpha]1) (s + \[Theta]c)^(5/2) +
E^(2 Sqrt[s/Dp] x)
s (Sqrt[s/Dp] + \[Alpha]1) (s + \[Theta]c)^(5/2) -
2 E^(Sqrt[s/Dp] (lh + x)) Sqrt[s/
Dp] (2 s^3 Sqrt[s + \[Theta]c] +
4 s^2 \[Theta]c Sqrt[
s + \[Theta]c] + \[Alpha]1 \[Theta]c^2 Sqrt[
Dp s (s + \[Theta]c)] +
2 s \[Theta]c (\[Theta]c Sqrt[
s + \[Theta]c] + \[Alpha]1 Sqrt[
Dp s (s + \[Theta]c)])))) +
1/(Sqrt[Dp s])
Dc (2 E^(Sqrt[s/Dp] (lh + x)) Sqrt[Dp/s] s Sqrt[Dp s]
Sqrt[Dp s (s + \[Theta]c)] (pinf s (s Sqrt[
s + \[Theta]c] + 2 \[Theta]c Sqrt[s + \[Theta]c] +
Sqrt[s] Sqrt[s (s + \[Theta]c)]) -
A1 (s + \[Theta]c) (-2 s + Sqrt[(
Dp s (s + \[Theta]c))/Dc])) +
Dp^2 s (-2 A1 E^(Sqrt[s/Dp] (lh + x))
s \[Alpha]1 \[Theta]c Sqrt[s + \[Theta]c] +
E^((2 Sqrt[s] x)/Sqrt[Dp]) pinf Sqrt[s/Dp] Sqrt[
Dp s] \[Alpha]1 (s + \[Theta]c)^2 +
E^(2 Sqrt[s/Dp] x) pinf Sqrt[s/Dp] Sqrt[
Dp s] \[Alpha]1 (s + \[Theta]c)^2 -
A1 E^((2 Sqrt[s] x)/Sqrt[
Dp] + (lh - x) Sqrt[(s + \[Theta]c)/
Dc]) (s + \[Theta]c) Sqrt[
Dp s (s + \[Theta]c)] (Sqrt[s/Dp] Sqrt[(
s + \[Theta]c)/
Dc] + \[Alpha]1 (-Sqrt[(s/Dp)] + Sqrt[(
s + \[Theta]c)/Dc])) +
A1 E^(2 Sqrt[s/Dp] x + (lh - x) Sqrt[(s + \[Theta]c)/
Dc]) (s + \[Theta]c) Sqrt[
Dp s (s + \[Theta]c)] (Sqrt[s/Dp] Sqrt[(
s + \[Theta]c)/
Dc] + \[Alpha]1 (Sqrt[s/Dp] + Sqrt[(
s + \[Theta]c)/Dc]))) +
Dp (E^((2 Sqrt[s] x)/Sqrt[Dp]) pinf s^2 Sqrt[
Dp s] (s + \[Theta]c)^2 +
E^(2 Sqrt[s/Dp] x) pinf s^2 Sqrt[
Dp s] (s + \[Theta]c)^2 + (
A1 E^((2 Sqrt[s] x)/Sqrt[
Dp] + (lh - x) Sqrt[(s + \[Theta]c)/Dc])
s (Dp s (s + \[Theta]c))^(3/2))/Dp + (
A1 E^(2 Sqrt[s/Dp] x + (lh - x) Sqrt[(s + \[Theta]c)/
Dc]) s (Dp s (s + \[Theta]c))^(3/2))/Dp -
2 E^(Sqrt[s/
Dp] (lh +
x)) (A1 (Sqrt[Dp s] Sqrt[Dp s^5] \[Alpha]1 Sqrt[
s + \[Theta]c] + (
2 s (Dp s (s + \[Theta]c))^(3/2))/Dp) +
pinf Sqrt[
Dp s] (2 s^4 + 4 s^3 \[Theta]c +
2 s^2 \[Theta]c^2 +
s \[Alpha]1 \[Theta]c Sqrt[s + \[Theta]c] Sqrt[
Dp s (s + \[Theta]c)] + \[Alpha]1 Sqrt[
s + \[Theta]c] Sqrt[
Dp s^5 (s + \[Theta]c)])))))))/(2 Dc Dp^3 (s/Dp)^(
3/2) (Sqrt[s/Dp] + \[Alpha]1) (s + \[Theta]c)^(3/2) Sqrt[
Dp s (s + \[Theta]c)] (Sqrt[s/Dp] - Sqrt[(s + \[Theta]c)/
Dc]) (Sqrt[s/Dp] + Sqrt[(s + \[Theta]c)/Dc]))}}
In[164]:= eq51 =
Assuming[(lh - x) < 0 && s > 0 && (s + \[Theta]c) > 0 && Dp > 0 &&
Dc > 0 && \[Alpha]1 > 0, FullSimplify[q[x, s] /. eq50[[1, 1]]]]
Out[164]= -(E^(-2 Sqrt[s/Dp]
x) (2 A2 s (-Dp E^(Sqrt[s/Dp] (lh + x)) \[Alpha]1 +
E^(2 Sqrt[s/Dp]
x) (Sqrt[Dp s] + Dp \[Alpha]1)) (s + \[Theta]c) (-Dc s +
Dp (s + \[Theta]c)) +
Sqrt[s/Dp] (-1/(Sqrt[(s (s + \[Theta]c))/Dp])2 Dp E^(
Sqrt[s/Dp] x)
pinf (-Dp (E^(lh Sqrt[s/Dp]) - E^(
Sqrt[s/Dp] x)) s \[Alpha]1 (s + \[Theta]c)^(7/2) +
E^(Sqrt[s/Dp]
x) (\[Theta]c^3 Sqrt[Dp s^3 (s + \[Theta]c)] +
3 \[Theta]c^2 Sqrt[Dp s^5 (s + \[Theta]c)] +
3 \[Theta]c Sqrt[Dp s^7 (s + \[Theta]c)] + Sqrt[
Dp s^9 (s + \[Theta]c)])) +
2 Sqrt[Dc]
Dp s (s + \[Theta]c) (pinf (Sqrt[Dc] E^(2 Sqrt[s/Dp] x)
s + (E^(2 Sqrt[s/Dp] x) - E^(
Sqrt[s/Dp] (lh + x))) Sqrt[
Dc Dp s] \[Alpha]1) (s + \[Theta]c) +
A1 (-Sqrt[Dp] E^(Sqrt[s/Dp] (lh + x)) s^(3/2) -
E^(Sqrt[s/
Dp] (lh + x)) (Sqrt[Dp s] \[Theta]c + \[Alpha]1 Sqrt[
Dc Dp s (s + \[Theta]c)]) +
E^(2 Sqrt[s/Dp] x + (lh - x) Sqrt[(s + \[Theta]c)/
Dc]) (s Sqrt[Dc (s + \[Theta]c)] + \[Alpha]1 Sqrt[
Dc Dp s (s + \[Theta]c)]))))))/(2 Dp s^2 (Sqrt[s/
Dp] + \[Alpha]1) (s + \[Theta]c)^2 (-Dc s + Dp (s + \[Theta]c)))
In[165]:= eq52 =
ExpandAll[eq51,
x] /. {(Sqrt[s/Dp] + \[Alpha]1) -> ((
Sqrt[s] + Sqrt[ Dp ] \[Alpha]1)/Sqrt[ Dp ]),
Sqrt[s/Dp] -> Sqrt[s]/Sqrt[ Dp ]} // Normal
Out[165]= (
A2 Sqrt[Dp]
E^((lh Sqrt[s])/Sqrt[Dp] - (Sqrt[s] x)/Sqrt[Dp]) \[Alpha]1)/(
s (Sqrt[s] + Sqrt[Dp] \[Alpha]1) (s + \[Theta]c)) - (
A2 (Sqrt[Dp s] + Dp \[Alpha]1))/(
Sqrt[Dp] s (Sqrt[s] + Sqrt[Dp] \[Alpha]1) (s + \[Theta]c)) - (
Dc pinf Sqrt[
s])/((Sqrt[s] + Sqrt[Dp] \[Alpha]1) (-Dc s +
Dp (s + \[Theta]c))) - (Sqrt[Dc] pinf Sqrt[Dc Dp s] \[Alpha]1)/(
Sqrt[s] (Sqrt[s] + Sqrt[Dp] \[Alpha]1) (-Dc s +
Dp (s + \[Theta]c))) + (
Sqrt[Dc] E^((lh Sqrt[s])/Sqrt[Dp] - (Sqrt[s] x)/Sqrt[Dp]) pinf Sqrt[
Dc Dp s] \[Alpha]1)/(
Sqrt[s] (Sqrt[s] + Sqrt[Dp] \[Alpha]1) (-Dc s +
Dp (s + \[Theta]c))) + (
A1 Sqrt[Dc] Sqrt[Dp]
E^((lh Sqrt[s])/Sqrt[Dp] - (Sqrt[s] x)/Sqrt[
Dp]) s)/((Sqrt[s] + Sqrt[Dp] \[Alpha]1) (s + \[Theta]c) (-Dc s +
Dp (s + \[Theta]c))) + (Dp pinf \[Alpha]1 (s + \[Theta]c)^(3/2))/(
Sqrt[s] (Sqrt[s] + Sqrt[Dp] \[Alpha]1) Sqrt[(s (s + \[Theta]c))/
Dp] (-Dc s + Dp (s + \[Theta]c))) - (
Dp E^((lh Sqrt[s])/Sqrt[Dp] - (Sqrt[s] x)/Sqrt[Dp])
pinf \[Alpha]1 (s + \[Theta]c)^(3/2))/(
Sqrt[s] (Sqrt[s] + Sqrt[Dp] \[Alpha]1) Sqrt[(s (s + \[Theta]c))/
Dp] (-Dc s + Dp (s + \[Theta]c))) + (
A1 Sqrt[Dc]
E^((lh Sqrt[s])/Sqrt[Dp] - (Sqrt[s] x)/Sqrt[
Dp]) (Sqrt[Dp s] \[Theta]c + \[Alpha]1 Sqrt[
Dc Dp s (s + \[Theta]c)]))/(
Sqrt[s] (Sqrt[s] + Sqrt[Dp] \[Alpha]1) (s + \[Theta]c) (-Dc s +
Dp (s + \[Theta]c))) - (
A1 Sqrt[Dc] E^(
lh Sqrt[(s + \[Theta]c)/Dc] -
x Sqrt[(s + \[Theta]c)/
Dc]) (s Sqrt[Dc (s + \[Theta]c)] + \[Alpha]1 Sqrt[
Dc Dp s (s + \[Theta]c)]))/(
Sqrt[s] (Sqrt[s] + Sqrt[Dp] \[Alpha]1) (s + \[Theta]c) (-Dc s +
Dp (s + \[Theta]c))) + (
pinf (\[Theta]c^3 Sqrt[Dp s^3 (s + \[Theta]c)] +
3 \[Theta]c^2 Sqrt[Dp s^5 (s + \[Theta]c)] +
3 \[Theta]c Sqrt[Dp s^7 (s + \[Theta]c)] + Sqrt[
Dp s^9 (s + \[Theta]c)]))/(
s^(3/2) (Sqrt[s] + Sqrt[Dp] \[Alpha]1) (s + \[Theta]c)^2 Sqrt[(
s (s + \[Theta]c))/Dp] (-Dc s + Dp (s + \[Theta]c)))
In[166]:= eq53 = Map[FullSimplify, eq52]
Out[166]= (A2 Sqrt[Dp] E^((Sqrt[s] (lh - x))/Sqrt[Dp]) \[Alpha]1)/(
s (Sqrt[s] + Sqrt[Dp] \[Alpha]1) (s + \[Theta]c)) - (
A2 (Sqrt[Dp s] + Dp \[Alpha]1))/(
Sqrt[Dp] s (Sqrt[s] + Sqrt[Dp] \[Alpha]1) (s + \[Theta]c)) - (
Dc pinf Sqrt[
s])/((Sqrt[s] + Sqrt[Dp] \[Alpha]1) (-Dc s +
Dp (s + \[Theta]c))) - (Sqrt[Dc] pinf Sqrt[Dc Dp s] \[Alpha]1)/(
Sqrt[s] (Sqrt[s] + Sqrt[Dp] \[Alpha]1) (-Dc s +
Dp (s + \[Theta]c))) + (
Sqrt[Dc] E^((Sqrt[s] (lh - x))/Sqrt[Dp]) pinf Sqrt[
Dc Dp s] \[Alpha]1)/(
Sqrt[s] (Sqrt[s] + Sqrt[Dp] \[Alpha]1) (-Dc s +
Dp (s + \[Theta]c))) + (
A1 Sqrt[Dc] Sqrt[Dp] E^((Sqrt[s] (lh - x))/Sqrt[
Dp]) s)/((Sqrt[s] + Sqrt[Dp] \[Alpha]1) (s + \[Theta]c) (-Dc s +
Dp (s + \[Theta]c))) + (
pinf Sqrt[s] \[Alpha]1 (s + \[Theta]c)^(
5/2))/((Sqrt[s] + Sqrt[Dp] \[Alpha]1) ((s (s + \[Theta]c))/Dp)^(
3/2) (-Dc s + Dp (s + \[Theta]c))) - (
E^((Sqrt[s] (lh - x))/Sqrt[Dp]) pinf Sqrt[
s] \[Alpha]1 (s + \[Theta]c)^(
5/2))/((Sqrt[s] + Sqrt[Dp] \[Alpha]1) ((s (s + \[Theta]c))/Dp)^(
3/2) (-Dc s + Dp (s + \[Theta]c))) + (
A1 Sqrt[Dc] E^((Sqrt[s] (lh - x))/Sqrt[
Dp]) (Sqrt[Dp s] \[Theta]c + \[Alpha]1 Sqrt[
Dc Dp s (s + \[Theta]c)]))/(
Sqrt[s] (Sqrt[s] + Sqrt[Dp] \[Alpha]1) (s + \[Theta]c) (-Dc s +
Dp (s + \[Theta]c))) - (
A1 Sqrt[Dc]
E^((lh - x) Sqrt[(s + \[Theta]c)/
Dc]) (s Sqrt[Dc (s + \[Theta]c)] + \[Alpha]1 Sqrt[
Dc Dp s (s + \[Theta]c)]))/(
Sqrt[s] (Sqrt[s] + Sqrt[Dp] \[Alpha]1) (s + \[Theta]c) (-Dc s +
Dp (s + \[Theta]c))) + (
pinf (\[Theta]c^3 Sqrt[Dp s^3 (s + \[Theta]c)] +
3 \[Theta]c^2 Sqrt[Dp s^5 (s + \[Theta]c)] +
3 \[Theta]c Sqrt[Dp s^7 (s + \[Theta]c)] + Sqrt[
Dp s^9 (s + \[Theta]c)]))/(
s^(3/2) (Sqrt[s] + Sqrt[Dp] \[Alpha]1) (s + \[Theta]c)^2 Sqrt[(
s (s + \[Theta]c))/Dp] (-Dc s + Dp (s + \[Theta]c)))
In[167]:= eq54 =
Collect[eq52, { E^((lh Sqrt[s])/Sqrt[Dp] - (Sqrt[s] x)/Sqrt[Dp]), E^(
lh Sqrt[(s + \[Theta]c)/Dc] - x Sqrt[(s + \[Theta]c)/Dc])},
Simplify]
Out[167]= -((
A1 Sqrt[Dc] E^(
lh Sqrt[(s + \[Theta]c)/Dc] -
x Sqrt[(s + \[Theta]c)/
Dc]) (s Sqrt[Dc (s + \[Theta]c)] + \[Alpha]1 Sqrt[
Dc Dp s (s + \[Theta]c)]))/(
Sqrt[s] (Sqrt[s] + Sqrt[Dp] \[Alpha]1) (s + \[Theta]c) (-Dc s +
Dp (s + \[Theta]c)))) + (E^((lh Sqrt[s])/Sqrt[Dp] - (Sqrt[s] x)/
Sqrt[Dp]) (A1 Sqrt[Dc]
s (Sqrt[Dp] s^(3/2) +
Sqrt[Dp s] \[Theta]c + \[Alpha]1 Sqrt[
Dc Dp s (s + \[Theta]c)]) + \[Alpha]1 (A2 Sqrt[Dp] Sqrt[
s] (-Dc s + Dp (s + \[Theta]c)) +
pinf (s + \[Theta]c) (Sqrt[Dc] s Sqrt[Dc Dp s] -
Dp^2 Sqrt[s + \[Theta]c] Sqrt[(s (s + \[Theta]c))/
Dp]))))/(s^(
3/2) (Sqrt[s] + Sqrt[Dp] \[Alpha]1) (s + \[Theta]c) (-Dc s +
Dp (s + \[Theta]c))) + (-Sqrt[Dc] Sqrt[Dp] pinf s^2 Sqrt[
Dc Dp s] \[Alpha]1 (s + \[Theta]c)^3 +
Dc s^(5/2) (s + \[Theta]c)^2 (A2 Sqrt[Dp s] + A2 Dp \[Alpha]1 -
Sqrt[Dp] pinf Sqrt[s] (s + \[Theta]c)) +
1/(Sqrt[s + \[Theta]c])
Dp (-A2 s^(3/2) (Sqrt[Dp s] + Dp \[Alpha]1) (s + \[Theta]c)^(
7/2) + Sqrt[Dp] pinf Sqrt[(s (s + \[Theta]c))/
Dp] (Dp s \[Alpha]1 (s + \[Theta]c)^4 +
Sqrt[s + \[Theta]c] (\[Theta]c^3 Sqrt[
Dp s^3 (s + \[Theta]c)] +
3 \[Theta]c^2 Sqrt[Dp s^5 (s + \[Theta]c)] +
3 \[Theta]c Sqrt[Dp s^7 (s + \[Theta]c)] + Sqrt[
Dp s^9 (s + \[Theta]c)]))))/(Sqrt[Dp] s^(
5/2) (Sqrt[s] + Sqrt[Dp] \[Alpha]1) (s + \[Theta]c)^3 (-Dc s +
Dp (s + \[Theta]c)))
In[168]:= eq55 =
Assuming[s > 0 && (s + \[Theta]c) > 0 && Dp > 0 && Dc > 0,
FullSimplify[eq54[[1]]] + FullSimplify[eq54[[2]]] +
FullSimplify[eq54[[3]]]] // Normal
Out[168]= (-A2 + pinf (s + \[Theta]c))/(s (s + \[Theta]c)) - (
A1 E^((lh - x) Sqrt[(s + \[Theta]c)/Dc]) Sqrt[Dc/
s] (s Sqrt[Dc (s + \[Theta]c)] + \[Alpha]1 Sqrt[
Dc Dp s (s + \[Theta]c)]))/((Sqrt[s] +
Sqrt[Dp] \[Alpha]1) (s + \[Theta]c) (-Dc s +
Dp (s + \[Theta]c))) + (E^((s (lh - x))/Sqrt[
Dp s]) (-Sqrt[
Dp s] \[Alpha]1 (-Zhonghui Ou2017-09-04T09:25:34Z