Mathematical expression

Hello everyone,

I’m struggling by trying to show mathematical expression on bubble (by using ChatGPT API). ChatGpt is always replying with expressions like this (x^2 - 4x + 2 = 0) and I don’t know how to switch it in a “good” display. Can someone help me?

I’m quite new on bubble then, do not hesitate to give enough explanation…

Thanks a lot!!

Do you want to display as a text ONLY or do you need to make this calculation inside bubble?

As a Text only.
If I have a square root like the expression here: (x = \sqrt{2} + 2), I want to be able to show it (as a text).

You can use this plugin to show math expressions in latex: LaTeX, MathML or equation to text Plugin | Bubble

See the demo below:
image

If chatgpt doesn’t give latex format, you can change your prompt and ask latex format to make sure.

Here is the editor if you want to check details: Tests for Forum 11 | Bubble Editor

Thank you for your reply.
I’m improving my apps. Now I need to figure out when I’m receiving a math expression and a text. The reply is like this (raw text and with the plug-in)

Any proposal?
Thank you again for the help

That plugin doesn’t do a good job for this. Probably, you have to ask the formulas and the explanation separately from chatgpt and design it in your page yourself.

I saw that maybe by using “Katex” (Browser · KaTeX) but I’m really not familiar about how I can add a script in my page…

Maybe check mathjax. I put an example HTML element to the same page I posted as example:
image

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>MathJax example</title>
  <script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
  <script id="MathJax-script" async
          src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js">
  </script>
</head>
<body>
<p>
  When \(a \ne 0\), there are two solutions to \(ax^2 + bx + c = 0\) and they are
  \[x = {-b \pm \sqrt{b^2-4ac} \over 2a}.\]
</p>
</body>
</html>

Thank you Hergin,

I still have the same issue but I don’t know why… Is it because I’m using a dynamic data? Below, what I did and what I have:


image

Maybe I don’t have the right “format” ?

Thank you :slight_smile:

I don’t have an answer for that. Maybe try waiting to render by checking the box or display as iframe.

Also, try to put the text by hand, manually rather than dynamic to make sure dynamic text is or is not the problem.

It works by checking the iframe box! Thank you Hergin!

This topic was automatically closed after 70 days. New replies are no longer allowed.