Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Design mathematical expressions

  • delianTTA
  • delianTTA's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 22 hours ago #215090 by delianTTA
Design mathematical expressions was created by delianTTA
Hello, 
i would like to display mathematical expressions on my survey like the one you can see on the image. 
I tried using MathJax only to find out LimeSurvey already has a engine for that "Expression Manager". I already scrolled through the documentation but could not find something useful syntax-wise.
Does anyone know a good documentation on how to do it? Thank you! :)

The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 22 hours ago #215092 by holch
Replied by holch on topic Design mathematical expressions
Expression Manager is not for displaying mathematical formulas, but to create forumlas within Limesurvey. However, it is more for basic formulas to influence the questionnaire, rather than complex mathematical formulas.

I think your best way is to include the formula that you want to show via screenshot/image.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 21 hours ago - 3 years 21 hours ago #215094 by Joffm
Replied by Joffm on topic Design mathematical expressions
Hi,

fortunately I was a bit later than @holch.
As usual I seem to have misunderstood your question. Maybe because of the word "Expression Manager"

But if you really want to calculate:
Here you find the implemented functions
[url] manual.limesurvey.org/ExpressionScript_-...mplemented_functions [/url]

In the first of the sample surveys you find at the end an overview
[url] manual.limesurvey.org/ExpressionScript_sample_surveys [/url]

In Version 4.x there shall be the option to define your own functions. Don't ask me how.

But this one is easy

{(pow(25,sin(89*(2*pi())/360))-pow(5,2))/(pow(10,-2))}

Joffm

 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 3 years 21 hours ago by Joffm.
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 21 hours ago - 3 years 20 hours ago #215097 by Joffm
Replied by Joffm on topic Design mathematical expressions
Hi,
you can include MathJab into Limesurvey.

My first try.
 

But you have to find a workaround regarding curly brackets.
They are used as delimiters in Expression Manager.
So formulas with curly brackets won't work.

Maybe you can customize MathJab accordingly.

Till now I was not successful using the AsciiMath Input.


Not with AsciiMath, but with the curly brackets.

 

Joffm

At the moment it is a rough prototype.
I only included the example into the sourcecode of the question and masked the curly brackets:
Code:
<script>
MathJax = {
  tex: {
    inlineMath: [['$', '$'], ['\\(', '\\)']]
  }
};
</script><script id="MathJax-script" async
  src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js">
</script>

and the question text:
<p>When \(a \ne 0\), there are two solutions to \(ax^2 + bx + c = 0\)</p>

<p>and they are</p>

<p><span style="font-size:22px;">\(x = \{-b \pm \sqrt\{b^2-4ac\} \over 2a\}.\)</span></p>


 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
Last edit: 3 years 20 hours ago by Joffm.
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 3 hours ago #215134 by tpartner
Replied by tpartner on topic Design mathematical expressions
I have used MathJax in more than 50 surveys.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • delianTTA
  • delianTTA's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
3 years 2 hours ago - 3 years 2 hours ago #215137 by delianTTA
Replied by delianTTA on topic Design mathematical expressions
Thanks a lot guys! :)
I managed to get MathJax running by avoiding the curly brackets and it works fine.
Some aspects won't work, like negative exponents or a number with a sin/cos/tan as an exponent
I already did some research and tried a few things out but couldn't figure it out. Does anyone of you have a clue on how to do it? 
Somehow, using a sin as an exponent, it gets calculated automatically, altough I only want to display it like this: 25^sin(90)



 
Last edit: 3 years 2 hours ago by delianTTA.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 2 hours ago - 3 years 2 hours ago #215138 by tpartner
Replied by tpartner on topic Design mathematical expressions
Insert a space after the opening curly brace and before the closing curly brace.

Code:
\(10^{ -2 }\)

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 3 years 2 hours ago by tpartner.
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 2 hours ago #215142 by Joffm
Replied by Joffm on topic Design mathematical expressions

Insert a space after the opening curly brace and before the closing curly brace.


That was my first idea. This is a usual approach.
I wasn't successful - probably because of my bad glasses.
A new try now  - everything is fine.

To be honest: I heard about Mathjab yesterday for the first time in my life,

And:

\(25^{ sin(90) } \)

 

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • delianTTA
  • delianTTA's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 years 11 months ago #215163 by delianTTA
Replied by delianTTA on topic Design mathematical expressions
Thank you, it works! :)
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose