Gravitational potential energy of an isothermal sphere

V

Vinteuil

Guest
Vinteuil Asks: Gravitational potential energy of an isothermal sphere
I am trying to calculate the gravitational potential energy, W, defined as:

$W = -\frac{1}{2}\int\rho(r)\Phi(r)d^{3}r$

for an isothermal sphere. I am given that the density profile varies with r as:

$\rho \propto r^{-2}$

and that $\Phi(r)$ is defined as:

$\Phi(r)=\Phi_{0} + \eta ln(r)$

where $\eta$ is a constant. Given it is a spherical system I set up the following equation.

$W = -\frac{1}{2}\int^{r_{0}}_{0}4\pi k(\Phi_{0} + \eta ln(r))dr$

Where k is a constant of proportionality. I am not sure how to calculate this integral without ending up with infinities due to $ln(0)$ values. I am also told that the sphere can be considered to be truncated at $r_{0}$, does this mean I can somehow ignore the $ln(r)$ term in the integral?

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your thoughts here to help others.

/forums/whats-new/news-feed

Unreplied Posts

main activity (called news activity)

Code:
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.NewsActivity">

<FrameLayout
android:id="@+id/flFragment"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">

<fragment
android:id="@+id/newsNavHostFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:defaultNavHost = "true"

</FrameLayout>

android:layout_width="match_parent"
android:layout_height="56dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>

and mine nav_graph.xml code

Code:
<?xml version="1.0" encoding="utf-8"?>
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/news_nav_graph">
</navigation>

i have tried to restart and cache android studio but it didnt work. and also updated navigation dependencies to latest version..

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your thoughts here to help others.

Cell Loses Focus When Excel VBA installed Button Clicked

kds14589 Asks: Cell Loses Focus When Excel VBA installed Button Clicked
I have a sub-form that focuses its answer on the active cell that was chosen. BUT, once I click on the cell/button to load/show this sub-form, my choice of the ‘active cell’ changes to the button cell and my sub-form rejects the chosen cell. I don’t have this problem if I use an ActiveX button but I’ trying to avoid them on this project. Any recommendations?

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your thoughts here to help others.

Error with subscribe or inserting data between ionic and php/mysql

fernando gonzalez Asks: Error with subscribe or inserting data between ionic and php/mysql
In the file "cargar-obra.page.ts" I have this function:

Code:
btnClickAgregarObra(){
const datosObra = {
num_obra: this.num_obra,
nombre_obra: this.nombre_obra,
dir_obra: this.dir_obra,
muni_obra: this.muni_obra,
costo_obra: this.costo_obra,
fecha_ini_obra: this.fecha_ini_obra,
}
this.configService.cargarObra(datosObra).subscribe(res=>console.log(res));

that last line calls this code on "config.service.ts":

Code:
public cargarObra(obraData){
}

About that las code, I put the "console.log(obraData)" to see if the json brings the data correctly, and it does.

And the code above calls the las file "obras.php":

Code:
$body = file_get_contents("php://input");$body2 = json_decode($body, true);$num_obra = $body2['num_obra'];$nombre_obra = $body2['nombre_obra'];$dir_obra = $body2['dir_obra'];$muni_obra = $body2['muni_obra'];$costo_obra = $body2['costo_obra'];$fecha_ini_obra = $body2['fecha_ini_obra'];$inspector_asignado = $body2['inspector_asignado'];$sql = "INSERT INTO obra(idobra, idusuario, descripcion, direccion, localidad, fechainicio, costo) VALUES ($num_obra,$inspector_asignado,'$nombre_obra','$dir_obra','$muni_obra','$fecha_ini_obra', $costo_obra)";$q = mysqli_query($conn,$sql);
die();

What could be happening? Thanks to all help.

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your thoughts here to help others.

Can I make a VR game with python?

Hextav Asks: Can I make a VR game with python?
I know python isn't a viable option for VR game development, but I hope there's a way to create a 3D game in it.

SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your thoughts here to help others.

Memory leak when creating matplotlib.plots in loops

Husker Asks: Memory leak when creating matplotlib.plots in loops
I know it was discussed not only once. Unfortunately, I do not get further.

first the basic: I am trying to loop through OHLC data and create charts. Unfortunately the memory keeps running full.

Apparently it has something to do with the size of the chart.

Code:
plt.ioff()
fig = plt.figure(figsize=(50, 25))

for line in ohlc_data:

# Make magic with the data
# ...

df = x.get_ohlc_data()
ohlc_area = plt.subplot2grid((6, 3), (0, 0), colspan=3, rowspan=4)
ohlc_area.plot(df[['Date']], df[['close']], 'k-', markevery=markers_on, marker='D',
label='close')
plt.grid(axis='x', color='0.95')
plt.grid(axis='y', color='0.95')
plt.savefig("Diagramme/" + str(x.id) + "_" + x.state + ".png")

# Try to clean up everything
fig.clf()
plt.cla()
plt.clf()
plt.close('all')
gc.collect()

Up to this point it works. Unfortunately fig.clf() also resets the size of the diagram. If I try to resize the diagram within the loop, there is a memory leak and I don't understand why.

Code:
plt.ioff()
fig = plt.figure(figsize=(50, 25))

for line in ohlc_data:

# Make magic with the data
# ...

#plt.figure(figsize=(50, 25))
plt.rcParams["figure.figsize"] = (50, 25)
#fig = plt.figure(figsize=(50, 25))

df = x.get_ohlc_data()
ohlc_area = plt.subplot2grid((6, 3), (0, 0), colspan=3, rowspan=4)
ohlc_area.plot(df[['Date']], df[['close']], 'k-', markevery=markers_on, marker='D',
label='close')
plt.grid(axis='x', color='0.95')
plt.grid(axis='y', color='0.95')
plt.savefig("Diagramme/" + str(x.id) + "_" + x.state + ".png")

# Try to clean up everything
fig.clf()
plt.cla()
plt.clf()
plt.close('all')
gc.collect()

I tried at the beginning of the loop with:

Code:
   #plt.figure(figsize=(50, 25))
plt.rcParams["figure.figsize"] = (50, 25)
#fig = plt.figure(figsize=(50, 25))

Unfortunately it does not work, can someone tell me how I can prevent the memory increase or how this problem comes about?