WassimTenachi/PhySO

Why doesn't it work like the video?

heimawsw opened this issue · 5 comments

I successfully ran the program unit test, but could not achieve the dynamic effect in the video.
How is the effect achieved in the video?

demo_light.mp4

image

Is there a python program that needs to be run?

Hi @heimawsw,

PhySO is a symbolic regression package aiming at discovering physical laws from datasets.
The screenshot that you sent is the output of the units tests, not a proper symbolic regression task on a dataset.

You should run the damped harmonic oscillator notebook, it will output a live monitoring plot + a log that will contain an even more informative record of what's going on during the symbolic regression task than the video did.

image

image

Hi Wassim

I now have the demo_damped_harmonic_oscillator.py code running properly, but only the graphics panel doesn't display the formulas in the demo video properly.

May I ask how to display the graphics and corresponding formulas in the video?

thanks

image

I see it in the log

sin(((phi+((((((((t*f))(2)))(-1)))**(2))-exp(-(phi))))+phi))

This expression, can this expression be converted into a formula? In what way?

Hi @heimawsw,

To convert an expression in the log into a more good looking latex expression, you can use this snippet:


import sympy
import matplotlib.pyplot as plt

expr_str = "(sin(((f*t)+phi))*exp((alpha*-(t))))+1-1"

# Getting a sympy expression
expr_sympy = sympy.parsing.sympy_parser.parse_expr(expr_str, evaluate=False)

# If you want the simplified version
expr_sympy = sympy.simplify(expr_sympy, rational=True)

# Getting a latex expression
expr_latex = sympy.latex (expr_sympy)

# Getting a figure containing expression
#plt.rc('text', usetex=True)
#plt.rc('font', family='serif')
#plt.rc('text.latex', preamble=r'\usepackage{amssymb} \usepackage{xcolor}')
fig, ax = plt.subplots(1, 1, figsize=(10, 2))
ax.axis('off')
text_pos = (0.0, 0.5)
ax.text(text_pos[0], text_pos[1], f'${expr_latex}$', size = 16)

plt.show()

That's what I used to make the demo video !

Thank you very much for the ideas provided by the author, I am now successfully running python as expected. In the future, I will learn how to optimize machine learning time. Currently, data processing is very slow.