0
$\begingroup$

I have two equations SvA[zm, zs, zh]==0 and tzmzs[zm, zs, zh, tb, b]==0. I will plot these two equations and find their intersection point given the range for zm and zs for some zh.

d = 3;
ag = 10;
pg = 10;
wp = 20;
f[z_, zh_] := 1 - (z/zh)^(d + 1);
tinteg[z_, zm_, zh_] := -1/(f[z, zh] Sqrt[1 - (zm^(2 d) f[z, zh])/(z^(2 d) f[zm, zh])])
SvA1[z_?NumericQ, zm_?NumericQ, zh_?NumericQ] := zm^d/(4 z^d Sqrt[zm^(2 d) f[z, zh] - z^(2 d) f[zm, zh]])
SvA2[z_?NumericQ, zm_?NumericQ, zs_?NumericQ, zh_?NumericQ] := (z^d (zs^(2 d) f[zm, zh] - zm^(2 d) f[z, zh]))/(4 Sqrt[zm^(2 d) f[z, zh] - z^(2 d) f[zm, zh]] Sqrt[f[z, zh] (zs^(2 d) - z^(2 d) )] (zm^d Sqrt[f[z, zh] (zs^(2 d) - z^(2 d) )] + zs^d Sqrt[zm^(2 d) f[z, zh] - z^(2 d) f[zm, zh]]))
SvA[zm_?NumericQ, zs_?NumericQ, zh_?NumericQ] := Module[{zmr, zsr, zhr}, {zmr, zsr, zhr} = Rationalize[{zm, zs, zh}, 0]; NIntegrate[SvA1[z, zmr, zhr], {z, zsr, zmr}, AccuracyGoal -> ag, PrecisionGoal -> pg, WorkingPrecision -> wp] + NIntegrate[SvA2[z, zmr, zsr, zhr], {z, 0, zsr}, AccuracyGoal -> ag, PrecisionGoal -> pg, WorkingPrecision -> wp]]
tzm[z_?NumericQ, zm_?NumericQ, zh_?NumericQ] := -1/(f[z, zh] Sqrt[1 - (zm^(2 d) f[z, zh])/(z^(2 d) f[zm, zh])])
tzs[z_?NumericQ, zs_?NumericQ, zh_?NumericQ] := z^d/Sqrt[f[z, zh] (zs^(2 d) - z^(2 d) )]
tzmzs[zm_?NumericQ, zs_?NumericQ, zh_?NumericQ, tb_?NumericQ, b_?NumericQ] := Module[{zmr, zsr, zhr, tbr, br}, {zmr, zsr, zhr, tbr, br} = Rationalize[{zm, zs, zh, tb, b}, 0]; NIntegrate[tzm[z, zmr, zhr], {z, 0, zhr, zmr}, Method -> PrincipalValue, AccuracyGoal -> ag, PrecisionGoal -> pg, WorkingPrecision -> wp] - NIntegrate[tzs[z, zsr, zhr], {z, 0, zsr}, AccuracyGoal -> ag, PrecisionGoal -> pg, WorkingPrecision -> wp] - br - tbr]

plots05 = {ContourPlot[{SvA[zm, zs, 0.5] == 0}, {zm, 1.3 0.5, 1.3139227026 0.5}, {zs, 0.992 0.5, 0.9976582043 0.5}, ContourStyle -> Blue], ContourPlot[{tzmzs[zm, zs, 0.5, 0.10000707106781259047, 0.1] == 0}, {zm, 1.3 0.5, 1.3139227026 0.5}, {zs, 0.992 0.5, 0.9976582043 0.5}, ContourStyle -> Red]};
Show[plots05]

plots04 = {ContourPlot[{SvA[zm, zs, 0.4] == 0}, {zm, 1.3 0.4, 1.3143183886 0.4}, {zs, 0.995 0.4, 0.9980176691 0.4}, ContourStyle -> Blue], ContourPlot[{tzmzs[zm, zs, 0.4, 0.10000632455532150657, 0.1] == 0}, {zm, 1.3 0.4, 1.3143183886 0.4}, {zs, 0.995 0.4, 0.9980176691 0.4}, ContourStyle -> Red]};
Show[plots04]

Table[ContourPlot[{SvA[c1 zh, c2 zh, zh] == 0, tzmzs[c1 zh, c2 zh, zh, 0.10000707095118766, 0.1] == 0}, {c1, 1.3139227026, 1.3143183886}, {c2, 0.9976582043, 0.9980176691}, ContourStyle -> {Blue, Red}], {zh, {0.4, 0.41, 0.42, 0.43, 0.44, 0.45, 0.46, 0.47, 0.48, 0.49, 0.5}}]

Now, the range of zm and zs will be

[zm, some # enough to see the intersection point, c1 zh]

[zs, some # enough to see the intersection point, c2 zh]

An example is,

[zm, 1.3 0.5, 1.3139227026 0.5]

[zs, 0.992 0.5, 0.9976582043 0.5]

where c1 = 1.3139227026 and c2 = 0.9976582043 are the corresponding upper bounds of zm and zs.

For zh=0.5 (left side) there is an intersection, for zh=0.4 there is no intersection.

Image0405

Note that the upper bounds (c1, c2) for different zh are different. This tells me that there exist an upper bound (c1, c2) for a given zh where the intersection point is exactly at this upper bound (c1, c2). From the images above it tells me that this should occur at a zh between [0.4, 0.5]

To put it differently, I'm searching for the set (c1, c2) where beyond those values the two equations will fail to have a solution, meaning no intersection point as in the case of zh=0.4.

The upper bounds for zh=0.4 is (1.3143183886, 0.9980176691), for zh=0.5 is (1.3139227026, 0.9976582043). So this tells me that the upper bounds (c1, c2) that I'm searching should lie in the ranges,

[c1, 1.3139227026, 1.3143183886]

[c2, 0.9976582043, 0.9980176691]

[zh, 0.4, 0.5]

To make it even clearer, the behavior of the intersection point will move up to the upper right corner of the plot as zh varies from 0.5 to 0.4. Although for the case of zh = 0.4 the intersection point already "went out of the plot", i.e. no intersection point. A zoomed in version of the plot for the range [zh,0.4,0.41,0.42,0.43,0.44,0.45,0.46,0.47,0.48,0.49,0.5] is as shown,

Table

The upper left image is zh=0.4 and the lowest right image is zh=0.5. You cannot see the intersection for this zh=0.5 because it is zoomed in using the ranges that I said I know the solution must lie within. So, you need to look from the last image going to the first image, you will see that the intersection point gradually goes up to the upper right corner. Specifically, the intersection point for zh=0.43 is closer to the upper right corner compared to zh=0.44, but for zh=0.42 their is already no intersection point.

So the possible solution can be seen through plots, but is there any way to compute the approximate zh where the intersection point reaches the upper right corner (where the equations fail to give a solution)?

Attempt

NMinimize[{zh, SvA[c1 zh, c2 zh, zh] == 0, tzmzs[c1 zh, c2 zh, zh, 10000707095118766/10^17, 1/10] == 0, 13139227026/10^10 < c1 < 13143183886/10^10, 9976582043/10^10 < c2 < 9980176691/10^10, 40/100 < zh < 50/100}, {c1, c2, zh}, AccuracyGoal -> ag, PrecisionGoal -> pg, WorkingPrecision -> wp]

NMinimize::nosat: Obtained solution does not satisfy the following constraints within Tolerance -> 0.001`: {-tzmzs[c1 zh,c2 zh,zh,5000353547559383/50000000000000000,1/10]==0}.

{0.42461675303602813219, {c1 -> 1.3143183886000000000, c2 -> 0.99801766910000000000, zh -> 0.42461675303602813219}}

The value zh = 0.4246167 seems to make sense since in the plot above, there is an intersection point for zh=0.43 but no intersection for zh=0.42 (at least in the plot but I'm not sure if you really calculate with the corresponding precision and accuracy set). I'm not sure if what I did here is really accurate, any help to find the accurate result? I think I just need to know which Method to use in NMinimize to get the most accurate result.

Update: I have modified the post to make the question clearer and credits to @UlrichNeumann for the conversation that made the problem clearer to me.

$\endgroup$
5
  • $\begingroup$ What means "cross the horizontal axis"? $\endgroup$ Aug 13 '21 at 6:52
  • $\begingroup$ @UlrichNeumann It means the intersection of the yellow line and blue line is located at the x-axis. So I'm trying to find the solution of the two equations located at the horizontal axis. $\endgroup$
    – mathemania
    Aug 13 '21 at 6:59
  • $\begingroup$ You're looking for an intesection in 3D-space c1,c2,zh , that's why "cross the horizontal axis" remains unclear $\endgroup$ Aug 13 '21 at 7:17
  • $\begingroup$ @UlrichNeumann Yeah, what you mean is correct, the intersection of c1,c2,zh in 3D space. I'm using a 2D plot to talk about a 3D thing which is confusing, I'll edit my post. $\endgroup$
    – mathemania
    Aug 13 '21 at 7:38
  • $\begingroup$ No it isn't a typo. Instead of zh^2 perhaps minimization of something like zh^2(1+c1+c2)^2 or zh^2/(1+c1+c2)^2 might be what you are looking for. $\endgroup$ Aug 15 '21 at 9:01
1
$\begingroup$

modified

solution idea

For given parameters p1=0.10000707095118766,p2=.1(examplary) you try to solve the equations SvA[c1 zh, c2 zh, zh] == 0, tzmzs[c1 zh, c2 zh, zh, p1, p2] for the unknowns c1,c2,zh !

You know 0.4<zh<.5. ContourPlotshows you the solutions c1[zh],c2[zh]

Table[ContourPlot[{SvA[c1 zh, c2 zh, zh] == 0, 
tzmzs[c1 zh, c2 zh, zh, 0.10000707095118766, 0.1] == 0}
, {c1,1.3125 , 1.3150}, {c2, .9965 , .999}], {zh,{.4, .45, .5}}]

enter image description here

The evaluation takes some time, that's why I took only three values zh=.4,.45,.5

addendum

The updated question clarifies the issue. The questioner probably looks for a special solution in a known parameterrange which maximizes zh:

NMaximize[{zh^2, SvA[c1 zh, c2 zh, zh] ==0,tzmzs[c1 zh, c2 zh,zh,0.10000707095118766, 0.1] == 0
,1.3139 <= c1 <= 1.3144
,0.9976 <= c2 <= .99802
, .4 <= zh <= 0.5}
, {c1, c2, zh}]   
(*{0.249861, {c1 -> 1.3139, c2 -> 0.997738, zh -> 0.499861}}*)  

Mathematica shows a message, which might be ignored. Increasing WorkingPrecision&Co improves this solution.

$\endgroup$
14
  • $\begingroup$ Oh, it took a very long time for me because I used range for zh but in your case you just used three points. However, is there a more general way to find the solution using say NSolve or any other approximation method? $\endgroup$
    – mathemania
    Aug 13 '21 at 13:01
  • $\begingroup$ My approach shows that for every zh you'll find a solution c1[zh], c2[zh] . There is no unique solution, {zh,c1[zh], c2[zh]} form a space curve! $\endgroup$ Aug 13 '21 at 13:03
  • $\begingroup$ Please see my update on the ranges of (c1,c2,zh) in my original post. I used your code using the updated ranges and there are no intersections for zh=.4,.45,.5. Table[ContourPlot[{SvA[c1 zh, c2 zh, zh] == 0, tzmzs[c1 zh, c2 zh, zh, 0.10000707095118766, 0.1] == 0}, {c1, 1.31392, 1.31432}, {c2, 0.997658, 0.998018}], {zh, {0.4, 0.45, 0.5}}] $\endgroup$
    – mathemania
    Aug 13 '21 at 13:14
  • $\begingroup$ That's why I increased the parameter ranges a little bit $\endgroup$ Aug 13 '21 at 13:20
  • $\begingroup$ I have determined that the solution set I am searching must be within [c1, 1.31392, 1.31432] [c2, 0.997658, 0.998018] for [zh,0.4,0.5]. So the range for c1 and c2 cannot be expanded. $\endgroup$
    – mathemania
    Aug 13 '21 at 13:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.