Velvet Star Monitor

Standout celebrity highlights with iconic style.

general

How to input this into Wolfram Alpha?

Writer Sebastian Wright
$\begingroup$

I wish to simplify a sum by doing "simplify sum_{a=0}^L f(a)" where $f(a)$ is just some arbitrary expression, but I want to only do the sum when some condition is met.

Using the Iverson brackets, I am trying to do "simplify sum_{a=0}^L [some condition] f(a)" if that makes sense.

$\endgroup$

1 Answer

$\begingroup$

You might be able use boole, which returns $0$ or $1$ depending on whether it's argument is True or False. Thus, for $n=10$, Euler's phi function $\varphi(n)$ (which counts the number of positive integers less than and relatively prime to $n$) can be expressed as

sum boole(gcd(i,10)=1), i=1..10

enter image description here

Of course, it's hard to say for sure, since you don't mention your specific application. This method of computing $\varphi(n)$, however, happens to be Wikipedia's first example application of Iverson brackets.

$\endgroup$

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy