magnets are used in machines to create and change current