# Doubt regarding spring block system

M

##### Guest

The first picture shows a spring in natural state attached to a block. The second picture shows that the block has been compressed by $x$ distance. Now,we already know that if we release the block,it will start to perform SHM around the mean point and will only reach the $x$ distance in positive axis as amplitude. But let us try to analyze this:

We use work energy theorem when the block is at the right extreme. Now, since the block is at a compressed state, hence when it will be released,it will have an initial velocity $v$ which will be equal to $\frac{1}{2}kx^2=\frac{1}{2}mv^2$. Now the right extreme,is our final position where our velocity is $0$. So by work energy theorem, net work done on body=kinetic energy done on block or, (work done by spring from $-x$ to $0$+work done by spring from $0$ to $+x$)=change in kinetic energy=$0-\frac{1}{2}mv^2$ or $$\int_{-x}^{0} kx\mathrm{d}x+\int_{0}^{x} -kx \mathrm{d}x=0-\frac{1}{2}mv^2$$.

But the left hand side gives answer $0$,while the right hand side has a term $-\frac{1}{2}mv^2$,which is obviously not $0$ from the relation $\frac{1}{2}mv^2=\frac{1}{2}kx^2$. Could anyone please point out where i made the mistake and provide me with the correct concept?

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?