1
$\begingroup$

I want to make a plot with a condition in such a way that the function A3 is zero at above some value of argument x.

For example, in the following equation, I need A3[9] = 0 and for x > 9. I also want the plot of the function to go to zero at value x = 9. How I can do that?

A3[x_] := 
  10/(2.0816*x) (SphericalBesselJ[1, 2.0816*x/
         10]*(-10/(2*2.0816 x) SphericalBesselJ[1, 2.0816*x/10] + 
        1/2 (SphericalBesselJ[0, 2.08*x/10] - 
             SphericalBesselJ[2, 2.0816*x/10]))*(Sin[Pi/6])^2) +
             (SphericalBesselJ[1, 2.0816*x/10])^2*(Cos[Pi/6])^2/((2.0816*x)/10)^2;

Plot[{A3[x]}, {x, -20, 20}, AxesLabel -> {x, z}]
$\endgroup$
8
  • $\begingroup$ A3[x + 7.36521] will have a first zero for $x$ very close to $9$. I found that value using FindRoot[A3[9 + i] == 0, {i, 7.3}]. $\endgroup$
    – MarcoB
    Commented Jan 13, 2020 at 19:11
  • $\begingroup$ Is A3 the same thing as A? What are we allowed to adjust in your equation for A3 to make A3[9] = 0? If the function A3 is what you've shown here, then its value at 9 is completely defined. $\endgroup$ Commented Jan 13, 2020 at 20:07
  • 1
    $\begingroup$ If you want to just show you plot inside sphere, you can do this like: Plot[A3[x]*Boole[-9<x<9],{x,-20,20}, AxesLabel->{x,z}], or better re-formulate and re-solve your problem so that the solution automatically goes to 0 at the sphere's radius. $\endgroup$
    – Alx
    Commented Jan 14, 2020 at 2:02
  • 1
    $\begingroup$ @physicsu83, is that what you need? Plot[Piecewise[{{A3[x], x < 9}, {0, x >= 9}}], {x, -20, 20}, PlotRange -> All, PlotStyle -> Thick, Exclusions -> None] $\endgroup$
    – garej
    Commented Jan 14, 2020 at 8:25
  • 1
    $\begingroup$ Yes exactly...Thank you very much. $\endgroup$
    – physicsu83
    Commented Jan 14, 2020 at 16:18

0

Browse other questions tagged or ask your own question.