Add a calculation
Create your first calculation
Last updated
Create your first calculation
Last updated
Let's use Python to create a calculation. From the right-hand panel, click on Code :
A Python source will be added to the page. The Python editor slides in from bottom of the view showing this new Python source:
The Python source initially contains guide comments in green color and a line of code. Remove these initial lines:
Click inside the code editor and then press cntrl + a
-> delete
keys
Now type in these two Python lines inside the Python editor:
Notice that two parameters of a
and b
will appear on the right-hand panel, under the Python source, each sowing their current calculated value:
You've just created your first source and parameters! Try changing first line of the Python source from a = 2
to a = 3
and see that parameter b gets recalculated.
You won't need to edit the Python source for inputting different values of parameter a
. By defining math parameters in the document area, you can provide input to Python sources, without opening the source. To learn how read: Parametric equation
The power of parameters are in creating parametric content. Click on the three dot menu of parameter b
on the right-hand panel and select Insert parameter to create a parametric element that represents parameter b
inside the document:
You can add some explanatory text around the parametric element:
We've just created a single-value parametric content that represents the value of parameter b
.
Learn about different types of Parametric content:
Add documentation
Parametric content