Skip to content

Computational Effects

Syst3ms edited this page Jan 5, 2018 · 2 revisions

IMPORTANT : You will need to setup a WolframAlpha ID in order to use these effects to their fullest

What are computational effects ?

Computational effects are effects that compute a value while blocking script execution in the meantime (the script will pause). When they are done computing the value, the script continues running as normal.

The result is stored in the last skuared result expression.

You probably don't need most of the computational effects, as they are really complex operations that you probably don't know the purpose of.

There are 5 of these :

  • Summations/Sigmas :
(sum|sigma) %string% from %number% to (%number%|infinity)

Probably the simplest computational effect. Takes a mathematical expression (which has x in it) and sums all the results for the two bounds (i.e the two %number%s). Doing the following : sum "x" from 1 to 10 equates to doing :

set {_res} to 0
loop (10 - 1 times): # seems redundant, but it's about how the effect works since you don't know the bounds.
    add (eval expr "x" with loop-number) to {_res}

If the upper bound (the second number) is inferior or equal to 65535 (the maximum value of a short, if you want to know why), then skript-math will actually compute the summation itself, like shown above. You can also sum an expression to infinity. Even though it sounds like this will always end up with infinity as a result, some famous constants can be calculated that way (most notably pi and e). If the upper bound is superior to 65535 or is infinity, then WolframAlpha will be used to compute the summation.

  • Products (Pi-notation):
(product|pi) %string% from %number% to (%number%|infinity)

Exactly the same as summation, excepts it multiplies instead of adding.

  • Limit :
limit %string% as x approaches %number% [from above]
limit %string% as x approaches [-]infinity

The limit of an expression as it approaches a value means "Okay, I have no idea what that expression is equal to when we are actually at the value, but this is what the expression approaches as x approaches the value". Syntaxes are self-explanatory if you used limits before. Always uses WolframAlpha.

  • Derivatives :
((calculate|compute) derivative of|derivate) %string% [at %number%]
d/dx\\(%string%\\) [where %number%]

Calculates the derivative of an expression. If at %number% is omitted, then last skript-math result will be set to a string representing the derivative of the expression. However, if it is put in, then last skript-math result will be set to the result of the derivative of the expression at a certain point. Always uses WolframAlpha.

  • Integrals :
((calculate|compute) integral of|integrate) %string% [from %number% to %number%] 

Calculates the indefinite integral of an expression if from %number% to %number% is omitted, and calculates its definite integral otherwise. Always uses WolframAlpha.

Clone this wiki locally