I'd suggest two things:
First, read the documentation cited in our Forum Charter for necessary information about regular expressions pattern-matching and Apache's mod_rewrite module -- You cannot "guess your way" through either of these aspects of your project, as the syntax of both require *extreme* precision and attention to detail (and so require a firm knowledge base). In many cases, it would actually be faster to stop coding and spend a week(!) studying the documentation than to proceed directly with coding based on guesswork. I'm quite serious, BTW.
Second, it is impossible to reliably determine anything beyond the probable case that your patterns are malformed because we don't know your *intent* in writing or using the rules above. It would be highly useful if you could document your code by adding concise and complete comments to each rule, describing the form of the requested URL that you wish to match, and the filepath to which that URL should be rewritten.
I will however, hazard a guess to illustrate problems with your patterns and use of [QSA], plus a good method of commenting code. If this code is intended for use in your root .htaccess file, then I'd suggest:
RewriteEngine On
#
# Internally rewrite requests for URL-paths in the form /wiki/<post-title> to
# filepath /w/index.php?title=<post-title>, retaining any appended query-string
RewriteRule ^wiki/(.+)$ /w/index.php?title=$1 [QSA,L]
#
# Internally rewrite requests URL-path /wiki/<blank> to filepath
# /w/index.php, retaining any appended query-string by default
RewriteRule ^wiki/$ /w/index.php [L]
#
# Internally rewrite requests for the root URL-path to filepath
# /w/index.php, retaining any appended query-string by default
RewriteRule ^$ /w/index.php [L]
Further, as an SEO consideration, I would strongly suggest replacing the second internal-rewrite rule above with a redirect rule in order to eliminate a duplicate-content problem with "/w/index.php" being directly-accessible by two *different* URLs. However, this redirect must not be implemented until all links to "/wiki/" on your own site have been corrected to link to "/" instead (likely a setting in the wiki configuration file). Once that is done, change the 2nd rule's syntax to "RewriteRule ^wiki/$ [
example...] [R=301,L]" and update the comment to refer to a redirect from the old URL-path to the new URL.
Jim