In calculating the profits of a trade, a deduction is allowed for expenses incurred—
(a)in obtaining for the purposes of the trade the grant of a patent or the extension of a patent's term, or
(b)in connection with a rejected or abandoned application for a patent made for the purposes of the trade.