text:
Bug 539506 - (mathml-clipboard) [MathML3] Implement clipboard specification
 (mathml-clipboard) Summary: [MathML3] Implement clipboard specification
 Status: NEW [lang=c++] dev-doc-needed, helpwanted Core Components Drag and Drop (show other bugs) Trunk All All -- enhancement with 6 votes (vote) --- Nobody; OK to take it and work on it Frédéric Wang (:fredw) 175845 175850 759462 487587 mathml-3 Show dependency tree / graph

Reported: 2010-01-13 11:33 PST by Frédéric Wang (:fredw)
Modified: 2015-06-19 20:05 PDT (History)
20 users (show)
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

Attachments
Add-on to test MathML copy and analyse the clipboard (163.09 KB, application/x-xpinstall)
2012-11-02 17:03 PDT, Frédéric Wang (:fredw)
no flags Details
Avoid code duplication between nsCopySupport and nsDocumentEncoder - V1 (8.88 KB, patch)
2012-11-05 11:42 PST, Frédéric Wang (:fredw)
ehsan: review+
Details | Diff | Splinter Review
Part 1: Avoid code duplication between nsCopySupport and nsDocumentEncoder - V2 (9.64 KB, patch)
2012-11-05 13:56 PST, Frédéric Wang (:fredw)
no flags Details | Diff | Splinter Review
Add-on to use the editor in Firefox (1.73 KB, application/x-xpinstall)
2012-11-10 03:37 PST, Frédéric Wang (:fredw)
no flags Details
Part 2: Implement copy operation for MathML and TeX - V1 (22.58 KB, patch)
2012-11-11 12:56 PST, Frédéric Wang (:fredw)
no flags Details | Diff | Splinter Review
Part 3: Implement copy operation for MathML and TeX - V1 (10.39 KB, patch)
2012-11-11 12:57 PST, Frédéric Wang (:fredw)
no flags Details | Diff | Splinter Review
Part 4: Implement copy operation for MathML and TeX - V1 (3.84 KB, patch)
2012-11-11 12:58 PST, Frédéric Wang (:fredw)
no flags Details | Diff | Splinter Review
Part 6: Implement MathML paste and drop operations for the HTML editor - V1 (5.19 KB, patch)
2012-11-11 12:58 PST, Frédéric Wang (:fredw)
no flags Details | Diff | Splinter Review
Add a method nsContentUtils::ParseDocumentXML (8.69 KB, patch)
2012-11-12 15:09 PST, Frédéric Wang (:fredw)
no flags Details | Diff | Splinter Review
Part 5: Add a method nsContentUtils::ParseDocumentXML (16.13 KB, patch)
2012-11-15 00:49 PST, Frédéric Wang (:fredw)
hsivonen: feedback+
Details | Diff | Splinter Review
Part 5: Add a method nsContentUtils::ParseDocumentXML - V2 (16.57 KB, patch)
2012-12-01 13:56 PST, Frédéric Wang (:fredw)
no flags Details | Diff | Splinter Review

 Frédéric Wang (:fredw) 2010-01-13 11:33:53 PST Section 6.3 "Transferring MathML" of MathML 3 describes a recommended clipboard format to use when transferring MathML code. For interoperability reasons, Mozilla browser/editor should support copy-and-paste and drag-and-drop following this specification. FYI, an extract from David Carlisle's "introduction to MathML": "An early version of the clipboard specification is already implemented in MathPlayer MathML renderer for Microsoft® Internet Explorer®, and in Microsoft Word 2007, which allows Math fragments to be reliably cut from Internet Explorer and pasted into Word." https://www.ibm.com/developerworks/xml/library/x-mathml3/ Szabolcs Horvát 2011-04-15 03:35:22 PDT I'd like to add that Mathematica also has support for copying/pasting MathML (which at least works with Word 2007). http://blog.wolfram.com/2008/07/31/going-wordless-at-the-advanced-mathematica-summer-school/ Frédéric Wang (:fredw) 2011-04-15 05:24:37 PDT Here is a demo for both Word and Mathematica: http://www.screenr.com/dAO Frédéric Wang (:fredw) 2012-04-26 00:43:01 PDT I cc' Andrii as this bug could maybe fit in his summer of code project, in the larger context of "interactive MathML". I have an experimental add-on which adds support for "copy MathML". Here is the source code: https://raw.github.com/fred-wang/Mathzilla/master/mathzilla/lib/copy-mathml.js (you can uncomment the commented part, if I remember I did that because of a problem with Components.classes and JetPack). Frédéric Wang (:fredw) 2012-06-08 01:09:40 PDT Just for the record, in very old notes to myself I list these files: layout/base/nsDocumentViewer.cpp content/base/src/nsCopySupport.cpp Frédéric Wang (:fredw) 2012-10-31 02:07:17 PDT cc'ing Jacques Distler. I tried to respond to his mail but my smtp server is blacklisted by his spam filter... Frédéric Wang (:fredw) 2012-10-31 03:06:00 PDT Setting this as a mentored bug, although I don't really have a knowledge of the code referred in comment 4. Specifically, Jacques Distler's proposal is contained in the fifth point of "Recommended Behaviors": "When an application exports a MathML fragment whose only child of the root element is a semantics element, it SHOULD offer, after the above flavors, a transfer flavor for each annotation or annotation-xml element, provided the transfer flavor can be recognized and named based on the encoding attribute value, and provided the annotation key is (the default) alternate-representation. The transfer content for each annotation should contain the character data in the specified encoding (for an annotation element), or a well-formed XML fragment (for an annotation-xml element), or the data that results by requesting the URL given by the src attribute (for an annotation reference)." The particularly interesting annotation is which is generated by LaTeXML and that Jacques Distler wants to add to itex2MML. I guess MathJax could add this in the native MathML output too. Conversely, I would be great if this application/x-tex flavor could be used in our editor (used in thunderbird, bluegriffon, seamonkey etc) but that would require a TeX parser in Gecko or a call to an external parser I guess. The video from comment 2 shows how it is used to paste in MathType or Wikipedia. Frédéric Wang (:fredw) 2012-10-31 03:16:54 PDT (In reply to Frédéric Wang (:fredw) from comment #6) > Conversely, I would be great if this application/x-tex flavor could be used > in our editor (used in thunderbird, bluegriffon, seamonkey etc) but that > would require a TeX parser in Gecko or a call to an external parser I guess. > The video from comment 2 shows how it is used to paste in MathType or > Wikipedia. Perhaps nsIProcess would be helpful to call one of the existing converter like Blahtex, itex2MML or LaTeXML. https://developer.mozilla.org/en-US/docs/XPCOM_Interface_Reference/nsIProcess Otherwise, we can use a Javascript converter like MathJax but I don't think we want to include such a converter in our code base. distler 2012-10-31 06:54:23 PDT Hmm. Sorry about the Spam filter. I shall have to smack it around. As to incorporating itex2MML (or one of the alternatives) in your editor, I should point out that's exactly the course taken by AbiWord. Their equation editor uses itex2MML and gtkmathview. * http://www.dedoimedo.com/computers/abiword.html Frédéric Wang (:fredw) 2012-11-02 08:38:38 PDT I've started to work on this bug (only for MathML copy for the moment, not other flavors in like LaTeX etc). That would be great to see if that works with tools like Word, Mathematica or MathType. I've added a first patch to my mercurial queue so normally it should be automatically integrated in Bill's build soon: http://www.wg9s.com/mozilla/firefox/ Frédéric Wang (:fredw) 2012-11-02 17:03:33 PDT Created attachment 677945 [details] Add-on to test MathML copy and analyse the clipboard I haven't found something on Linux to inspect clipboard content so I've written a little Firefox add-on to do so. Perhaps it's a bit biased to use Gecko's clipboard API to test the patch so that would still be useful if someone could test with other programs (Word, Mathematica etc). This add-on adds two icons on the bottom right corner: - the first button opens a test case page - the second button pastes the content of different clipboard flavors (MathML, TeX, HTML and plain text) at the end of the current page. Frédéric Wang (:fredw) 2012-11-02 17:10:11 PDT I've just updated my patch queue to fix some issues in mtable and implement TeX copy in . But copying TeX is not always successful at the moment, so I'll have to improve that. Frédéric Wang (:fredw) 2012-11-03 04:56:55 PDT That would probably be useful to fix some selection bugs if MathML copy is implemented. So I make this depends on various such bugs. Bill Gianopoulos [:WG9s] 2012-11-03 07:49:50 PDT (In reply to Frédéric Wang (:fredw) from comment #11) > I've just updated my patch queue to fix some issues in mtable and implement > TeX copy in . But copying TeX is not always successful at the > moment, so I'll have to improve that. I get the following compiler errors under windows: c:/Users/wag/mozilla/mozilla2/widget/windows/nsClipboard.cpp(46) : error C2039: 'CF_MATHML' : is not a member of 'nsClipboard' c:\users\wag\mozilla\mozilla2\widget\windows\nsClipboard.h(23) : see declaration of 'nsClipboard' c:/Users/wag/mozilla/mozilla2/widget/windows/nsClipboard.cpp(47) : error C2039: 'CF_TEX' : is not a member of 'nsClipboard' c:\users\wag\mozilla\mozilla2\widget\windows\nsClipboard.h(23) : see declaration of 'nsClipboard' Defining those made it compile for me. Frédéric Wang (:fredw) 2012-11-03 07:59:42 PDT (In reply to Bill Gianopoulos [:WG9s] from comment #13) > (In reply to Frédéric Wang (:fredw) from comment #11) > > I've just updated my patch queue to fix some issues in mtable and implement > > TeX copy in . But copying TeX is not always successful at the > > moment, so I'll have to improve that. > > I get the following compiler errors under windows: > > c:/Users/wag/mozilla/mozilla2/widget/windows/nsClipboard.cpp(46) : error > C2039: 'CF_MATHML' : is not a member of 'nsClipboard' > c:\users\wag\mozilla\mozilla2\widget\windows\nsClipboard.h(23) : see > declaration of 'nsClipboard' > c:/Users/wag/mozilla/mozilla2/widget/windows/nsClipboard.cpp(47) : error > C2039: 'CF_TEX' : is not a member of 'nsClipboard' > c:\users\wag\mozilla\mozilla2\widget\windows\nsClipboard.h(23) : see > declaration of 'nsClipboard' > > Defining those made it compile for me. OK, I forgot to define them in nsClipboard.h. Thanks for the info. I hope that with this change, the copy and paste to Word will now work. Bill Gianopoulos [:WG9s] 2012-11-03 10:31:59 PDT Assuming what I did to fix this in nsClipboard.h is correct, there are builds that can be used for testing at http://www.wg9s.com/mozilla/firefox/ Unfortunately I do not have Office installed on my home computer. David Carlisle 2012-11-03 15:23:28 PDT Using today's WG9s I now see "MathML" flavour on the clipboard but if I paste into Word I just get character data: the markup is not recognised. If I look at the clipboard flavour in a little c# program I see the text below where I wouldn't expect to see the \0. I don't know too much about windows clipboard really but it looks like an utf16/8 mis-match somewhere. mathMl "<\0?\0x\0m\0l\0 \0v\0e\0r\0s\0i\0o\0n\0=\0\"\01\0.\00\0\"\0?\0>\0\n\0<\0m\0a\0t\0h\0 \0x\0m\0l\0n\0s\0=\0\"\0h\0t\0t\0p\0:\0/\0/\0w\0w\0w\0.\0w\03\0.\0o\0r\0g\0/\01\09\09\08\0/\0M\0a\0t\0h\0/\0M\0a\0t\0h\0M\0L\0\"\0>\0\n\0<\0m\0o\0>\0�\0<\0/\0m\0o\0>\0\r\0\n\0 \0 \0 \0 \0 \0 \0<\0m\0s\0q\0r\0t\0>\0\r\0\n\0 \0 \0 \0 \0 \0 \0 \0 \0<\0m\0r\0o\0w\0>\0\r\0\n\0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0<\0m\0s\0u\0p\0>\0\r\0\n\0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0<\0m\0i\0>\0b\0<\0/\0m\0i\0>\0\r\0\n\0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0<\0m\0n\0>\02\0<\0/\0m\0n\0>\0\r\0\n\0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0<\0/\0m\0s\0u\0p\0>\0\r\0\n\0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0<\0m\0o\0>\0-\0<\0/\0m\0o\0>\0\r\0\n\0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0<\0m\0r\0o\0w\0>\0\r\0\n\0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0<\0m\0n\0>\04\0<\0/\0m\0n\0>\0\r\0\n\0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0<\0m\0o\0>\0b <\0/\0m\0o\0>\0\r\0\n\0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0<\0m\0i\0>\0a\0<\0/\0m\0i\0>\0\r\0\n\0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0<\0m\0o\0>\0b <\0/\0m\0o\0>\0\r\0\n\0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0<\0m\0i\0>\0c\0<\0/\0m\0i\0>\0\r\0\n\0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0<\0/\0m\0r\0o\0w\0>\0\r\0\n\0 \0 \0 \0 \0 \0 \0 \0 \0<\0/\0m\0r\0o\0w\0>\0\r\0\n\0 \0 \0 \0 \0 \0 \0<\0/\0m\0s\0q\0r\0t\0>\0\n\0<\0/\0m\0a\0t\0h\0>\0\0\0" string Frédéric Wang (:fredw) 2012-11-03 15:51:27 PDT Good to know that the "MathML" flavor was used this time. I tried with MathType and Word and that seems to work, but Word use the plain text flavor (I don't know about MathType). In general Gecko uses UTF-16 for its internal string. The MathML REC indicates: "The instance MUST specify the character encoding, if it uses an encoding other than UTF-8, either in the XML declaration, or by the use of a byte-order mark (BOM) for UTF-16-encoded data." I thought Gecko would add this BOM mark, but I don't see it in the output of your program. So to be in accordance with the spec we should either: 1) convert the string to UTF-8 2) add a BOM mark 3) declaring UTF-16 in the XML declaration Bill Gianopoulos [:WG9s] 2012-11-04 08:16:27 PST Sorry my builds were a bit late today because I had issues on my build system. Windows builds including the BOM fix are now available on my site. David Carlisle 2012-11-04 11:09:37 PST The BOM improved things in my C# clipboard viewer: the string encoding was automatically identified so the MathML XML markup appears correctly, however Word 2010 still doesn't recognise the MathML on paste. Comparing with MathPlayer and the Windows Math Input Panel, both of which do work to paste into Word the main difference I see is that both of them also have an explicit encoding="UTF-16" in the xml declaration. They both also use namespace prefixed forms but I suspect it is the encoding declaration that is making the difference. I could ask Murray to say what exactly Word is looking for.... Frédéric Wang (:fredw) 2012-11-04 11:31:18 PST (In reply to David Carlisle from comment #19) > Comparing with > MathPlayer and the Windows Math Input Panel, both of which do work to paste > into Word the main difference I see is that both of them also have an > explicit encoding="UTF-16" in the xml declaration. OK, I'll update my patch in a moment to add the encoding. Bill Gianopoulos [:WG9s] 2012-11-04 13:27:00 PST OK. New builds on my site with the new patch (unless I screwed up, which is entirely possible) are now available. David Carlisle 2012-11-04 14:02:44 PST Sorry, no success with Word, I now see the encoding="UTF-16" and if I cut and paste the xml out of my clipboard viewer (presumably just as Unicode text flavour since it's a basic textbox) then it does display as formatted mathematics in Word, but if I directly paste from the clipboard after copying the expression in firefox, Word just shows the character data. I don't know what to suggest, I could ask Murray what exactly Word is looking for on the clipboard, or someone else who understands Word could try to debug. Frédéric Wang (:fredw) 2012-11-04 14:11:28 PST (In reply to David Carlisle from comment #22) > I could ask Murray what exactly Word is looking > for on the clipboard, or someone else who understands Word could try to > debug. Yes, please ask Murray. Note that Firefox transmit MathML, HTML and plain text flavors. Probably the other flavors are disturbing Word. Does someone have access to another tools? I tried with MathType and it worked (although I don't know if it really used the MathML flavor or the unicode one). I can probably modify my patch to temporarily remove the HTML and plain text flavors. Frédéric Wang (:fredw) 2012-11-05 06:38:42 PST (In reply to Frédéric Wang (:fredw) from comment #23) > I can probably modify my patch to temporarily remove the HTML and plain text > flavors. Done. Let's see if Word understands the MathML better and if MathType did not cheat by using the plain text flavor. Frédéric Wang (:fredw) 2012-11-05 11:42:14 PST Created attachment 678409 [details] [diff] [review] Avoid code duplication between nsCopySupport and nsDocumentEncoder - V1 nsCopySupport and nsDocumentEncoder use essentially the same code to determine whether we are in a plaintext context. I need to modify this code to determine whether we are in a MathML context, but I feel a bit bad to add even more code duplication. So let's consider a preliminary patch to avoid this issue so that I can continue the work on this bug. nsCopySupport::IsPlainTextContext is public but is only used in nsCopySupport::SelectionCopyHelper. Moreover it does (almost) a subset of the work of nsHTMLCopyEncoder::SetSelection and this latter function is called after nsCopySupport::IsPlainTextContext. By switching the order of function calls, I think we can just retrieve the boolean result stored in nsHTMLCopyEncoder::mIsTextWidget. I propose to add a GetContextParameters member to the nsIDocumentEncoder interface in order to do this task (I can probably make mIsTextWidget a read-only boolean attribute if you prefer). Note the 's' at the end of GetContextParameters: I plan to add another parameter for MathML. I say "almost" above, because nsCopySupport::IsPlainTextContext uses an additional code fragment to skip non-HTML tags. I think it is the right thing because the conditions after this fragment don't check the namespace. Perhaps it is also a bit faster. This change is not a problem for input/textarea because they can not contain non-HTML elements anyway (I think?) and regarding body, we really just want to reach this element and don't care about what it contains. :Ehsan Akhgari 2012-11-05 12:03:16 PST Comment on attachment 678409 [details] [diff] [review] Avoid code duplication between nsCopySupport and nsDocumentEncoder - V1 Review of attachment 678409 [details] [diff] [review]: ----------------------------------------------------------------- ::: content/base/public/nsIDocumentEncoder.idl @@ +327,5 @@ > + /** > + * Determine whether the selection is inside a special context. > + * @param aIsPlainTextContext whether the selection is in a plain text context > + */ > + void getContextParameters(out boolean aIsPlainTextContext); You need to update the uuid of this interface. Frédéric Wang (:fredw) 2012-11-05 12:50:04 PST (In reply to Ehsan Akhgari [:ehsan] from comment #26) > @@ +327,5 @@ > > + /** > > + * Determine whether the selection is inside a special context. > > + * @param aIsPlainTextContext whether the selection is in a plain text context > > + */ > > + void getContextParameters(out boolean aIsPlainTextContext); > > You need to update the uuid of this interface. Thanks. The next part will be to add a aMathMLContext parameter, so I'll update the interface in this second patch. :Ehsan Akhgari 2012-11-05 13:49:35 PST (In reply to comment #27) > (In reply to Ehsan Akhgari [:ehsan] from comment #26) > > @@ +327,5 @@ > > > + /** > > > + * Determine whether the selection is inside a special context. > > > + * @param aIsPlainTextContext whether the selection is in a plain text context > > > + */ > > > + void getContextParameters(out boolean aIsPlainTextContext); > > > > You need to update the uuid of this interface. > > Thanks. The next part will be to add a aMathMLContext parameter, so I'll update > the interface in this second patch. It's considered good practice to rev the uuid in every patch, since that will protect you in the future if for example one of the two patches get backed out for some reason. Frédéric Wang (:fredw) 2012-11-05 13:56:12 PST Created attachment 678457 [details] [diff] [review] Part 1: Avoid code duplication between nsCopySupport and nsDocumentEncoder - V2 OK, here is a version with the uuid updated. Frédéric Wang (:fredw) 2012-11-06 00:26:45 PST (In reply to Frédéric Wang (:fredw) from comment #23) > (In reply to David Carlisle from comment #22) > > I could ask Murray what exactly Word is looking > > for on the clipboard, or someone else who understands Word could try to > > debug. > > Yes, please ask Murray. Note that Firefox transmit MathML, HTML and plain > text flavors. Probably the other flavors are disturbing Word. > IIUC, Murray quick guess about the problem is that Word expect UTF-8, not UTF-16. Apparently, on Windows nsDataObj::GetText converts CF_TEXT and CF_HTML to UTF-8. So perhaps we should do so for CF_MATHML and CF_TEX too. Frédéric Wang (:fredw) 2012-11-10 03:37:33 PST Created attachment 680345 [details] Add-on to use the editor in Firefox So unless I miss something, implementing the paste operation for MathML was pretty easy, just saying to the editor to recognize the MathML mime types (I hope the name of the flavors are already recognized by Windows thanks to the other patch for the copy operation). I've just updated my patch queue, so the patch won't be included in Bill's builds immediately. Also, you need an editor to test the paste operation so I'm attaching a basic add-on to load the editor in Firefox. Once installed, the editor should be available at chrome://editor/content/editor.xul Note that the DOM inspector can be used to copy the HTML source code generated by the editor. The HTML paste operation is already implemented in Gecko and because MathML can be included in HTML, the editor already already allows to paste MathML (so your can insert math in Thunderbird, see bug 593721 comment 6). If you really want to test my patch you should either use an application that exports the MathML flavor without the HTML one like the Windows Math panel for example. Or there's also still a patch in my patch queue to make the copy MathML operation export the MathML flavor only. Bill Gianopoulos [:WG9s] 2012-11-10 03:51:34 PST (In reply to Frédéric Wang (:fredw) from comment #31) > Created attachment 680345 [details] > other patch for the copy operation). I've just updated my patch queue, so > the patch won't be included in Bill's builds immediately. Also, you need an Actually you updated the queue just before my build got to the point where it downloads your queue. Therefore, this patch will be included in the builds currently in progress for today. Frédéric Wang (:fredw) 2012-11-10 04:24:26 PST (In reply to Frédéric Wang (:fredw) from comment #31) > So unless I miss something, implementing the paste operation for MathML was > pretty easy OK, I know what I missed: when pasting MathML in MathML, I have to remove the [itex] root from the imported MathML tree before pasting it and do more processing like slitting the token elements adding s etc. However, pasting in MathML, or cutting/deleting a MathML subtree or copying a MathML subtree may currently result in invalid markup (even without my patches) so I'd better handle all these cases in a separate bug... (In reply to Bill Gianopoulos [:WG9s] from comment #32) > Actually you updated the queue just before my build got to the point where > it downloads your queue. > OK, great! Good timing :-) Frédéric Wang (:fredw) 2012-11-11 12:56:52 PST Created attachment 680460 [details] [diff] [review] Part 2: Implement copy operation for MathML and TeX - V1 Frédéric Wang (:fredw) 2012-11-11 12:57:33 PST Created attachment 680461 [details] [diff] [review] Part 3: Implement copy operation for MathML and TeX - V1 Frédéric Wang (:fredw) 2012-11-11 12:58:01 PST Created attachment 680462 [details] [diff] [review] Part 4: Implement copy operation for MathML and TeX - V1 Frédéric Wang (:fredw) 2012-11-11 12:58:39 PST Created attachment 680463 [details] [diff] [review] Part 6: Implement MathML paste and drop operations for the HTML editor - V1 Frédéric Wang (:fredw) 2012-11-11 13:01:43 PST I have two questions: - Is there a way to parse an XML document from a string? The ContentUtils::ParseFragmentHTML currently used by the editor code seems to do that, but I'm wondering if I should instead use XML for MathML (see point 6 below). ContentUtils::ParseFragmentXML fails for me when the XML declaration is present. - Can someone with knowledge of the clipboard code in widget/ help? I'm wondering how to register these "Universal Type Identifier" for Mac. In general, I'm wondering if I need to add more code to claim support for MathML copy or paste transfer. At the moment, I only added this for Windows: attachment 680462 [details] [diff] [review]. See also points 5 and 6 below. Maybe I should also add a status progress on this bug: 1) When you select a MathML subexpression, the "copy" command will put additional MathML and TeX flavors into the clipboard (see 2). However, it is hard to select the whole [itex] element with a mouse (often you select adjacent text nodes or elements). It seems that adding a "copy formula" item in the context menu will help, but that would mean touching code outside Gecko so I'd prefer to do that in a separate bug, to avoid delaying the integration of these patches. Only single-range selections are considered for MathML, which I think is reasonable (the comments in the code seems to assume it is for table selection only, even if that works in more general cases). 2) The copy command for MathML will always put MathML & text unicode flavors representing the selected subexpression into the clipboard, as described in the MathML REC. The HTML-related flavors for this subexpression are still added to the clipboard (but the HTML context & info flavors will be empty). When your MathML selection has a ancestor, the flavors for presentation MathML, content MathML and TeX are added to the clipboard, if found. 3) Inside the HTML editor, you can paste "MathML" and "MathML Presentation" flavors. Currently, I don't try to sniff the unicode text flavor to see if it contains MathML and I don't use the TeX flavor either (that would require a TeX parser). I don't plan to include any of these features in this bug's work. I didn't add anything for the plaintext editor either. Perhaps that would be useful to have the TeX flavor pasted e.g. when you edit a page in Wikipedia or other web forms. But that would require an interface to let user select among multiple flavors I guess (here TeX and unicode text). BTW, there is bug 73286 for Seamonkey. 4) When you cut/copy/paste/delete a MathML subtree you may get invalid markup. This is already the case without my patch. The HTML editor doesn't seem to have been designed with mixing HTML & MathML (or SVG) in mind, so I'd better postpone this work in a separate bug too and focus on the main goal on this bug: allowing interaction with other applications (points 5 and 6) 5) Currently, I'm able to do copy & paste from Gecko to Gecko and to transfer data to David Carlisle's C# program (http://monet.nag.co.uk/~dpc/mmlclipboard.exe ; http://code.google.com/p/web-xslt/source/browse/trunk/mmlclipboard). Transfer from Gecko to MathType seems to work (only MathML Presentation and unicode text with the MathType version I have access to). Transfer from Gecko to Word works via unicode text only. David and I have tried many combinations but we have not been able to figure out how to make it work with a MathML flavor. Transfer from Gecko to other applications like Mathematica or Mapple may probably work via unicode text too. But I don't know if these programs support the MathML flavor and I haven't tested them. I have essentially done experiments on Windows as I don't have Mac/Linux programs to communicate with besides MathType on Mac. 6) I'm able to transfer from David Carlisle's C# program to Gecko. Transfer from Word/MathPlayer/Windows Math Panel to Gecko does not seem to work at all. I think there are two issues: the MathML REC says that the MathML flavor must contain an XML document but I use the HTML parser and these three programs use namespace prefixes + I'm not sure that the platform-specific stuff I added in widget/ are enough. David Carlisle 2012-11-11 13:50:57 PST (In reply to Frédéric Wang (:fredw) from comment #38) > I have two questions: > > - Is there a way to parse an XML document from a string? DomParser is your friend there: https://developer.mozilla.org/en-US/docs/DOM/DOMParser > > 5) Currently, I'm able to do copy & paste from Gecko to Gecko and to > transfer data to David Carlisle's C# program > (http://monet.nag.co.uk/~dpc/mmlclipboard.exe ; > http://code.google.com/p/web-xslt/source/browse/trunk/mmlclipboard). > Transfer from Gecko to MathType seems to work (only MathML Presentation and > unicode text with the MathType version I have access to). Transfer from > Gecko to Word works via unicode text only. David and I have tried many > combinations but we have not been able to figure out how to make it work > with a MathML flavor. Transfer from Gecko to other applications like > Mathematica or Mapple may probably work via unicode text too. But I don't > know if these programs support the MathML flavor and I haven't tested them. > I have essentially done experiments on Windows as I don't have Mac/Linux > programs to communicate with besides MathType on Mac. > > 6) I'm able to transfer from David Carlisle's C# program to Gecko. Transfer > from Word/MathPlayer/Windows Math Panel to Gecko does not seem to work at > all. I think there are two issues: the MathML REC says that the MathML > flavor must contain an XML document but I use the HTML parser and these > three programs use namespace prefixes + I'm not sure that the > platform-specific stuff I added in widget/ are enough. I'm fairly sure that the xml namespace prefixing is not relevant, what does seem to make a difference though is the type, if you sent a string as MathML flavor Word never shows anything, probably because it passes it through the wring encoding or null-at-end paths. What the c# test program you mentioned does for both cut and paste of MathML flavour is to put an in memory stream on the clipboard with a BOM at the front and no null at the end. If you paste in that for Word sees happy. So in my c# clipboard viewer I can see code that has been coped from gecko, pasting it to word fails but if I just get the viewer to repaste the same string as a MemoryStream with flavor MathML then Word picks it up and formats it as a math zone. Frédéric Wang (:fredw) 2012-11-11 14:03:51 PST (In reply to David Carlisle from comment #39) > DomParser is your friend there: > > https://developer.mozilla.org/en-US/docs/DOM/DOMParser > Thanks David, but I was really asking a function from Gecko's C++ source. I'm not really willing to use XPCOM to call nsIDOMParser ;-) > > I'm fairly sure that the xml namespace prefixing is not relevant I agree for Gecko to * transfer, but I was really considering * to Gecko transfer. Word, MathPlayer & Windows Math Panel use xml namespace prefixing and when I send them to Gecko, it does not seem to work. It doesn't work either when I use your C# program to transfer this code with namespace prefixes to Gecko so I guess ContentUtils::ParseFragmentHTML is not really happy with that... thus my question about whether there is another function to parse an XML document. (However, when I seem to remember that when I hardcoded the string in Gecko's source it worked but now I'm no longer sure about which parser I used) Henri Sivonen (:hsivonen) (Not reading bugmail or doing reviews until 2016-10-03) 2012-11-12 01:17:47 PST (In reply to Frédéric Wang (:fredw) from comment #38) > - Is there a way to parse an XML document from a string? The > ContentUtils::ParseFragmentHTML currently used by the editor code seems to > do that, but I'm wondering if I should instead use XML for MathML (see point > 6 below). Looking at the MathML spec for the clipboard flavor, yes. > ContentUtils::ParseFragmentXML fails for me when the XML > declaration is present. You need nsContentUtils::ParseDocumentXML, but that method doesn’t exist yet, because no one has needed such a Gecko internal API so far. I guess now is the time to introduce it. You need to set up an nsParser with an nsXMLContentSink, make sure everything is initialized in a suitable way and then call nsresult nsParser::Parse(const nsAString& aSourceBuffer, void* aKey, bool aLastCall). Pass nullptr for aKey and true as aLastCall. Unfortunately, if you are going to hack nsParser, you are going to have a bad time. Sorry that I haven’t gotten around to obsoleting nsParser, yet. > 6) I'm able to transfer from David Carlisle's C# program to Gecko. Transfer > from Word/MathPlayer/Windows Math Panel to Gecko does not seem to work at > all. I think there are two issues: the MathML REC says that the MathML > flavor must contain an XML document but I use the HTML parser and these > three programs use namespace prefixes + I'm not sure that the > platform-specific stuff I added in widget/ are enough. Please don’t use the HTML for this. Frédéric Wang (:fredw) 2012-11-12 02:42:12 PST (In reply to Henri Sivonen (:hsivonen) from comment #41) > You need nsContentUtils::ParseDocumentXML, but that method doesn’t exist > yet, because no one has needed such a Gecko internal API so far. I guess now > is the time to introduce it. Thanks, that's what I was feared :-( > You need to set up an nsParser with an nsXMLContentSink Quick look: NS_NewXMLContentSink wants arguments nsIDocument* aDoc, nsIURI* aURI, nsISupports* aContainer and nsIChannel* aChannel. I guess aDoc is the target document as in other nsContentUtils::Parse* methods, but what should I use for the others? neil@parkwaycc.co.uk 2012-11-12 03:00:55 PST (In reply to David Carlisle from comment #39) > I'm fairly sure that the xml namespace prefixing is not relevant, what does > seem to make a difference though is the type, if you sent a string as MathML > flavor Word never shows anything, probably because it passes it through the > wring encoding or null-at-end paths. What the c# test program you mentioned > does for both cut and paste of MathML flavour is to put an in memory stream > on the clipboard with a BOM at the front and no null at the end. If you > paste in that for Word sees happy. Gecko currently has no support for copying anything except TYMED_HGLOBAL, but all the code samples (except yours) I found assume that the source is the TYMED_HSTREAM that the Math Input Panel provides... David Carlisle 2012-11-12 03:40:41 PST (In reply to neil@parkwaycc.co.uk from comment #43) > Gecko currently has no support for copying anything except TYMED_HGLOBAL, > but all the code samples (except yours) I found assume that the source is > the TYMED_HSTREAM that the Math Input Panel provides... Don't take my code as authoritative in any way (I'm _way_ out of my depth here:-) It was a mixture of some information found somewhere in the internet and trial and error. The .NET MemoryStream type used there works for identifying the MathML flavor as put on the clipboard by the input panel and by MathPlayer and Word, it also works for pasting to Word but I have no idea what .NET/COM translation is going on behind the scenes so I'm not sure how relevant it is to the c++ coding under discussion. If it is useful that's fine but if it is irrelevant then that's OK too:-) Henri Sivonen (:hsivonen) (Not reading bugmail or doing reviews until 2016-10-03) 2012-11-12 04:49:04 PST (In reply to Frédéric Wang (:fredw) from comment #42) > Quick look: NS_NewXMLContentSink wants arguments nsIDocument* aDoc, nsIURI* > aURI, nsISupports* aContainer and nsIChannel* aChannel. I guess aDoc is the > target document as in other nsContentUtils::Parse* methods, but what should > I use for the others? You can do nsCOMPtr uri; NS_NewURI(getter_AddRefs(uri), "about:blank"); nsCOMPtr principal = do_CreateInstance(NS_NULLPRINCIPAL_CONTRACTID); nsCOMPtr domDocument; nsresult rv = nsContentUtils::CreateDocument(EmptyString(), EmptyString(), nullptr, uri, uri, principal, nullptr, DocumentFlavorLegacyGuess, getter_AddRefs(domDocument)); And then * pass domDocument QIed to nsIDocument as aDoc * pass uri as aURI * pass nullptr as aContainer * pass nullptr as aChannel However, instead of using NS_NewXMLContentSink as-is, it seems to me you will need to add a new way to instantiate nsXMLContentSink in such a way that mRunsToCompletion gets set to true in the constructor of nsXMLContentSink (before nsXMLContentSink::Init() is called). You might even get away with not calling nsXMLContentSink::Init() if you have some other mechanism to set mTargetDocument to your doc and mNodeInfoManager to its nodeinfomanager. Frédéric Wang (:fredw) 2012-11-12 15:09:10 PST Created attachment 680824 [details] [diff] [review] Add a method nsContentUtils::ParseDocumentXML Experimental patch (not tested). Frédéric Wang (:fredw) 2012-11-12 15:12:12 PST (In reply to Henri Sivonen (:hsivonen) from comment #41) > You need to set up an nsParser with an nsXMLContentSink, make sure > everything is initialized in a suitable way and then call > nsresult > nsParser::Parse(const nsAString& aSourceBuffer, > void* aKey, > bool aLastCall). > > Pass nullptr for aKey and true as aLastCall. > > Unfortunately, if you are going to hack nsParser, you are going to have a > bad time. Sorry that I haven’t gotten around to obsoleting nsParser, yet. > nsContentUtils.cpp uses the nsIParser interface, but nsParser::Parse(const nsAString& aSourceBuffer, void* aKey, bool aLastCall) is private. Do you suggest me to add this method to nsIParser? Henri Sivonen (:hsivonen) (Not reading bugmail or doing reviews until 2016-10-03) 2012-11-13 00:06:03 PST (In reply to Frédéric Wang (:fredw) from comment #47) > nsContentUtils.cpp uses the nsIParser interface, but > > nsParser::Parse(const nsAString& aSourceBuffer, > void* aKey, > bool aLastCall) > > is private. Do you suggest me to add this method to nsIParser? Yes. :-( Henri Sivonen (:hsivonen) (Not reading bugmail or doing reviews until 2016-10-03) 2012-11-13 00:11:06 PST `Comment on attachment 680824 [details] [diff] [review] Add a method nsContentUtils::ParseDocumentXML >+ static nsresult ParseDocumentXML(const nsAString& aSourceBuffer, >+ nsIDocument* aTargetDocument, >+ bool aScriptingEnabledForNoscriptParsing); aScriptingEnabledForNoscriptParsing doesn’t really make sense in the context of XML, since XML parsing of

 Note You need to log in before you can comment on or make changes to this bug.


text:
# Recovering the nonlinear Schrödinger equation from its Lax pair

My question is less concerned with the physical aspects of the nonlinear Schrödinger equation and more with the mathematical mechanics of using a Lax pair.

I am considering how to recover the defocusing nonlinear Schrödinger equation $$iq_t + q_{xx} - 2|q|^2 q = 0$$ from its Lax pair. As I understand the equation arises from the requirement that the mixed second partials of the wave function must be equivalent which generates the requirement discussed in Lemma 1. $$\Psi(x,t,k)$$ is a 2x2 matrix.

$$\Psi_x + ik\sigma_3 \Psi = Q \Psi \text{ for } k \in \mathbb{C}$$ $$\Psi_t + 2ik^2 \sigma_3 \Psi = (2k Q - iQ_x \sigma_3 - i|q|^2 \sigma_3)\Psi$$

$$\sigma_3= \begin{pmatrix} 1 & 0 \\ 0 & -1 \end{pmatrix}$$

$$Q = \begin{pmatrix} 0 & q(x,t) \\ \overline{q}(x,t) & 0 \end{pmatrix}$$

The operators $$U$$ and $$V$$ are defined by the following equations. $${\Psi}_{{{x}}}={U}{\Psi}={\left({Q}-{i}{k}{\sigma}_{{{3}}}\right)}{\Psi}$$ $${\Psi}_{{{t}}}={V}{\Psi}={\left({2}{k}{Q}-{i}{Q}_{{{x}}}{\sigma}_{{{3}}}-{i}{\left|{q}\right|}^{{2}}{\sigma}_{{{3}}}-{2}{i}{k}^{{2}}{\sigma}_{{{3}}}\right)}\Psi$$

Lemma 1(Compatibility of the Lax Pair): Imposing the requirement on mixed partials yields the following relationship, $${\Psi}_{{{x}{t}}}={\Psi}_{{{t}{x}}}\Leftrightarrow{U}_{{{t}}}-{V}_{{{x}}}+{\left[{U},{V}\right]}={0}$$.

$${\Psi}_{{{x}{t}}}={U}_{{{t}}}{\Psi}+{U}{\Psi}_{{{t}}}$$

$${\Psi}_{{{t}{x}}}={V}_{{{x}}}{\Psi}+{V}{\Psi}_{{{x}}}$$

\begin{align} &{\Psi}_{{{x}{t}}}-{\Psi}_{{{t}{x}}}=\\ &{\left({U}_{{{t}}}-{V}_{{{x}}}\right)}{\Psi}+{U}{\Psi}_{{{t}}}-{V}{\Psi}_{{{x}}}= \\ &{\left({U}_{{{t}}}-{V}_{{{x}}}\right)}{\Psi}+{\left({U}{V}-{V}{U}\right)}{\Psi}= \\ &{\left({U}_{{{t}}}-{V}_{{{x}}}+{\left[{U},{V}\right]}\right)}{\Psi}= {0} \end{align}

The proof is concluded as biconditionality follows from algebraic equivalency.

Point of Difficulty: Substituting the original Lax pair into the condition $${U}_{{{t}}}-{V}_{{{x}}}+{\left[{U},{V}\right]}={0}$$ should yield the original nonlinear Schrödinger equation.

\begin{align} &{Q}_{{{t}}}-{2}{k}{Q}_{{{x}}}+{i}{Q}_{{{x}{x}}}{\sigma}_{{{3}}}+{i}{\sigma}_{{{3}}}{\left({\left|{q}\right|}^{{2}}\right)}_{{{x}}}+ {\left({Q}-{i}{k}{\sigma}_{{{3}}}\right)}{\left({2}{k}{Q}-{i}{Q}_{{{x}}}{\sigma}_{{{3}}}-{i}{\left|{q}\right|}^{{2}}{\sigma}_{{{3}}}-{2}{i}{k}^{{2}}{\sigma}_{{{3}}}\right)}- {\left({2}{k}{Q}-{i}{Q}_{{{x}}}{\sigma}_{{{3}}}-{i}{\left|{q}\right|}^{{2}}{}{\sigma}_{{{3}}}-{2}{i}{k}^{{2}}{\sigma}_{{{3}}}\right)}(Q -ik\sigma_3)= \\ &{Q}_{{{t}}}-{2}{k}{Q}_{{{x}}}+{i}{Q}_{{{x}{x}}}{\sigma}_{{{3}}}+{i}{\sigma}_{{{3}}}{\left({\left|{q}\right|}^{{2}}\right)}_{{{x}}}+{2}{k}{Q}^{{2}}- {i}QQ_{{{x}}}{\sigma}_{{{3}}}-{i}{\left|{q}\right|}^{{2}}{Q}{\sigma}_{{{3}}}-{2}{i}{k}^{{2}}{Q}{\sigma}_{{{3}}}-{2}{i}{k}^{{2}}{\sigma}_{{{3}}}{Q}-{k}{\sigma}_{{{3}}}{Q}{\sigma}_{{{3}}}-{k}{\left|{q}\right|}^{{2}}{{\sigma}_{{{3}}}^{{2}}}-{2}{k}^{{3}}{{\sigma}_{{{3}}}^{{2}}}-{2}{k}{Q}^{{2}}+{i}{Q}_{{{x}}}{\sigma}_{{{3}}}{Q}+{i}{\left|{q}\right|}^{{2}}{\sigma}_{{{3}}}{Q}+{2}{i}{k}^{{2}}{\sigma}_{{{3}}}{Q}+{2}{i}{k}^{{2}}{Q}{\sigma}_{{{3}}}+{k}{Q}{{\sigma}_{{{3}}}^{{2}}}+{k}{\left|{q}\right|}^{{2}}{{\sigma}_{{{3}}}^{{2}}}+{2}{k}^{{3}}{{\sigma}_{{{3}}}^{{2}}}= \\ & {Q}_{{{t}}}-{2}{k}{Q}_{{{x}}}+{i}{Q}_{{{x}{x}}}{\sigma}_{{{3}}}+{i}{\sigma}_{{{3}}}{\left({\left|{q}\right|}^{{2}}\right)}_{{{x}}}+{i}{\left[{Q}_{{{x}}}{\sigma}_{{{3}}},{Q}\right]}+{i}{\left|{q}\right|}^{{2}}{\left[{\sigma}_{{{3}}},{Q}\right]}+{2}{i}{k}^{{2}}{\left[{\sigma}_{{{3}}},{Q}\right]}+{2}{i}{k}^{{2}}{\left[{Q},{\sigma}_{{{3}}}\right]}+{k}{\left[{Q}{\sigma}_{{{3}}},{\sigma}_{{{3}}}\right]}= \\ & {Q}_{{{t}}}-{2}{k}{Q}_{{{x}}}+{i}{\left\lbrace{Q}_{{{x}{x}}}{\sigma}_{{{3}}}+{\sigma}_{{{3}}}{\left({\left|{q}\right|}^{{2}}\right)}_{{{x}}}+{\left[{Q}_{{{x}{x}}}{\sigma}_{{{3}}},{Q}\right]}+{\left({\left|{q}\right|}^{{2}}\right)}{\left[{\sigma}_{{{3}}},{Q}\right]}+{k}{\left[{Q}{\sigma}_{{{3}}},{\sigma}_{{{3}}}\right]}\right\rbrace}=\\ &\dots \text{ I do not understand how to proceed.} \end{align}

• Hello! I think that 1) you would find it helpful to organize your computations into pieces rather than doing it all at once, 2) there appears to be a typo for your V - the term involving |q|^2 is missing a factor of 1/2, and 3) you forgot to capitalize U_t and V_x in the lemma and its proof. May 13, 2021 at 10:41
• Thank you, I fixed the capitalization issue. I'm sorry, I don't follow what you mean with "$|q|^2$ in $V$ is missing a factor of $\frac{1}{2}$". Do you want me to define $V(x)=2kQ-iQ_{x}\sigma_3 - i \frac{1}{2}|q|^2 \sigma_3 - 2ik^2 \sigma_3$? Thanks again May 13, 2021 at 17:14
• Yeah! At least, when I worked out some details that was my conclusion. It's perhaps worth trying again with that new V. If it still doesn't work out, I'll gladly double-check my scratch notes and, if correct, post an answer with more detail. May 13, 2021 at 17:51
• Yes, please! I would appreciate any help regarding the problem. Yesterday, I found the following article which provides a parallel development of the problem on page 4. The author states that it is possible but does not provide the particulars of proving it. Thank you again. iopscience.iop.org/article/10.1088/0951-7715/18/4/019 May 13, 2021 at 18:57

Okay, here's the computation in detail. Really, this is a straightforward bracket computation, though it appears my comment earlier about a factor of 1/2 was in error (oops!) so no need to make a correction about that in your post.

The Lie bracket of $$U$$ with $$V$$ is a combination of the non-trivial Lie brackets: $$[Q,Q_x\sigma_3],\,[Q,\sigma_3],$$ and $$[\sigma_3, Q_x\sigma_3]$$. In order to compute these brackets we'll write out the relevant matrix products:

\begin{equation*} \begin{aligned} Q_x\sigma_3&=\begin{pmatrix} 0 & -q_x\\ \bar{q}_x & 0\end{pmatrix},\\ QQ_x\sigma_3&=\begin{pmatrix}q\bar{q}_x & 0\\ 0 & -q_x\bar{q} \end{pmatrix},\\ Q_x\sigma_3Q&=\begin{pmatrix}-q_x\bar{q} & 0\\ 0 & \bar{q}_xq \end{pmatrix},\\ [Q,Q_x\sigma_3]&=\begin{pmatrix} q\bar{q}_x+q_x\bar{q} & 0\\ 0 & -(q_x\bar{q}+\bar{q}_xq) \end{pmatrix},\\ \,&=|q|^2_x\sigma_3. \end{aligned} \end{equation*}

Also, notice that left multiplication by $$\sigma_3$$ of a $$2\times 2$$ matrix $$A$$ returns $$A$$ with negative the bottom row and right multiplication by $$\sigma_3$$ of $$A$$ returns $$A$$ but with negative 2nd column. Thus,

\begin{equation*} \begin{aligned} \left[Q,\sigma_3\right]&=\begin{pmatrix} 0 & -2q\\ 2\bar{q} & 0\end{pmatrix},\\ [\sigma_3,Q_x\sigma_3]&=\sigma_3Q_x\sigma_3-Q_x,\\ &=\begin{pmatrix} 0 & -2q_x\\ -2\bar{q}_x & 0 \end{pmatrix},\\ &=-2Q_x. \end{aligned} \end{equation*}

Now, looking at the Lie bracket of $$U$$ and $$V$$ we find \begin{equation*} \begin{aligned} \left[U,V\right]&=\left[Q-ik\sigma_3,\,2kQ-iQ_x\sigma_3-i|q|^2\sigma_3-2ik^2\sigma_3\right],\\ \,&=-i\left[Q, Q_x\sigma_3\right]-i(|q|^2+2k^2)\left[Q,\sigma_3\right]+2ik^2\left[Q,\sigma_3\right]-k\left[\sigma_3,Q_x\sigma_3\right],\\ &=-i|q|^2_x\sigma_3-i|q|^2\begin{pmatrix} 0 & -2q\\2\bar{q} & 0\end{pmatrix}+2kQ_x. \end{aligned} \end{equation*} So, in combination with the derivatives \begin{equation*} \begin{aligned} U_t&=Q_t,\\ V_x&=2kQ_x-iQ_{xx}\sigma_3-i|q|^2_x\sigma_3, \end{aligned} \end{equation*} we find that \begin{equation*} \begin{aligned} U_t-V_x+\left[U,V\right]&=Q_t+iQ_{xx}\sigma_3-i|q|^2\begin{pmatrix} 0 & -2q\\2\bar{q} & 0\end{pmatrix}\\ &=\begin{pmatrix} 0 & q_t-iq_{xx}+2i|q|^2q\\ \bar{q}_t-i\bar{q}_{xx}-2i|q|^2\bar{q} & 0 \end{pmatrix}. \end{aligned} \end{equation*}

Remark: The version of the Lax pair formulation you see in this problem with $$U_t-V_x+\left[U,V \right]=0$$ may also be referred to as a "zero curvature condition" and is slightly different from, but equivalent to, the Lax eqaution $$L_t=[B,L]$$ for appropriately chosen $$L$$ and $$B$$ operators.

format: plain


text:
# Graph f and g in the same rectangular coordinate system. Use transformations of the graph f of to obtain the graph of g. Graph and give equations of all asymptotes. Use the graphs to determine each function's domain and range.f(x)=2^{x} text{and} g(x)=2^{x-1}

Graph f and g in the same rectangular coordinate system. Use transformations of the graph f of to obtain the graph of g. Graph and give equations of all asymptotes. Use the graphs to determine each function's domain and range.

You can still ask an expert for help

• Questions are typically answered in as fast as 30 minutes

Solve your problem for the price of one coffee

• Math expert for every subject
• Pay only if we can solve it

Step 1 Graph of g(x) can be obtained by translating the graph of f(x) by 1 unit tp the right along the x-axis. Domain of f(x) is $x\in \left(-\mathrm{\infty },\mathrm{\infty }\right)$ Range of f(x) is $\left(0,\mathrm{\infty }\right)$ Asympote for the graph is $y=0$ Domain of $g\left(x\right)=x\in \left(-\mathrm{\infty },\mathrm{\infty }\right)$ Range of $g\left(x\right)=\left(0,\mathrm{\infty }\right)$ Asympote for the graph is $y=0$


text:
#### Volume 6, issue 4 (2006)

 Recent Issues
 The Journal About the Journal Editorial Board Subscriptions Editorial Interests Editorial Procedure Submission Guidelines Submission Page Ethics Statement ISSN (electronic): 1472-2739 ISSN (print): 1472-2747 Author Index To Appear Other MSP Journals
Small genus knots in lens spaces have small bridge number

### Kenneth L Baker

Algebraic & Geometric Topology 6 (2006) 1519–1621
 arXiv: math.GT/0612427
##### Abstract

In a lens space $X$ of order $r$ a knot $K$ representing an element of the fundamental group ${\pi }_{1}X\cong ℤ∕rℤ$ of order $s\le r$ contains a connected orientable surface $S$ properly embedded in its exterior $X-N\left(K\right)$ such that $\partial S$ intersects the meridian of $K$ minimally $s$ times. Assume $S$ has just one boundary component. Let $g$ be the minimal genus of such surfaces for $K$, and assume $s\ge 4g-1$. Then with respect to the genus one Heegaard splitting of $X$, $K$ has bridge number at most $1$.

##### Keywords
(1,1)–knots, Berge knots, bridge position, lens space, Scharlemann cycle, thin position
Primary: 57M27
Secondary: 57M25


text:
### Ramanujan Graphs and the Random Reducibility of Discrete Log on Isogenous Elliptic Curves

David Jao, Stephen D. Miller, and Ramarathnam Venkatesan

##### Abstract

Cryptographic applications using an elliptic curve over a finite field filter curves for suitability using their order as the primary criterion: e.g. checking that their order has a large prime divisor before accepting it. It is therefore natural to ask whether the discrete log problem (DLOG) has the same difficulty for all curves with the same order; if so it would justify the above practice. We prove that this is essentially true by showing random reducibility of dlog among such curves, assuming the Generalized Riemann Hypothesis (GRH). Our reduction proof works for curves with (nearly) the same endomorphism rings, but it is unclear if such a reduction exists in general. This suggests that in addition to the order, the conductor of its endomorphism ring may play a role. The random self-reducibility for dlog over finite fields is well known; the non-trivial part here is that one must relate non-isomorphic algebraic groups of two isogenous curves. We construct certain expander graphs with elliptic curves as nodes and low degree isogenies as edges, and utilize the rapid mixing of random walks on this graph. We also briefly look at some recommended curves, compare “random” type NIST FIPS 186-2 curves to other special curves from this standpoint, and suggest a parameter to measure how generic a given curve is.

Available format(s)
Category
Foundations
Publication info
Published elsewhere. Unknown where it was published
Keywords
random reducibilitydiscrete logelliptic curvesisogeniesmodular formsL-functionsgeneralized Riemann hypothesisRamanujan graphsexpandersrapid mixing
Contact author(s)
miller @ math rutgers edu
History
Short URL
https://ia.cr/2004/312

CC BY

BibTeX

@misc{cryptoeprint:2004/312,
author = {David Jao and Stephen D.  Miller and Ramarathnam Venkatesan},
title = {Ramanujan Graphs and the Random Reducibility of Discrete Log on Isogenous Elliptic Curves},
howpublished = {Cryptology ePrint Archive, Paper 2004/312},
year = {2004},
note = {\url{https://eprint.iacr.org/2004/312}},
url = {https://eprint.iacr.org/2004/312}
}

Note: In order to protect the privacy of readers, eprint.iacr.org does not use cookies or embedded third party content.


text:
It is currently 31 Oct 2020, 12:12

### GMAT Club Daily Prep

#### Thank you for using the timer - this advanced tool can estimate your performance and suggest more practice questions. We have subscribed you to Daily Prep Questions via email.

Customized
for You

we will pick new questions that match your level based on your Timer History

Track

every week, we’ll send you an estimated GMAT score based on your performance

Practice
Pays

we will pick new questions that match your level based on your Timer History

# x = 3.635 • 10^16

Author Message
TAGS:
Founder
Joined: 18 Apr 2015
Posts: 13722
GRE 1: Q160 V160
Followers: 305

Kudos [?]: 3553 [0], given: 12692

x = 3.635 • 10^16 [#permalink]  15 Apr 2018, 09:55
Expert's post
00:00

Question Stats:

93% (00:23) correct 6% (00:07) wrong based on 31 sessions

$$x = 3.635 * 10^{16}$$

 Quantity A Quantity B $$\frac{x+1}{x-1}$$ $$\frac{x-1}{x+1}$$

A. The quantity in Column A is greater
B. The quantity in Column B is greater
C. The two quantities are equal
D. The relationship cannot be determined from the information given
[Reveal] Spoiler: OA

_________________

- Do you want all the GRE Prep Club resources at a glance (sort of ) ?? Look at GRE Prep Club Official LinkTree page
- Do you want all the GRE Prep Club FREE resources in one spot ?? Look at Free GRE Materials - Where to get it!! (2020)
- Do you want all the FREE GRE tests on earth ?? Look at FREE GRE Practice Tests [Collection] - New Edition (2021)
- Do you want to know the GRE score in the Top 25 BS in 7 continents ?? Look at here The GRE average score at Top 25 Business Schools 2020 Ed.
- Need Practice 20 Free GRE Quant Tests available for free with 20 Kudos
- GRE Prep Club Members of the Month: Each member of the month will get three months free access of GRE Prep Club tests.

Manager
Joined: 29 Nov 2017
Posts: 190
Location: United States
GRE 1: Q142 V146
WE: Information Technology (Computer Software)
Followers: 1

Kudos [?]: 94 [1] , given: 99

Re: x = 3.635 • 10^16 [#permalink]  16 May 2018, 02:21
1
KUDOS
option A is the correct answer because when x is added 1 and divided with X-1 the QUOTIENT will be bigger to the QUOTIENT when X-1 is divided with X+1.

hence option A.

this question simply test our fundamental of quotient.
Intern
Joined: 27 Nov 2014
Posts: 30
Followers: 0

Kudos [?]: 5 [1] , given: 0

Re: x = 3.635 • 10^16 [#permalink]  25 Sep 2018, 02:17
1
KUDOS
3635 * 10^12, this is how we can rewrite the question, is so big compared to 1 so that adding or subtracting 1 from it won't make much difference.
Re: x = 3.635 • 10^16   [#permalink] 25 Sep 2018, 02:17
Display posts from previous: Sort by


text:
# How do you solve for b in ab=c?

May 6, 2018

$b = \frac{c}{a}$

#### Explanation:

$a b = c$

To solve for $b$, we have to make it by itself. To do so, let's divide both sides by $\textcolor{b l u e}{a}$:
$\frac{a b}{\textcolor{b l u e}{a}} = \frac{c}{\textcolor{b l u e}{a}}$

$\frac{\cancel{a} b}{\cancel{\textcolor{b l u e}{a}}} = \frac{c}{a}$

$b = \frac{c}{a}$


text:
• 0 Vote(s) - 0 Average
• 1
• 2
• 3
• 4
• 5
 book: the theory of fractional powers of operators bo198214 Administrator Posts: 1,386 Threads: 90 Joined: Aug 2007 01/13/2009, 09:13 PM I just found out that there is this interesting book about fractional powers of operators. Maybe it can be useful for our purposes. For example on can consider the infinite Carlemann-matrix of $\exp$ to be an operator (which is the infinite version of our matrix power method). However I didnt have a look into the book yet, so I dont know what they for example say about uniqueness etc. « Next Oldest | Next Newest »

 Messages In This Thread book: the theory of fractional powers of operators - by bo198214 - 01/13/2009, 09:13 PM RE: book: the theory of fractional powers of operators - by Gottfried - 06/20/2010, 06:00 AM RE: book: the theory of fractional powers of operators - by Ztolk - 06/22/2010, 07:30 PM

 Possibly Related Threads... Thread Author Replies Views Last Post Math overflow question on fractional exponential iterations sheldonison 4 2,990 04/01/2018, 03:09 AM Last Post: JmsNxn Hyper operators in computability theory JmsNxn 5 3,364 02/15/2017, 10:07 PM Last Post: MphLee Recursive formula generating bounded hyper-operators JmsNxn 0 1,305 01/17/2017, 05:10 AM Last Post: JmsNxn Rational operators (a {t} b); a,b > e solved JmsNxn 30 35,064 09/02/2016, 02:11 AM Last Post: tommy1729 holomorphic binary operators over naturals; generalized hyper operators JmsNxn 15 15,169 08/22/2016, 12:19 AM Last Post: JmsNxn The bounded analytic semiHyper-operators JmsNxn 2 3,223 05/27/2016, 04:03 AM Last Post: JmsNxn Set theory debate : cantor 1st / Virgil argument. tommy1729 1 1,745 12/08/2015, 11:14 PM Last Post: tommy1729 Bounded Analytic Hyper operators JmsNxn 25 17,801 04/01/2015, 06:09 PM Last Post: MphLee [2015] Spiderweb theory tommy1729 0 1,650 03/29/2015, 06:25 PM Last Post: tommy1729 Mizugadro, pentation, Book Kouznetsov 41 39,965 03/02/2015, 08:13 PM Last Post: sheldonison

Users browsing this thread: 1 Guest(s)


text:
Size of Linearly Independent Subset is at Most Size of Finite Generator/Proof 3

Theorem

Let $R$ be a division ring.

Let $V$ be an $R$-vector space.

Let $F \subseteq V$ be a finite generator of $V$ over $R$.

Let $L \subseteq V$ be linearly independent over $R$.

Then:

$\size L \le \size F$

Proof

Let $\alpha_1, \alpha_2, \ldots, \alpha_n$ be a generator of $V$.

Let $\xi_1, \xi_2, \ldots, \xi_r$ be a linearly independent set of elements of $V$.

Hence the sequence $\sequence {\xi_1, \alpha_1, \alpha_2, \ldots, \alpha_n}$ is a linearly dependent sequence of elements of $V$.

One of these elements, which cannot be $\xi_1$, is a linear combination of the preceding elements.

Let this elements be $\alpha_i$.

So we can omit $\alpha_i$ from that sequence, and the remaining set is still a generator of $V$.

Therefore $\xi_2$ is a linear combination of these.

Thus $\sequence {\xi_2, \xi_1, \alpha_1, \alpha_2, \ldots, \alpha_{i - 1}, \alpha_{i + 1}, \ldots, \alpha_n}$ is a linearly dependent sequence of elements of $V$.

Again, one of them is a linear combination of the preceding elements.

This cannot be $\xi_2$, as $\xi_2$ has no preceding elements.

Neither can it be $\xi_1$, as $\xi_1$ and $\xi_2$ are linearly independent.

Thus we can omit whichever $\alpha_j$ it is, and we have a new set which is a generator of $V$.

This consists of $\xi_1$, $\xi_2$ and whichever $n - 2$ of the remaining elements of $\set {\alpha_1, \alpha_2, \ldots, \alpha_n}$.

After $p$ such steps, we have a set which is a generator of $V$ which consists of:

$\xi_1, \xi_2, \ldots, \xi_p$ and $n - p$ of the elements of $\set {\alpha_1, \alpha_2, \ldots, \alpha_n}$.

Aiming for a contradiction, suppose suppose $n < r$.

Then when $p = n$, the remaining set which is a generator of $V$ consists of:

$\xi_1, \xi_2, \ldots, \xi_n$

and there is at least one more element $\xi_{n + 1}$.

This is a linear combination of $\set {\xi_1, \xi_2, \ldots, \xi_n}$.

But this contradicts the supposition that $\set {\xi_1, \xi_2, \ldots, \xi_n, \xi_{n + 1} }$ is a linearly independent set.

Hence, by Proof by Contradiction, $n \ge r$.

The result follows.

$\blacksquare$


text:
[IMG][/IMG]

2. ## Re: solving equation

This equation has already been solved for you, it seems. What is the actual question?

3. ## Re: solving equation

Sorry ,replace 0 in right hand by x

4. ## Re: solving equation

The equation is $\frac{12+144+20+3\sqrt{4}}{7}+5 \times 11 = 9^2+x$.

1) Subtract $9^2$ from both sides.

2)Simplify the L.H.S


text:
# How to collect all states of a behavior in TLA+?

Description of the problem:

I am modeling checking a distributed protocol against a global property with TLA+ developed by Leslie Lamport. The global property is defined on all states of a behavior (more details can be found below). However, by the nature of exhaustive enumeration of model checking, the state transition graph explored consists of all states of all behaviors. How should I collect all states of each behavior against which the global property can be checked?

More on the global property:

Consider an implementation of a replicated list object. The property requires that for any two list states, e.g., $l_1$ and $l_2$, across the whole system, if they contain two common elements such as $a$ and $b$, then $a$ precedes $b$ in $l_1$ if and only if $a$ precedes $b$ in $l_2$.

My solution is to check this property against each behavior. This requires to collect all states of a behavior. Is this feasible? Are there better solutions?

Note: This is a re-post.

## 1 Answer

An answer from Stephan Merz at tlaplus-googlegroup:

In a linear-time framework such as TLA+, a system satisfies a property if the property holds of all system behaviors, and from your description it appears to me that this is what you want. TLC will compute all states that are reachable in your system and evaluate the property over all behaviors: there is nothing that you need to do explicitly.

The potential problem with this is that your system may have a lot of states, and TLC may not finish computing the entire state graph (or at least not in a reasonable amount of time). The TLA+ literature and resources give much advice for working around this problem, in short, you will want to choose small parameters and perhaps constrain the set of states considered by TLC using a state constraint (in the advanced options pane of the Toolbox interface).


text:
Average the values of a vector f(x,y) in bins defined on vectors x and y. A common example might be averaging spatial data into location bins.

binMean2D(
x,
y,
f,
xbreaks,
ybreaks,
flatten = FALSE,
fill = FALSE,
fillgap = -1
)

## Arguments

x vector of numerical values. vector of numerical values. Matrix of numerical values, a matrix f=f(x,y). Vector of values of x at the boundaries between bins, calculated using pretty(x) if not supplied. Vector of values of y at the boundaries between bins, calculated using pretty(y) if not supplied. A logical value indicating whether the return value also contains equilength vectors x, y, z and n, a flattened representation of xmids, ymids, result and number. Logical value indicating whether to fill NA-value gaps in the matrix. Gaps will be filled as the average of linear interpolations across rows and columns. See fillgap, which works together with this. Integer controlling the size of gap that can be filled across. If this is negative (as in the default), gaps will be filled regardless of their size. If it is positive, then gaps exceeding this number of indices will not be filled.

## Value

A list with the following elements: the midpoints (renamed as x and y), the count (number) of f(x,y) values for x and y values that lie between corresponding breaks, and the resultant average (f) of f(x,y), classified by the x and y breaks.

Other bin-related functions: binApply1D(), binApply2D(), binAverage(), binCount1D(), binCount2D(), binMean1D()

## Examples

library(oce)
x <- runif(500)
y <- runif(500)
f <- x + y
xb <- seq(0, 1, 0.1)
yb <- seq(0, 1, 0.2)
m <- binMean2D(x, y, f, xb, yb)
plot(x, y)contour(m$xmids, m$ymids, m\$result, add=TRUE, levels=seq(0, 2, 0.5), labcex=1)


text:
Search by keywords or author
• Vol. 3, Issue 2, 026002 (2021)
Author Affiliations
• 1City University of New York, Advanced Science Research Center, Photonics Initiative, New York, United States
• 2City University of New York, Graduate Center, Physics Program, New York, United States
• show less

Abstract

Fano resonances are conventionally understood as sharp spectral features with selectivity in the momentum-frequency domain, implying that they can be excited only by plane waves with specific frequencies and incident angles. We demonstrate that Fano resonances can be made generally selective in the space-frequency domain. They can be tailored to resonate only when excited by a frequency, polarization, and wavefront of choice. This generalization reveals that Fano systems are characterized by eigenwaves that scatter to their time-reversed image upon reflection. Although in conventional Fano systems this trivially occurs for normally incident plane waves, we show that, in general, the selected wavefront is locally retroreflected everywhere across the device. These results show that conventional Fano resonances are a subset of a broader dichroic phenomenon with spin, spatial, and spectral selectivity. We demonstrate these concepts with nonlocal metasurfaces whose governing principles are deeply rooted in the symmetry features of quasi-bound states in the continuum. Enhanced light–matter interactions and symmetry-protection make these phenomena uniquely suited for enriching applications in quantum optics, non-linear optics, augmented reality, and secure optical communications, laying the groundwork for a range of novel compact optical sources and devices.

1 Introduction

Optical Fano resonance is a phenomenon born of interference between a discrete (dark) state and a broad (bright) continuum of states. Observed in many photonic systems,1 it is characterized by an asymmetric lineshape originally described by Fano in 1961.2 Wood’s anomaly is a prominent early example of such a phenomenon, wherein sharp resonant features were observed in the spectra of super-wavelength metallic gratings at discrete angles and frequencies at which diffractive orders emerge.3,4 Modern micro- and nano-technology has enabled subwavelength patterning of surfaces that exhibit more complex Fano resonant responses. For instance, in weakly corrugated dielectric slabs, weak coupling of light to a discrete waveguide mode can interfere with strong coupling to a broadband thin-film resonance, enabling a guided mode resonance.5 Such devices behave as notch filters, selective to a specific combination of angles and frequencies that track the dispersion of the underlying waveguide mode.6,7 Similar responses are observed in photonic crystal slabs and strongly corrugated gratings,8 well-modeled by temporal coupled mode theory that can accurately predict the Fano lineshape.9

In specific cases, the linewidth of these resonant modes may vanish in such periodic systems, implying that their radiative lifetime becomes infinite and the mode becomes a bound state in the continuum (BIC).10,11 When this suppression of coupling to radiation is due to symmetry-protection,12 applying a perturbation that breaks the relevant symmetry introduces radiative coupling, yielding a quasi-bound state in the continuum (q-BIC) responsible for a Fano resonance whose linewidth is directly controlled by the perturbation.13,14 Due to their origin lying in symmetries, q-BICs are broadly applicable across many geometries and material systems and have been rapidly emerging as a powerful rationally designed platform leveraging enhanced-light–matter interactions15 to advance planarized optical modulators,16 biological sensors,17 and compact non-linear optical devices.18,19

As with other Fano resonant systems, q-BICs have been commonly studied in infinitely periodic photonic crystal slabs with subwavelength periodicity, affording two notable simplifications: (i) the presence of a single diffraction order, into which the supported dark and bright modes may interfere, and (ii) a natural description in momentum-frequency space. In such systems, the peak reflectance is unity in the absence of optical loss,20 a marker of complete interference between the bright and dark modes, and the Fano resonance can be observed only for incident plane waves matching the underlying band structure in both momentum (angular selectivity) and frequency (spectral selectivity). The polarization properties are governed by selection rules14 that specify whether the excitation of a q-BIC may be forbidden or allowed according to the space group of the perturbed symmetry. Notably, a metasurface patterned in a way to retain only twofold rotation symmetries after perturbation, i.e., having a p2 space group, may couple a q-BIC to any designer linear polarization angle with arbitrary lifetime.14,21 By introducing suitable out-of-plane symmetry-breaking perturbations, q-BICs can also extend circularly dichroic Fano resonances2225 to exhibit arbitrary elliptical dichroism.26 These systems thereby exhibit rationally tailorable selectivity to polarization, momentum, and frequency rooted in symmetry breaking.

Recently, Fano resonant metasurfaces capable of shaping the wavefront of light at resonance have been demonstrated based on the symmetry features of q-BICs.14,21,2628 In Ref. 21, it was demonstrated that the orientable linear dichroism afforded by the p2 space group can carry a geometric phase when excited by circular polarization. The local response to a linear polarization of choice may, therefore, be spatially varied, locally imparting a controlled geometric phase due to scattering from the nonlocal q-BIC mode. As a result, aperiodic functionalities, such as frequency-selective focusing of incident light, can be demonstrated using this technique,27,28 but with efficiencies fundamentally limited by the achirality of the underlying structure. Incident circular polarization is not the selected polarization state at any point across the surface; therefore, the functionality of these systems is afforded by an incomplete projection of the incoming polarization to the locally selected states. In Ref. 26, this limitation was addressed by introducing chiral perturbations that can select purely circularly polarized states. Here, the metasurface operation of interest can be implemented with unity efficiency by locally varying the orientation of the selected circular polarization (a degeneracy of the poles of the Poincaré sphere). Although this functionality was enabled only in strictly periodic structures in Ref. 26 so far, the earlier results demonstrating frequency selective wavefront-shaping based on linearly polarized q-BICs suggest that the usual description of these systems in the momentum-frequency domain is insufficient.

In this paper, we expand the concept of Fano resonant metasurfaces to sustain arbitrarily varying spatial profiles and arbitrary polarization states. We achieve this feature in aperiodic metasurfaces that exhibit the frequency selectivity of conventional Fano resonance metasurfaces and, at the same time, the wavefront-shaping functionality traditionally found in phase-manipulating metasurfaces based on geometric phase concepts.2933 At first glance, this combination of features is surprising and counterintuitive, because the former is a highly nonlocal phenomenon (the optical response at each position has significant contributions from distant positions), whereas the latter is explicitly conceived as enabled by a local response, ignoring interactions from other unit cells.30 We resolve this apparent challenge by showing that the conventionally studied Fano metasurfaces, offering momentum-frequency selectivity, are a limited subset of a more general dichroic nonlocal phenomenon that supports space-frequency selectivity. In other words, we show that the chiral q-BICs introduced in Ref. 26 can establish a general platform for metasurfaces that fully resonate only for specific frequencies, incoming wavefronts, and polarization of choice. Due to their periodicity, the resonant wavefront in conventional Fano metasurfaces is limited to plane waves, whereas in our generalized form of Fano metasurfaces, we find that the selected wavefront can be arbitrarily tailored by symmetry breaking across the device. The selected wavefront of choice is resonantly transformed into its time-reversed copy upon reflection, implying that the reflection process preserves handedness in stark contrast to conventional specular reflection. Due to this property of preserving handedness, we name this wavefront the principal “eigenwave” of our Fano metasurfaces. We show that this eigenwave is the incident wavefront that excites the band-edge mode of the unperturbed periodic photonic crystal slab to which the spatial perturbation is applied, i.e., while different perturbation profiles establish distinct eigenwaves, in each case the eigenwave excites the same q-BIC mode profile. Based on these principles, we demonstrate metasurfaces offering unprecedented new functionalities: first, we show that in the case of a linear gradient of geometrical phase, the eigenwave is retroreflected with preserved spin angular momentum (SAM). Next, we demonstrate a chiral nonlocal metasurface lens that strongly reflects only when illuminated by a circularly polarized spherical wave originating from twice the focal distance. Finally, we show chiral q-BIC metasurfaces with azimuthally varying phase gradients, supporting a Fano resonance that is selective to the orbital angular momentum (OAM) of incident light. In this scenario, the eigenwave is a vortex beam reflected with preserved SAM and OAM. We finally discuss the implications of these findings for a variety of nanophotonic applications, from secure communications to thermal emission engineering.

2 Methods

To begin, we compare a conventional periodic Fano metasurface to the proposed aperiodic geometry. As noted above, a conventional periodic Fano device is known to support strong polarization and spectral and angular selectivity. Its resonant response is characterized by an eigenpolarization, which, in cases without birefringence, can be defined as the polarization for which (i) a maximum Fano resonant response is achieved and (ii) the reflected wave has the same polarization state, i.e., it is the eigenvector of the reflection-side Jones matrix with near-unity eigenvalue at resonance. As depicted in Fig. 1(a), when illuminated by normally incident light at resonance matching the eigenpolarization (limited to linear polarizations), a standing wave q-BIC, corresponding to the band-edge mode in reciprocal space, is excited everywhere across the device, and the incident wave is completely reflected. When illuminated by a spatially varying wavefront composed of many plane waves [Fig. 1(b)], the band-edge mode cannot be uniformly excited (if at all), the spectral resonance feature is lost, and little (if any) light is reflected.

Figure 1.Spin, spectral, and spatial selectivity in Fano metasurfaces. (a) A conventional Fano resonant metasurface with spectral and angular selectivity supports a band-edge mode that is maximally Fano resonant for $x$ polarized light at normal incidence. (b) When an arbitrary wavefront is incident on it, no distinct spectral feature can be found, and the wave is primarily transmitted with little distortion. In this case, the band-edge mode is not excited. (c) Proposed metasurface with spin, spectral, and spatial selectivity, yielding a band-edge mode maximally Fano resonant for RCP light with a specifically tailored wavefront. (d) When an arbitrary plane wave is incident, no distinct spectral feature can be observed, and light is primarily transmitted with little distortion.

In contrast, the proposed chiral aperiodic q-BIC metasurface introduced here supports a resonant mode with arbitrarily tailored spin, spectral, and wavefront selectivity. In this case [Fig. 1(c)], a designer wavefront excites with maximum efficiency the band-edge mode everywhere across the device, and light is reflected to an identical wavefront propagating in the opposite direction only for the chosen spin and resonant frequency. When excited by another wavefront, such as a plane wave at arbitrary incidence, the band-edge mode is not uniformly excited (if at all), the spectral feature is lost, and little (if any) light is reflected [Fig. 1(d)]. In the following, we outline the conditions to realize such an aperiodic metasurface supporting an incident wavefront of choice that is (i) maximally Fano resonant and (ii) reflected with preserved handedness.

Before demonstrating aperiodic devices, we begin by numerically studying the eigenwaves in the simplest case of a periodic phase gradient Fano metasurface. In order to design the structure, we use the unit cells introduced in Ref. 26, which are discussed in more detail in Sec. S1 in the Supplemental Materials. In particular, we consider metasurfaces comprising two stacked planarized layers with chiral perturbations in their unit cells, and we compare the case without a spatial phase gradient of these perturbations [Fig. 2(a)], serving as a reference case, and the case with a gradient in the $x$ direction [Fig. 2(b)]. Sitting on a substrate with $n1=1.45$, the metasurfaces are realized in thin films with $n2=3.45$ etched by elliptical holes with dimensions of $80 nm×340 nm$ spaced with pitch of $a=400 nm$. The ellipses are filled with the superstrate material, $n3=n1$. As shown in Fig. 2(c), each unit cell has two ellipses per layer: in the first layer, they are oriented by angles $α$ and $α+90 deg$, whereas, in the second layer, they are oriented by angles $α+Δα$ and $α+Δα+90 deg$. Section S1 in the Supplemental Materials provides additional details on the rationale for this unit cell geometry and for their characterization. Although our focus here is on the expansion of the theoretical concept of Fano resonant metasurfaces, we emphasize that the fabrication of this planarized layer stack is compatible within standard nano-fabrication techniques at optical frequencies31,32 or standard approaches in the microwave regime.34 We propose a possible fabrication procedure in Sec. S2 in the Supplemental Materials based on extending recent efforts demonstrating single-layer q-BIC metasurfaces,19,27,28 and we study the influence of misalignment of the two layers in Sec. S3 in the Supplemental Materials, concluding that standard tolerances more than suffice to demonstrate these concepts in the near-infrared.

Figure 2.Eigenwaves of linear phase gradient resonant metasurfaces. (a), (b) Schematics of chiral PCSs without and with a phase gradient. The substrate and superstrate are omitted for clarity. (c) Top view of a chiral meta-unit of the devices [dashed rectangle in (a)]. (d) Band diagrams: the solid black band refers to the device in (a) and the solid orange band for (b). Black and orange markers denote the devices in (a) and (b), and circles denote the eigenwaves. (e)–(h) Far-field projections near the resonant wavelengths for incident RCP plane waves with momenta marked in (d). The anomalous reflection in (f) is to an angle of 20.1 deg, and the incident angle for (g) and (h) is 9.89 deg (half the momentum of the anomalous reflection). The color map tracks $2χ$ of the output polarization state, demonstrating that light resonantly reflects with preserved spin. When the eigenwave (e), (h) is incident, retroreflection occurs, indicating preservation of handedness. (i), (j) Field profiles on the resonance for each case [fields are shown at the bottom interface of the devices in (a) and (b)].

$⟨e|R⟩2|R*⟩=ei4α|R*⟩.$A spatially varying $α(x,y)$ results in a device that anomalously reflects normally incident plane waves only for the resonant frequency.26

$Eout(x,y)=A(x,y)e−iΦin(x,y)e−ikzz|R*⟩=Ein*(x,y).$Hence the output wavefront is the time-reversed copy of the input wavefront, and $Ein$ is the eigenwave of the q-BIC metasurface. Interestingly, with this strategy, we can pattern arbitrary wavefronts into becoming the eigenwaves of our Fano metasurface, with exciting opportunities for augmented reality and secure communications, since the response of interest is excited exclusively when the specific spin, frequency, and wavefront distribution illuminates the metasurface. In the following, we confirm these predictions by numerically studying the metasurfaces in Figs. 2(a) and 2(b) when illuminated by two plane waves, each an eigenwave of one of the devices. We then apply these ideas to metalenses and vortex-beam metasurfaces. We use the full-wave finite difference time domain method (Lumerical Solutions) for all numerical results in this work.

3 Results

$ωres(kx)=ω0+b2kx2,$where $ω0$ is the band-edge frequency, and $b$ is a measure of the band curvature near $kx=0$. The far-field optical response due to light at normal incidence from the substrate side is seen in Fig. 2(e), showing direct reflection of the resonant light with the same RCP polarization state (red). In contrast, the non-resonant light (which mostly transmits) reflects with inverted spin (blue), as expected. The q-BIC field profile is simply $Hz0(x,y)$, as shown in Fig. 2(i). (Note that throughout we depict these field profiles at the bottom interface of each device.)

$ωres(kx)=ω0+b2(kx+kG)2.$Comparing Eqs. (7) and (11), the eigenwave of the device in Fig. 2(b) must cancel this exponential factor, and so it must be a planewave with wavevector $−kG$ and frequency $ω0$.

$Eout(x,y)=e−ikGei2kGe−ikzz|R*⟩=eikGe−ikzz|R*⟩,$implying that resonant light is retroreflected [Fig. 2(h)] with preserved spin. Non-resonant light is specularly reflected with inverted spin, as expected. Figure 2(l) shows that the q-BIC mode profile is indeed $Hz0(x,y)$, consistent with Eq. (7). Since this mode is excited by wavevector $−kG$, but is identical to the one marked by the black circle in Fig. 2(d), it corresponds to the mode marked by an orange circle in Fig. 2(d). That is, the eigenwave excites the band-edge mode of the band (solid orange) translated by the eigenwave wavevector $−kG$ [Eq. (12)]. Finally, the mode in Fig. 2(j) is shifted by $+kG$ and is marked by the orange triangle.

$Ein(x,y)=eik0x2+f2eikzz|R⟩,$which is simply an RCP spherical wave originating at $z0=f$. Figure 3(a) shows the intensity of a spherical wave emanating from an ideal point source at a position $z0=425 μm$. The metasurface is placed at $z=0$ and encoded with the phase profile in Eq. (15) with $f=425 μm$, which corresponds to a lens focusing light incident at normal incidence with a numerical aperture $NA≈0.5$, defined here as $NA=n1W/2(W/2)2+(f/2)2$ for a lens of width $W$. The reflected light due to this excitation is shown in Fig. 3(b) at the resonant frequency, showing refocusing of the light to the original point source position. The reflectance due to this excitation is shown in Fig. 3(c) both for an RCP and left-handed circularly polarized (LCP) spherical waves, showing near-unity reflectance when excited by the RCP eigenwave. This reflectance is calculated by integrating (as a function of space) the total power reflected off the surface, passing through a plane placed at $z=2 μm$, and then normalizing the result to the incident power falling on the metasurface. The phase profile $Φin$ arriving at the metasurface is shown in Fig. 3(d) along with the reflected phase profile at resonance $Φout$ and modal phase profile $Φmode$ (sampled at positions along the bottom plane of the device at $y=0$), which follow closely the predicted forms [Eqs. (7) and (8), respectively]. Figure 3(e) shows the mode field profile at two locations along the lens, showing the band-edge mode profile as expected, but with small residual phase deviations tracked in Fig. 3(d). Note that this slow phase drift indicates a slight deviation from the ideal eigenwave condition [Eq. (7)], but, in comparison to the encoded phase profile, it is very small. This deviation, together with the reflectance in Fig. 3(c) not peaking at unity and the reflected phase profile in Fig. 3(d) not matching a perfect hyperbola, is due to the imperfections in the metasurface implementation and the non-ideal adiabaticity of the geometric phase variations across the surface. Yet, despite these non-idealities, the agreement conceptually is excellent with our theoretical model: the eigenwave locally cancels the encoded phase gradient and resonantly reflects to a phase-conjugated copy of itself with near-unity reflectance via interference with a q-BIC, whose essential features are those of the band-edge mode.

Figure 3.Eigenwave of a q-BIC metasurface forming a converging lens. (a) Field intensity (log scale) for an ideal point source placed along the optical axis $x=0$ at a distance $z0=425 μm$ from the metasurface. (b) Intensity (linear scale) of reflected light when the metasurface is encoded such that the field in (a) is the eigenwave. (c) Reflectance when the point source in (a) is RCP and LCP, calculated by summing the reflected power at a plane $2 μm$ above the metasurface and normalizing to the power in (a) that falls on the metasurface. (d) Input, output, and mode phase profiles at the eigenwave condition. (e) Mode profile at the eigenwave condition at two locations along the lens, demonstrating that the eigenwave excites the band-edge mode at a near-constant phase across the device.

Next, we demonstrate the spatial selectivity of our metasurface by studying how the reflectance depends on the location of the point source $z0$. The spatial selectivity of the metasurface implies that maximal reflectance is achieved only when the eigenwave is incident from ($z0=f$) and the reflectance drops as $z0$ changes. We verify this prediction in two scenarios, when the phase function is applied along the $x$ direction [for which the q-BIC has the flat band structure seen in Fig. 4(a)] and when the phase function is applied along the $y$ direction [for which the q-BIC has the sharper band structure seen in Fig. 4(b)]. The reflectance due to RCP waves emitted from positions $z0$ is shown in Figs. 4(c) and 4(d) for metasurface lenses of widths $W=50 μm$ and identical $NA≈0.48$ to the device in Fig. 3. The results show maximal reflectance only at the eigenwave condition and reduced reflectance as the excitation moves away from the optimal location.

Figure 4.Spatial selectivity and band curvature. (a), (b) Reflectance in the case of a uniform phase profile along the $kx$ and $ky$ directions. (c), (d) Reflectance of metasurface lenses (such as in Fig. 3) with widths of $W=50 μm$ focusing in the $x$ and $y$ directions, due to RCP point sources placed at various positions $z0$ along the optical axis. The case of (d) is shown with substantial spatial selectivity in comparison to (c), corresponding to the sharper band structure in the $ky$ direction (b) in comparison to that in the $kx$ direction.

Notably, the reflectance drop-off is drastically different in the two cases, implying a different wavefront selectivity for the two planes. This difference is explained by the physical origin of the spatial selectivity: the resonant frequency shifts according to the local phase gradient. As shown in Fig. 2(d), the q-BIC band shifts in $k$-space by an amount $kG$ following Eq. (10). If the phase gradient changes adiabatically, we may view each section of the lens as approximated by such a band structure, wherein the shift $kG$ increases in magnitude away from lens center following Eq. (15). For light at normal incidence, for instance, this band shift corresponds to a distinct resonant frequency shift at the various positions across the device following Eq. (12), but with $kG$ being a function of $x$. This means that light at normal incidence does not excite the band-edge mode everywhere across the device simultaneously, and the spectral response is lost [as depicted in Fig. 1(d)]. In contrast, the eigenwave represents the specific wavefront for which everywhere across the device this shift is precisely canceled, i.e., it is the wave whose local momentum exactly counters the $k$-space shift imprinted on the surface and excites the band-edge mode at frequency $ω0$ everywhere across the device. Therefore, our nonlocal metalens owes its spatial selectivity to the resonant dispersion of the underlying q-BIC. The flatter the band is, the smaller the shift in resonant frequency for the same magnitude of phase gradient is, and the smaller the spatial selectivity is. Likewise, a lower $Q$-factor implies that a larger frequency shift may be tolerated before the spectral feature is lost. Therefore, for large dispersion and high $Q$-factors, only incident waves closely matching the eigenwave exhibit any appreciable Fano spectral feature, and we see that the spatial selectivity is a natural consequence of the momentum selectivity in the periodic geometry.

$α(x,y)=ma tan 2(y,x),$with $m=−1$. The eigenwave becomes a vortex beam following Eq. (18) with $ℓ=1$. Due to computational constraints, we limited the size of the simulated device to $30 μm×30 μm$ and chose $w0=7 μm$ to keep the optical power well-contained within the boundaries of the device. The amplitude and phase of the incident field are shown in Fig. 5(d), along with a table summarizing its momenta. As reported in Figs. 5(a) and 5(b), when this eigenwave impinges on the device, a Fano resonance with large peak reflectance is observed, but for any other values of $ℓ$, the peak reflectance is reduced. This q-BIC metasurface, therefore, supports an OAM-selective Fano resonance.

Figure 5.Eigenwaves selective to both SAM and OAM. (a) Reflectance spectra for a range of OAM orders $ℓ$ incident on a metasurface encoding a phase profile $Φ=2m arctan 2(y,x)$. (b) Histogram showing the reflectance at the band-edge resonant wavelength $λr$, as a function of $ℓ$. (c) Field profile of the q-BIC illuminated by its eigenwave ($ℓ=1$) near the center of the device (which has a total aperture $30×30 μm$); device geometry is overlaid with every other subperiod grayed out for clarity. (d) Incident electric field profiles with momenta tabulated ($s$ denoting SAM). (e) Reflected beam at a non-resonant wavelength $λnr$, showing conventional specular reflection, with sign inversion for all momenta. (f) Reflected beam at the resonant wavelength $λr$, showing preservation of SAM and OAM.

As seen in Fig. 5(c), near the center of the device, the excited q-BIC has no residual phase profile, matching closely the expected profile of this mode. When light matching the eigenwave is incident [Fig. 5(d)], the amplitude and phase reflected at a non-resonant wavelength [shown in Fig. 5(e)] have all momenta inverted, as expected for specular reflection. The amplitude and phase of the reflected light at the resonant wavelength/wavefront, on the other hand, preserve both SAM and OAM [Fig. 5(f)].

We note that the Fano resonances in Figs. 35 do not have ideal unity diffraction efficiencies because their size is too small compared to the localization of energy in the q-BIC metasurface. The spatial profiles in Eq. (4) (and, in particular, the amplitude profile) must vary adiabatically relative to the characteristic lateral distance that the optical energy travels while resonating, otherwise, the interference of optical energy producing the Fano resonance will not be complete. The degree of lateral localization and the optical lifetime of the q-BIC, therefore, constrain the range of spatial frequencies an eigenwave can carry if near-unity diffraction efficiency is desired in a compact device.14,35 Achieving flatter bands or using lower $Q$ will improve the efficiency of the device within a finite range of spatial frequencies. q-BICs in high-contrast systems have been shown to enable flat bands with high $Q$-factor resonance,35,36 offering precisely the needed degrees of freedom. However, as we have shown, such a choice will also decrease the spatial selectivity of the device. Alternatively, devices with larger footprint will achieve diffraction efficiencies approaching unity without altering the spatial selectivity. For instance, the $150-μm$ wide lensing device in Fig. 3(a) has a higher peak reflectance (90%) than the $50-μm$ device in Fig. 4(c) (70%), even though they have an identical numerical aperture, $NA≈0.48$. We finally note that the reflected amplitude profile in Fig. 5(f) is distorted relative to the eigenwave; these distortions are due to the anisotropy of the band structure of the q-BIC, meaning the non-idealities related to band flatness apply inconsistently with respect to the in-plane directions. Future work developing a coupled mode theory describing these devices in the space-frequency domain will provide quantification and clarification of these limitations regarding band flatness and $Q$-factor.

We also note that both the periodic devices in Fig. 2 retain near-unity efficiency even when excited by plane waves other than the eigenwave at frequencies satisfying the dispersion relations [Eqs. (9) or (12)]. Yet, these modes do not reflect to time-reversed copies, as in the case of the band-edge. [Rather, as shown in Fig. 2(f), they are anomalously reflected in the general case of a phase gradient.] In this regard, these cannot be considered eigenwaves in the sense defined here. However, the time-reversed copy of the anomalously reflected plane wave must reflect to the original exciting plane wave. Hence, a superposition of these two plane waves can be considered the eigenwave in the sense considered here, reflecting to its time-reversed copy mediated by excitation of two counter-propagating q-BICs. This suggests that the aperiodic devices will also exhibit spatial selectivity off the band-edge to wavefronts produced by the interference of the two counter-propagating modes at frequencies off the band-edge. In this regard, our results can be seen as the scenario in which the counter-propagating modes unify into a single q-BIC at the band edge. Future work will explore the response of aperiodic Fano resonant metasurfaces off the band-edge frequency; this work is instead focused on establishing how the q-BIC symmetries alter the essential features of the band-edge mode in a way that translates the usual momentum-frequency selectivity into space-frequency selectivity.

4 Discussion

The results reported here demonstrate that chiral q-BICs with spatially tailored eigenpolarizations are characterized by an eigenwave that reflects with preserved handedness. In the case of a linear phase gradient, the consequence of preserving the handedness is retroreflection. The rule that the incidence angle is equal to the angle of reflection holds as usual, but with respect to a coordinate system of preserved handedness instead of inverted handedness. Our demonstrated Fano metalens may be thought of as a retroreflector with an angle that continuously varies across the device, demonstrating that this handedness preservation applies to eigenwaves spanning a range of spatial frequencies. Finally, the vortex beam Fano metasurface in Fig. 5 may also be described as a series of linear phase gradients wrapped azimuthally, locally retroreflecting the eigenwave. This azimuthal retroreflection has the consequence of preserving OAM when excited by the eigenwave.

The proposed scheme, therefore, enables an implementation of Fano metasurfaces that prescribes arbitrary spin, and spectral and spatial selectivity to an optical resonance. By tuning their chirality through $Δα$, the spin selectivity may be arbitrarily tuned.26 By tuning the magnitude of the perturbation $δ=D1−D2$, the spectral selectivity may be also widely controlled (the $Q$-factor varies as $Q∝1/δ2$).13,14 By tuning the geometric phase, spatial wavefront selectivity is readily achieved by varying the deflection angle of the underlying angularly selective Fano resonance. Only the eigenwave precisely satisfies the angular selectivity at every location along the nonlocal metasurface. Band structure engineering may tune the degree of spatial selectivity.

Finally, we comment briefly on the role of the proposed chiral q-BIC platform (based on the approach introduced in Ref. 26) for demonstrating these concepts, and how our results differ from previously known phenomena in metasurfaces. Huygens’ metasurfaces37 are a well-known approach to achieve robust and highly efficient control of transmitted wavefronts, even including asymmetric and chiral responses.3840 By their nature, Huygens’ metasurfaces are perfectly matched only at a single frequency, suggesting a degree of frequency selectivity in the wavefront transformation and the possibility of extending our results to transmissive type devices. Indeed, two Fano resonances may be tailored to interfere in a manner mimicking a Huygens’ metasurface if the modes involved have opposite decay symmetry,41 suggesting that this may even be done using the q-BIC mechanism. However, so far, Huygens’ metasurfaces have not been explored in the context of sharp space-frequency selectivity. Regardless, such a system differs notably from our platform in that it relies on accidental (in contrast to symmetry-protected) spectral interference of two modes that are controlled by geometric parameters, while our platform manipulates the symmetries of a single-nonlocal mode responsible for the entire metasurface response. In other words, in the proposed platform, the wavefront-selectivity is an intrinsically encoded property of the band-edge mode itself, rather than a property of the interference of two leaky modes.

Similarly, a degree of frequency selectivity and angular selectivity is well-known to exist in conventional local metasurfaces, in that they only operate ideally for a single wavelength and angle of choice (see, for instance, Ref. 42). Often, it takes a concerted effort to reduce this selectivity in order to increase the bandwidth43 or angular tolerance44 of the wavefront transformation. However, in comparison to our structures, the bandwidth of these devices is much larger (by orders of magnitude), and this selectivity is very small due to the highly localized response of the metasurface scattering events. The difference is not simply in the degree of selectivity, but also in its form: in the q-BIC platform, the broadband local response (the continuum of states) is unaffected to the first order by the perturbation,14 whereas the discrete nonlocal response is arbitrarily tailored via the q-BIC symmetry properties. This feature results in a Fano resonance with in principle arbitrary $Q$-factors,13 while conventional local metasurfaces cannot be described by Fano interference and do not have rationally controllable linewidths.

5 Conclusion

We have shown that metasurfaces with engineered q-BICs can support generalized Fano resonances that are selective to the shape of the incoming wavefront. When illuminated by their eigenwaves, the nonlocal band-edge mode is uniformly illuminated across the device, and the devices reflect light described by a coordinate system of preserved handedness; other excitations lead to weak responses and nearly full transmission. Our results extend the concept of Fano resonant metasurfaces from the momentum-frequency domain to the space-frequency domain, and the proposed design platform greatly advances the control over optical wavefronts and implements key functionalities for the growing fields of augmented reality and secure communications. Although we focused here on scalar wavefronts, we note that the present concept may, in principle, be extended one step further, such that nonlocal metasurfaces are selective to a vector beam excitation, i.e., a wavefront whose polarization state varies spatially. This opens the door to experimental demonstration of these concepts within single-layer devices,28 wherein the linear polarization varies spatially, e.g., Fano resonant metasurfaces selective to a radially polarized beam. Beyond initial experimental verifications, we also envision interesting opportunities for these concepts in the context of thermal emission engineering. By considering the presence of small material loss in the proposed metasurfaces, we expect the emergence of a Lorentzian absorption peak with highly unusual wavefront and frequency selectivity. Due to the modal radiation laws,45 this implies the possibility of tailoring the thermal emission with arbitrary wavefront selectivity based on these principles. A detailed discussion of these opportunities goes well beyond the scope of this paper, but this discussion highlights the rich phenomena unveiled by our findings in the context of generalized Fano responses with arbitrary wavefront selectivity, with a broad range of implications in several physics and engineering application areas.

Copy Citation Text
Adam Overvig, Andrea Alù. Wavefront-selective Fano resonant metasurfaces[J]. Advanced Photonics, 2021, 3(2): 026002