text
stringlengths
83
79.5k
H: Importrange when copied to other cells automatically change range I am using importrange to pull data from my responses page to my spreadsheet. I have completed the first sheet but I now need to go into the sheet to follow on where sheet one has run out of space. The problem is I have copied the importrange script to all cells in the column, but the range hasn't automatically changed. I want the range to say A2:A2 to change to A3:A3 etc. Can this be done so I don't have to change each one by hand Here is an example =IMPORTRANGE("https://docs.google.com/spreadsheets/d/1cBaiqy_VZRvM90XHW4doW6phqZO02OgoFdhNN1COgck/edit", "Time!e18:e18") and I want when copied to the next cell to be =IMPORTRANGE("https://docs.google.com/spreadsheets/d/1cBaiqy_VZRvM90XHW4doW6phqZO02OgoFdhNN1COgck/edit", "Time!e19:e19") and so on... AI: if you want to drag down the formula use: =IMPORTRANGE("1cBaiqy_VZRvM90XHW4doW6phqZO02OgoFdhNN1COgck", "Time!E"&ROW(A18)) if you want to drag to the right use: =IMPORTRANGE("1cBaiqy_VZRvM90XHW4doW6phqZO02OgoFdhNN1COgck", "Time!E"&COLUMN(R1))
H: Automatic merging of duplicate cells under common ID I have data in column A with IDs and a column B with data for those IDs. Right now I have multiple (usually 2-3) rows with the same ID but different data. What formula to use to merge those into one row per ID? AI: =ARRAYFORMULA({UNIQUE(INDIRECT("A2:A"&COUNTA(A1:A)))\ TRIM(TRANSPOSE(QUERY(TRANSPOSE(IF(QUERY(QUERY(A2:B; "select count(A) where A is not null group by A pivot B"; 0); "offset 1"; 0)<>""; QUERY(A2:B; "select count(A) where A is not null group by A pivot B limit 0"); )); ; 999^99)))})
H: How to generate all combinations of letters in a word? Using Google Sheets, how would I show all possible ways to type a word, for example: word Word WOrd WORd WORD wOrd woRd worD without any length word? The given word would go on Row A and the possible combinations would go in Row B. AI: If you type your word by one character per cell with lowercase and then type it again with uppercase like this: you could use this formula in F1 cell which will construct you with all possible states: =ARRAYFORMULA(REGEXEXTRACT( TRANSPOSE(SPLIT(REPT(CONCATENATE(TRANSPOSE(SPLIT(REPT(CONCATENATE(TRANSPOSE(SPLIT(REPT(CONCATENATE( TRANSPOSE(SPLIT(REPT(CONCATENATE(FILTER(A1:A, A1:A<>"")&CHAR(9)),COUNTA(B1:B)),CHAR(9)))& TRANSPOSE(SPLIT(CONCATENATE(REPT(FILTER(B1:B, B1:B<>"")&CHAR(9),COUNTA(A1:A))),CHAR(9)))&CHAR(9)),COUNTA(C1:C)),CHAR(9)))& TRANSPOSE(SPLIT(CONCATENATE(REPT(FILTER(C1:C, C1:C<>"")&CHAR(9),COUNTA( TRANSPOSE(SPLIT(REPT(CONCATENATE(FILTER(A1:A, A1:A<>"")&CHAR(9)),COUNTA(B1:B)),CHAR(9)))& TRANSPOSE(SPLIT(CONCATENATE(REPT(FILTER(B1:B, B1:B<>"")&CHAR(9),COUNTA(A1:A))),CHAR(9)))))),CHAR(9)))&CHAR(9)),COUNTA(D1:D)),CHAR(9)))& TRANSPOSE(SPLIT(CONCATENATE(REPT(FILTER(D1:D, D1:D<>"")&CHAR(9),COUNTA(TRANSPOSE(SPLIT(REPT(CONCATENATE( TRANSPOSE(SPLIT(REPT(CONCATENATE(FILTER(A1:A, A1:A<>"")&CHAR(9)),COUNTA(B1:B)),CHAR(9)))& TRANSPOSE(SPLIT(CONCATENATE(REPT(FILTER(B1:B, B1:B<>"")&CHAR(9),COUNTA(A1:A))),CHAR(9)))&CHAR(9)),COUNTA(C1:C)),CHAR(9)))& TRANSPOSE(SPLIT(CONCATENATE(REPT(FILTER(C1:C, C1:C<>"")&CHAR(9),COUNTA( TRANSPOSE(SPLIT(REPT(CONCATENATE(FILTER(A1:A, A1:A<>"")&CHAR(9)),COUNTA(B1:B)),CHAR(9)))& TRANSPOSE(SPLIT(CONCATENATE(REPT(FILTER(B1:B, B1:B<>"")&CHAR(9),COUNTA(A1:A))),CHAR(9)))))),CHAR(9)))))),CHAR(9)))&CHAR(9)),COUNTA(E1:E)),CHAR(9)))& TRANSPOSE(SPLIT(CONCATENATE(REPT(FILTER(E1:E, E1:E<>"")&CHAR(9),COUNTA(TRANSPOSE(SPLIT(REPT(CONCATENATE( TRANSPOSE(SPLIT(REPT(CONCATENATE(TRANSPOSE(SPLIT(REPT(CONCATENATE(A1:A&CHAR(9)),COUNTA(B1:B)),CHAR(9)))& TRANSPOSE(SPLIT(CONCATENATE(REPT(FILTER(B1:B, B1:B<>"")&CHAR(9),COUNTA(A1:A))),CHAR(9)))&CHAR(9)),COUNTA(C1:C)),CHAR(9)))& TRANSPOSE(SPLIT(CONCATENATE(REPT(FILTER(C1:C, C1:C<>"")&CHAR(9),COUNTA( TRANSPOSE(SPLIT(REPT(CONCATENATE(FILTER(A1:A, A1:A<>"")&CHAR(9)),COUNTA(B1:B)),CHAR(9)))& TRANSPOSE(SPLIT(CONCATENATE(REPT(FILTER(B1:B, B1:B<>"")&CHAR(9),COUNTA(A1:A))),CHAR(9)))))),CHAR(9)))&CHAR(9)),COUNTA(D1:D)),CHAR(9)))& TRANSPOSE(SPLIT(CONCATENATE(REPT(FILTER(D1:D, D1:D<>"")&CHAR(9),COUNTA(TRANSPOSE(SPLIT(REPT(CONCATENATE( TRANSPOSE(SPLIT(REPT(CONCATENATE(FILTER(A1:A, A1:A<>"")&CHAR(9)),COUNTA(B1:B)),CHAR(9)))& TRANSPOSE(SPLIT(CONCATENATE(REPT(FILTER(B1:B, B1:B<>"")&CHAR(9),COUNTA(A1:A))),CHAR(9)))&CHAR(9)),COUNTA(C1:C)),CHAR(9)))& TRANSPOSE(SPLIT(CONCATENATE(REPT(FILTER(C1:C, C1:C<>"")&CHAR(9),COUNTA( TRANSPOSE(SPLIT(REPT(CONCATENATE(FILTER(A1:A, A1:A<>"")&CHAR(9)),COUNTA(B1:B)),CHAR(9)))& TRANSPOSE(SPLIT(CONCATENATE(REPT(FILTER(B1:B, B1:B<>"")&CHAR(9),COUNTA(A1:A))),CHAR(9)))))),CHAR(9)))))),CHAR(9)))))),CHAR(9))),"^([^-]+)")) note: for a word with less then 5 characters use single dashes (-) only within the first row: for 12 characters: spreadsheet formula here for 15 characters: spreadsheet
H: How can I undo deleted comment on YouTube? I tried to edit a YouTube comment and instead click on delete: After clicking on delete I get a notification that the comment was deleted but I didn't see any undo option: How can I undo delete comment on YouTube? AI: Currently, there is no "undo" functionality on YouTube for deleted comments. Deleted comments are instantly deleted upon clicking on Delete button. You can request the "undo" feature under Send feedback option:
H: I am looking to fetch a table from a website in Google Sheets I want the first table on this URL https://www.cashbackmonitor.com/cashback-store/amazon/ in my google sheet. When I put this function (below), I can retrieve the first column of the first table e.g. Shop at Home, Top Cashback, etc. However, I am not able to get the Rate column of the table. Can someone please help. =importxml("https://www.cashbackmonitor.com/cashback-store/booking.com/", "//td[@class='l lo']/a") AI: Unfortunately, that won't be possible the way you trying because the fields you attempt to scrape are controlled by JavaScript and Google Sheets can't understand/import JS. You can test this simply by disabling JS for a given link and you will see what exactly can be imported into Google Sheets:
H: What does the query parameter "sub_confirmation=1" do on a YouTube link? I recently came across a link to a YouTube video with ?sub_confirmation=1 appended to the link. What does this do? AI: What this does is automatically subscribe the follower of the link to the YouTube channel that posted the video. It's not totally silent as it will popup a confirmation dialog: so the user can choose what to do. It's not a very nice thing to do though. Source
H: What is the correct LinkedIn page cover image size? I checked the size guide for LinkedIn cover images here For page, they say: 1192 (w) x 220 (h) pixels (min) 1536 (w) x 768 (h) pixels (recommended) Doubt 1: Both have different ratios. Why is that? Doubt 2: When I opened developer tools, I found the dimensions of the image container as 1128x191px. Which also has a ratio different to them. So what is the correct ratio for the cover? And why the ratio differs in developer tools and normal guidelines AI: LinkedIn, as well as other major websites, can't afford to lock down aspect ratio to a specific variable due to cross-platform support of various devices and browsers. Therefore, correct LinkedIn Page Cover should be between 1192-1536 px for width and 220-768 px height or in aspect ratio notation: between 298:55 - 2:1 (with respect to max/min resolution of course). After uploading such an image (eg. based on right dimension guidelines), the image is processed by an internal tool which will either create pre-defined versions of the image for different scenarios and store them on server side ready to be called by the browser, or this tool is implemented and does its magic in real time.
H: Total of cells formula for numbers as text I want to total up the numbers of split cells. I have an example as follows: 1234 0000 5678 each number is in its own cell, I want to total it all up underneath to get 6912, so 1234 + 0000 + 5678 = 6912 if this makes sense. AI: use SUMPRODUCT which is able to sum numbers acting like text strings: =SUMPRODUCT(SPLIT(A1, " ")) =SUMPRODUCT(A1:A3)
H: How to use the SPLIT function in Google Spreadsheets with different delimiters and with some delimiters with multiple characters? My question is similar to this one: SPLIT function in Google Spreadsheets with OR statement but has the following difference: I want to use the delimiter "apple" and the delimiter "." within the SPLIT function. Since the delimiter apple has multiple characters, @parkydr answer here doesn't work. Example: On this input on A2: I ate an apple on the bus home. Going I want it to split like this: I ate an / on the bus home / Going I tried this: =SPLIT(A2,"apple.",TRUE) I / t / n / on / th / bus / hom / Going and this =SPLIT(A2,"'apple''.'",TRUE) I / t / n / on / th / bus / hom / Going and this =SPLIT(A2,"apple.",false) I ate an apple on the bus home. Going and this =SPLIT(A2,"apple"".",false) #ERROR Formula parse error. and this =SPLIT(A2,"'apple''.'",false) I ate an apple on the bus home. Going How to make return the next split? I ate an / on the bus home / Going AI: You'll have to replace all delimiters with a unique delimiter and split. =SPLIT(REGEXREPLACE(A2,"apple|\.","✱"),"✱")
H: Split cells not importing first 0 I am using split formula: =IFERROR(SPLIT(REGEXREPLACE(" , "&U4, "(\d)", "$1 ,"), ", ")) It works great except if I have 0250, it imports it across as 250, even with the cell it's importing from is set to #000 and it sits in the 1st 3 cells instead of the 2nd 3rd and 4th cells When the number is 1250 it works fine, but if it's 0250 then it comes through as 250 not 0250 AI: =IFERROR(REGEXEXTRACT(""&A2, REPT("(.)", LEN(A2))), REGEXEXTRACT( 0&A2, REPT("(.)", LEN(A2))))
H: What does the "Share it with the same people" option do when making a copy? When making a copy of a document in Google Docs from File > Make a copy…, there is an option to Share it with the same people. What does that option do? Does it share the doc with the same people as the source folder or the destination folder? If the destination folder is already shared with a number of people, does it override those permissions? AI: Selecting this option: means that everyone listed here: will be able to find this document copy on their Drive under:
H: How to aggregate data from multiple Google sheets with a tag I am importing data (using IMPORTRANGE) from 3 different sheets to 3 different tabs of a google sheet. Then I am aggregating those three sheets into one and also filter them using a query. Ex: =query({BUOne!A1:Y200;BUTwo!A1:Y200;BUThree!A1:Y200}, "Select * where Col1 is not null AND Col14 = 'Bench' order by Col2 ASC") This gives me the data I want from all 3 sheets without a problem. But I want to know from which sheet each data row came from. In this case to which BU(BU_One,BU_Two,BU_Three) each record belongs to. Is there a way to put a tag or a different column when aggregating sheets so I can know this? AI: try like this: =ARRAYFORMULA(QUERY({ BUOne!A1:Y200, TRANSPOSE(SPLIT(REPT("×BU_One", 200), "×")); BUTwo!A1:Y200, TRANSPOSE(SPLIT(REPT("×BU_Two", 200), "×")); BUThree!A1:Y200, TRANSPOSE(SPLIT(REPT("×BU_Three", 200), "×"))}, "where Col1 is not null and Col14 = 'Bench' order by Col2"))
H: ArrayFormula not showing 0s I use the following formula to calculate plain text so to show leading zeros. =ARRAYFORMULA(SUM(S2:S17+0)) but it's only displaying the results without the leading zero. Example, if It is adding up 0100+0200 it is displaying an answer as 300, but I need it to display 0300. AI: If this is a time you should enter it as: 01:00:00 and format it like: And then you will just use simple SUM(A1:A2):
H: How to refer to elements of a dynamic array in Google Sheets? I'm trying to create teaching timetables dynamically, by searching through a large table with all of the information about what time a lesson takes place, who the tutor is, what age group is being taught, and what subject it is. I'm able to generate all of the information using a combination of FILTER and QUERY. Below is how I want it to look vs. how it outputs. I could use JOIN to group all the information in one cell and use the line return delimiter to split them, but then I can't arrange each item in the array how I like. I want to dynamically concatenate the cells so that, for example, I can put multiple fields on one line, and also be able to apply conditional logic based on the results of the QUERY. For example, if one column is blank, use an IF statement to omit it. What I need to know is how to create an array based on a query, and then in the same formula line, refer to individual elements within that array. So something like IF(ThisArray[0]<>"", ThisArray[0] & ThisArray[1]) and so on. This is the formula I'm currently using: =JOIN(CHAR(10), QUERY(FILTER('Timetable'!$B$2:$R$620, 'Timetable'!$B$2:$B$620=B$3, 'Timetable'!$J$2:$J$620=$A4, 'Timetable'!$H$2:$H$620=$A$3), "SELECT Col13, Col15, Col14, Col5")) Is there a way to do this? EDIT: I've just discovered the TEXTJOIN formula, which is better than my current solution, especially as it allows me to join 2D arrays. So more than one lesson can be stored in the same cell. However, I can't find any way to put an extra line return in between rows to make it more readable, so it just generates like: Philosophy 16-17 John Smith English Language 13-15 Jane Doe Which is better but not perfect. The ideal scenario is that I can dynamically concatenate each row that's generated by the FILTER and QUERY, into a single cell, with line returns in between. AI: The below formula takes the OP query formula and inserts an extra column with value ":" between 3th and 4th column. then the outer QUERY shmushes all columns in one column and appends a unique character ♦ to all values. Then textjoin joins all data with char(10) >> that's your empty row between sets. Next a series of regexreplaces are applied to finetune the final output inner one replaces a special character with a new line. Middle one removes new line if its before "Medicine" and outer one fixes the issue with 2nd row of each set . =ARRAYFORMULA(REGEXREPLACE(REGEXREPLACE(REGEXREPLACE(TEXTJOIN(CHAR(10), 1, QUERY(TRANSPOSE("♦"&QUERY(FILTER('Source table'!$A$2:$G$6,'Source table'!$A$2:$A$6=$B3), "select Col2,Col3,':',Col4,Col5,Col6 label ':'''")),,999^99)), "♦", CHAR(10)), "^"&CHAR(10), ), " "&CHAR(10)&": "&CHAR(10), ": "))
H: How to timestamp on new added cells in LIVE google spreadsheet? The code below insert timestamp in google sheet by editing another column. However, there an issue which I have no idea how to solve. When I add new row manually, it successfully adds timestamp, BUT I have an html form in my website which sends data to this sheet and even-though new row is added, google don't create a timestamp !!! It's a bit weird since conceptually when a new row is added, means an edit in cell, and google must add timestamp. I would be so grateful if someone help me to solve this issue. Thanks function onEdit(event) { var timezone = "GMT+8:30"; var timestamp_format = "yyyy-MM-dd HH:mm:ss"; // Timestamp Format. var updateColName = "date"; var timeStampColName = "Date Sent"; var sheet = event.source.getSheetByName('Attendance'); //Name of the sheet where you want to run this script. var actRng = event.source.getActiveRange(); var editColumn = actRng.getColumn(); var index = actRng.getRowIndex(); var headers = sheet.getRange(1, 1, 1, sheet.getLastColumn()).getValues(); var dateCol = headers[0].indexOf(timeStampColName); var updateCol = headers[0].indexOf(updateColName); updateCol = updateCol+1; if (dateCol > -1 && index > 1 && editColumn == updateCol) { // only timestamp if 'Last Updated' header exists, but not in the header row itself! var cell = sheet.getRange(index, dateCol + 1); var date = Utilities.formatDate(new Date(), timezone, timestamp_format); cell.setValue(date); } } AI: Simple and installable triggers for open, edit and change events are triggered only when a user using the Google Sheets UI do the corresponding action. Reference https://developers.google.com/apps-script/guides/triggers Related How to add a date to a cell next to an cell with an imported value How to trigger a script in Google sheets when a value changes Why don't work function onEdit(e) when using Zapier How to automatically set date in a cell when a different cell value is changed by a formula from data on another sheet?
H: How can I add details to goals in Google Calendar? I have been using goals in Google Calendar for quite sometime now. They are very handy and easy to use. Just create a goal you want to accomplish, set preferred time and frequency and you are all set. However, there are some extra things that i want to do with Goals in Google calendar that would make the experience much more delightful. I want to add details to goals. For instance, I have a goal workout. Now, Let's assume that i have set this goal for 1hr every morning. Now, one day i decide that i will not do pushups tomorrow. To accomplish this, I want to add details to the workout goal for tomorrow. However, I cannot do that! Is there a way to do that in Google Calendar? If not, is there an external application that might do it for me and that syncs with Google Calendar? Thanks for the help. AI: Currently, Google Calendar Goals don't support any fields to customize with text. But since everything in Google Calendar, including Goals and To-dos, is just an event, you still can customize using a different approach. First let's see what a Google Calendar "Goal" is, it's a simplified event that is named "Workout" and it usually repeats some time during the week. If you look at your Work out event in the mobile apps, you'll notice it has the dumbbell image as the header image and the name will be "Workout", it's getting the image because of the name, nothing special happens besides the naming. The repetition is an easy to use feature when setting up the goal but it's entirely possible when creating a regular Google Calendar event as well. TL;DR to achieve what you're asking for, you should create your "Workout" goals as a regular event and then you'll be able to edit the description and other details. You'll still see the header image being dumbbells as long as you name it "Workout". And repetition is possible, just set it up when creating a regular calendar event.
H: IF AND not working in Google Sheets for Conditional Formatting I am trying to use the three following functions... =IF(AND(M3="Funding on Hold",R3>=3,R3<=6),TRUE,FALSE) =IF(AND(M3="Funding on Hold",R3<=9,R3>=7),TRUE,FALSE) =IF(AND(M3="Funding on Hold",R3>=10),TRUE,FALSE) The objective is to conditionally format these three functions to a certain color. The first function is supposed to turn YELLOW if the value in R3 is greater than or equal to 3, but less than or equal to 6 (so if the value is 5, the cell color should fill as YELLOW). The second function will be ORANGE, and the third function to be RED. I use these above formulas as "Custom Formula is", but it does not work. It works perfectly in Excel. What am I doing wrong? AI: Your syntax is correct, so only issue could be locale. Try: =IF(AND(M3="Funding on Hold";R3>=3;R3<=6);1) =IF(AND(M3="Funding on Hold";R3<=9;R3>=7);1) =IF(AND(M3="Funding on Hold";R3>=10);1) Also make sure your formatting of R3 cell is Automatic or Number Update: Your issue is in M3 cell. M3 is Funding on Hold[space] not Funding on Hold, therefore, formula needs to be: =IF(AND(M3="Funding on Hold ",R3>=3,R3<=6),1)
H: Count unique values in second column corresponding to unique value in first column I have a Google sheet with cities corresponding to countries like this. Notice that neither countries nor cities are unique and there can be duplicates. | A | B | ------------------------ | UK | London | | UK | Manchester | | UK | Manchester | | UK | Birmingham | | Ireland | Dublin | | Norway | Oslo | | Norway | Trondheim | Now I want to count the number of unique cities for each unique country. The result should look like this. | C | D | --------------- | UK | 3 | | Ireland | 1 | | Norway | 2 | I got column C using UNIQUE(A1:A). But how do I get column D? AI: =QUERY(UNIQUE(A1:B), "select Col1,count(Col2) where Col1 is not null group by Col1 label count(Col2)''", 0) =ARRAYFORMULA(IFERROR(VLOOKUP(C:C, QUERY(UNIQUE(A1:B), "select Col1,count(Col2) where Col1 is not null group by Col1 label count(Col2)''", 0), 2, 0)))
H: Assert cell style onto text pasted into that cell I'm not quite sure how to word this so I couldn't find any answers to my question after some searching. I am trying to copy and paste values into my Google sheet. These values are copied from another website which has a different font and font size than that which I have in my sheet. However, when these values are pasted they appear in the style that is on the website. Is there a way to pre-set a cell's style so that any value pasted into it conforms to the cell's preset style? I am aware that I could set up multiple sheets, one as an input and another as an output, in order to solve this problem, although I'd rather not do this. AI: In Google Sheets, pasted data auto-inherit default formatting of Google Sheets which is Arial 10px eg. it overrides all priorly set formattings. To counter this behavior there are three workarounds: double-click the cell and paste data paste data in fx bar instead of cell paste it as is and copy the cell with the desired formatting (A4) and then select A3 and press CTRL + LEFT ALT + V
H: Array Formula with IF function and SUMIFS function I am trying to convert the below formula into an array formula. I can make it work in an array, but it displays the wrong values, compared to the normal formula which I have to drag down. Normal formula: =if(K4>0, (if(((sumifs($K$4:$K,$A$4:$A,A4)-(sumifs($L$4:$L,$A$4:$A,A4))))=0,11, (if((sumifs($M$4:$M,$A$4:A,A4))>0,5,)))),12) I tried the below in an array formula, and it skips value 5 and only displays 11 or 12. Array formula: =arrayformula({"";if(K4:K>0,(if(((sumifs(K4:K,A4:A,A4:A)- (sumifs(L4:L,A4:A,A4:A))))=0,11,(if((sumifs(M4:M,A4:A,A4:A))>0,5,)))),12)}) I then use a vlookup to look against the value, that the if function provides against a list of status messages. What am I doing wrong? AI: ={""; ARRAYFORMULA(IF(K4:K>0, IF(VLOOKUP(A4:A, QUERY({A4:A, K4:K}, "select Col1,sum(Col2) where Col1 is not null group by Col1", 0), 2, 0)- VLOOKUP(A4:A, QUERY({A4:A, L4:L}, "select Col1,sum(Col2) where Col1 is not null group by Col1", 0), 2, 0)=0, 11, IF(VLOOKUP(A4:A, QUERY({A4:A, M4:M}, "select Col1,sum(Col2) where Col1 is not null group by Col1", 0), 2, 0)>0, 5)), 12))}
H: How to programmatically drag new rows - running total? I have the first few rows of my mortgage payments set up, and I want to know how to programmatically print the rest of the rows, as opposed to dragging the little corner box to output the rows. This is important so that I can adjust the payment period, and automatically allow the total number of rows to change. I think I have to use Array Formulas, but not sure how to print the next row the way dragging it or copy-pasting it would. Also, I don't know how to give that array formula and ending condition. Help? The printing of new rows should only stop if the remaining principal gets to or below 0. Sheet: https://drive.google.com/open?id=17Vl2M1d6gwaqHcuO_9c7SpQ-icQxUayqaLYxnur-CuU AI: ={"Remaining Principal"; ARRAYFORMULA(QUERY(IF(LEN(E7:E), MMULT(TRANSPOSE((ROW(E8:E)<= TRANSPOSE(ROW(E8:E)))*{B4; -1*INDIRECT("E"&ROW(E8)&":E"&ROWS(E:E)-1)}), SIGN(E8:E)^0), ), "offset 1", -1))} demo spreadsheet of running total alternative: https://wamoyo.github.io/amortization/
H: Using a script to only take only take cells with values in google sheets tl;dr how can I make the script take an entire column (eg A:A) and then ignore the first (header) row, and any blank rows? Background I have an array in Google Sheets with date-ordered data (note dates are in UK format), where I will routinely add new entries every few weeks. A B 1 Recorded date Value 2 17/3/2018 120 3 1/9/2018 145 4 31/12/2018 210 5 31/3/2019 273 6 5/6/2019 412 In a separate sheet, I want to be able to list other dates, lookup against those dates, and return either the right value (if it matches one of the recorded dates) OR a linear interpolation between the two closest dates. For instance: A B C D E 1 Recorded date Value Lookup date Result 2 17/3/2018 120 1/9/2018 145 3 1/9/2018 145 14/2/2019 241.51 4 31/12/2018 210 5 31/3/2019 273 6 5/6/2019 412 (In reality, the lookup cells are daily rows in a different sheet) I have achieved the simple mechanics of interpolation by adapting the great answers to the question How to interpolate data in a range in Google Sheets. Indeed, I have put my current code below for reference. PROBLEM: I want to feed the entire column into the script, not just the rows 2-6 My current problem is that this script only works if the inputted x and y ranges cover the exact range of available data. Therefore if more observations are recorded into columns A and B, I have to change the formula. So in the example above, I need to use the following formula in cell E2 otherwise it returns an error: =getvalue(A2:A6,B2:B6,D2) Ideally, the formula in E2 would be the following, which would allow the E column to always work regardless of the number of observations recorded in A and B: =getvalue(A:A,B:B,D2) In short: how can I make the script take an entire column (eg A:A) and then ignore the first (header) row, and any blank rows? Here is my current script: function getvalue(x, y, lookupdate) { if (lookupdate.map) { return lookupdate.map(function(v) { return getvalue(x, y, v); }); } if (lookupdate > Math.max.apply(Math, x) || lookupdate < Math.min.apply(Math, x)) { throw "lookupdate can't be interpolated !!"; return; } var check = 0, index; for(var i = 0, iLen = x.length; i < iLen; i++) { if(x[i][0] == lookupdate) { return y[i][0]; } else { if(x[i][0] < lookupdate && ((x[i][0] - check) < (lookupdate - check))) { check = x[i][0]; index = i; } } } var xValue, yValue, xDiff, yDiff, xInt; yValue = y[index][0]; xDiff = x[index+1][0] - check; yDiff = y[index+1][0] - yValue; xInt = lookupdate - check; return (xInt * (yDiff / xDiff)) + yValue; } When I run this script with the x/y inputs as A:A and B:B I get the error "TypeError: Cannot read property "0" from undefined. (line 27)." And line 27 of my script is: xDiff = x[index+1][0] - check; Also, this is my first question – so let me know if I should format/ask it differently! AI: I ended up solving this with a combination of solutions. I used @Rubén's suggestion of x.shift() to remove the header row. To solve the other parts of my question, I used x.filter() to only keep cells that were not empty (i.e. != ""). I then added a series of nested IF, IF ELSE, and ELSE statements to do the following: if lookup date is before the first known record, return a blank cell if lookup date is after the last known record, return the last recorded y value if lookup date precisely matches an existing record, return that record (part of initial code in my question) if lookup date is within the known range, but doesn't precisely match an existing record, calculate an interpolated y value (part of initial code in my question) Here is the final (solved) javascript code: function getvalue(x, y, lookupdate) { /// GET RID OF EMPTY CELLS IN COLUMN var xf = x.filter(function(el) { return el != ""; }); var yf = y.filter(function(el) { return el != ""; }); /// GET RID OF HEADER ROW xf.shift() yf.shift() /// SAVE THE FIRST AND LAST VALUES var firstx = xf[0][0] var firsty = yf[0][0] var lastx = xf[xf.length - 1][0] var lasty = yf[yf.length - 1][0] /// FIGURE OUT WHAT TO RETURN if (lookupdate < firstx) { return ""; } else if (lookupdate.valueOf() == firstx.valueOf()) { return firsty; } else if (lookupdate > lastx) { return lasty; } else { var check = 0, index; for(var i = 0, iLen = xf.length; i < iLen; i++) { if(xf[i][0] == lookupdate) { return yf[i][0]; } else { if(xf[i][0] < lookupdate && ((xf[i][0] - check) < (lookupdate - check))) { check = xf[i][0]; index = i; } } } var xValue, yValue, xDiff, yDiff, xInt; yValue = yf[index][0]; xDiff = xf[index+1][0] - check; yDiff = yf[index+1][0] - yValue; xInt = lookupdate - check; return (xInt * (yDiff / xDiff)) + yValue; } }
H: How to get correct TimeZone in googlesheet using script? I have wrote following script in my google sheet hoping to convert a timestamp in GMT to a customized timezone. function myFunctions(datetimeString,timeZone,format) { var moment = new Date(datetimeString); return Utilities.formatDate(moment, timeZone, "yyyy-MM-dd'T'HH:mm:ss'Z'") } However, I have no idea why this function doesn't give me a correct timezone ! For instant, 6/30/2019 6:32:00 should return June 30, 2019 11:02 AM in (GMT+4:30), However, it returns wrong time (June 30, 2019 02:02). I've wrote the script in script tools, and call myFunctions in googlesheet's cell (consider my timestamp is in A1): =myFunctions(A1,Aisa/Tehran,"dd-MM-yyyy'T'HH:mm:ss'Z'") Thanks in advance. AI: To pass strings as arguments to a custom functions they should be quoted enclosed. Instead of =myFunctions(A1,Aisa/Tehran,"dd-MM-yyyy'T'HH:mm:ss'Z'") use =myFunctions(A1,"Asia/Tehran","dd-MM-yyyy'T'HH:mm:ss'Z'")
H: Scroll google calendar month view one week at a time, to span 2 months partially - "vertical scrolling"? Since years, I'm annoyed when trying to scroll in month view. It always jumps to the beginning of the next month. This feels really bad and sometimes makes it hard to visualize and understand how several events are arranged in relation to each other (or to today)... Hard to describe :) I know, there is a custom 2, 3 or 4 week setting, where you can have a view across a month border. It could be nice, but it still doesn't scroll by a week. Today I wanted to drag-and-drop multiple events from June 30th to somewhere in July - First I couldn't, because even my 3-week-view happened to have the border at the same spot... I modified the settings to get the 2-week-view and was lucky (50% chance) - there I could see the 2 weeks I wanted on the same screen. AI: There is no keyboard or mouse shortcut to advance only a week. But as a workaround, in the custom view (with 2-4 weeks, can be configured in the settings) you could klick a day in that little calendar on the left, and the custom view starts with that week. Then you click the next week and you have nearly what you want. Now we just need someone who creates some plugin which does it from a shortcut or the mouse wheel.
H: Sorting columns with script instead of macro I currently use a macro script to filter my sheet upon opening the sheet by column A, and I wondered if there was a more efficient/simple way to do it with scripts? function Sort() { var spreadsheet = SpreadsheetApp.getActive(); spreadsheet.getRange('3:138').activate(); spreadsheet.getRange('3:138').createFilter(); spreadsheet.getRange('A3').activate(); spreadsheet.getActiveSheet().getFilter().sort(1, true); spreadsheet.getActiveSheet().getFilter().remove(); }; Link: https://docs.google.com/spreadsheets/d/1qpoTEE1bJdGt1rVVAETvh2kGG5EQy4wB1dYnhiTefA4/edit?usp=sharing AI: you can try like this in script editor: var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheetByName("AGL"); var range = sheet.getRange("A4:C"); function onEdit(e) { range.sort([{column: 1, ascending: true}, {column: 2, ascending: false}]); }
H: App Script to move a row of data from one Google sheet to a different one (different sheet id's) based on a cell entry I'm currently trying to adjust a script I found that copies the contents of a row from one tab of a google sheet, pastes it into the next descending empty row in a different tab and then deletes the original row. function onEdit() { var sheetNameToWatch = "Original_Sheet"; var columnNumberToWatch = 3; var valueToWatch = "ValueToLookFor"; var sheetNameToMoveTheRowTo = "Target_Sheet"; var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = SpreadsheetApp.getActiveSheet(); var range = sheet.getActiveCell(); if (sheet.getName() == sheetNameToWatch && range.getColumn() == columnNumberToWatch && range.getValue() == valueToWatch) { var targetSheet = ss.getSheetByName(sheetNameToMoveTheRowTo); var targetRange = targetSheet.getRange(targetSheet.getLastRow() + 1, 1); sheet.getRange(range.getRow(), 1, 1, sheet.getLastColumn()).moveTo(targetRange); sheet.deleteRow(range.getRow()); } } What I want to do from here is be able to run the same script but with the target sheet to be a sheet located on a completely different Google sheet instead of from tab to tab within the same Google sheet. I have next to zero coding knowledge so unsure how I would edit it from here. AI: You have first get the ID of the target sheet from its url (the xxxx corresponds to the sheet ID: https://docs.google.com/spreadsheets/d/xxxxxxxxxxxxxxxxxxxxxxxxxx/edit#gid=2116300997 to copy it for the following script: var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheets = ss.getSheets(); var liness = SpreadsheetApp.openById("your sheet id goes here"); // // var sheet = liness.getSheetByName("Fab") var linevalues = sheet.getRange("A:W").getValues(); var lastrow=sheet.getLastRow(); Then you can open the new sheet and paste the values into any tab you want just like pasting in active sheet by using setValues(). It will not copy formats and validation rules. Then you have set values to blank by setValues() or clearContent() in the source sheet.
H: Solve errors in a series of FILTER functions within array brackets? I have been working on a budget project on Google Sheets. My goal is for a range of data to be filtered by date (which is represented as an integer between 1 and 31 for the day of the month). All entries in the first two columns are returned if the entry in the third column is equal to 1 (or whatever day of the month for which I am looking). And I require that on ~25 categories, and I want them to all be in one function, so I combined 25 filter functions in an array and they all combined nicely. My only problem is, what if I don't have any values in one of the categories that correspond to that date. The FILTER function returns an error and then the ENTIRE array function fails. I tried using IFERROR to return a string, but the array function does not like having strings as an argument. ={iferror(sort(FILTER(Sheet1!$AH$13:$AI$62,Sheet1!$AJ$13:$AJ$62=B5),2,TRUE),"None Today"); iferror(sort(FILTER(Sheet1!$AK$13:$AL$62,Sheet1!$AM$13:$AM$62=B5),2,TRUE),"None Today"); iferror(sort(FILTER(Sheet1!$AN$13:$AO$62,Sheet1!$AP$13:$AP$62=B5),2,TRUE),"None Today"); iferror(sort(FILTER(Sheet1!$AQ$13:$AR$62,Sheet1!$AS$13:$AS$62=B5),2,TRUE),"None Today"); iferror(sort(FILTER(Sheet1!$AT$13:$AU$62,Sheet1!$AV$13:$AV$62=B5),2,TRUE),"None Today"); iferror(sort(FILTER(Sheet1!$AW$13:$AX$62,Sheet1!$AY$13:$AY$62=B5),2,TRUE),"None Today"); iferror(sort(FILTER(Sheet1!$AZ$13:$BA$62,Sheet1!$BB$13:$BB$62=B5),2,TRUE),"None Today"); iferror(sort(FILTER(Sheet1!$BC$13:$BD$62,Sheet1!$BE$13:$BE$62=B5),2,TRUE),"None Today"); iferror(sort(FILTER(Sheet1!$BF$13:$BG$62,Sheet1!$BH$13:$BH$62=B5),2,TRUE),"None Today"); iferror(sort(FILTER(Sheet1!$BI$13:$BJ$62,Sheet1!$BK$13:$BK$62=B5),2,TRUE),"None Today"); iferror(sort(FILTER(Sheet1!$BL$13:$BM$62,Sheet1!$BN$13:$BN$62=B5),2,TRUE),"None Today"); iferror(sort(FILTER(Sheet1!$BO$13:$BP$62,Sheet1!$BQ$13:$BQ$62=B5),2,TRUE),"None Today"); iferror(sort(FILTER(Sheet1!$BR$13:$BS$62,Sheet1!$BT$13:$BT$62=B5),2,TRUE),"None Today"); iferror(sort(FILTER(Sheet1!$BU$13:$BV$62,Sheet1!$BW$13:$BW$62=B5),2,TRUE),"None Today"); iferror(sort(FILTER(Sheet1!$BX$13:$BY$62,Sheet1!$BZ$13:$BZ$62=B5),2,TRUE),"None Today"); iferror(sort(FILTER(Sheet1!$CA$13:$CB$62,Sheet1!$CC$13:$CC$62=B5),2,TRUE),"None Today"); iferror(sort(FILTER(Sheet1!$CD$13:$CE$62,Sheet1!$CF$13:$CF$62=B5),2,TRUE),"None Today"); iferror(sort(FILTER(Sheet1!$CG$13:$CH$62,Sheet1!$CI$13:$CI$62=B5),2,TRUE),"None Today"); iferror(sort(FILTER(Sheet1!$CJ$13:$CK$62,Sheet1!$CL$13:$CL$62=B5),2,TRUE),"None Today"); iferror(sort(FILTER(Sheet1!$CM$13:$CN$62,Sheet1!$CO$13:$CO$62=B5),2,TRUE),"None Today"); iferror(sort(FILTER(Sheet1!$CP$13:$CQ$62,Sheet1!$CR$13:$CR$62=B5),2,TRUE),"None Today"); iferror(sort(FILTER(Sheet1!$CS$13:$CT$62,Sheet1!$CU$13:$CU$62=B5),2,TRUE),"None Today"); iferror(sort(FILTER(Sheet1!$CV$13:$CW$62,Sheet1!$CX$13:$CX$62=B5),2,TRUE),"None Today"); iferror(sort(FILTER(Sheet1!$CY$13:$CZ$62,Sheet1!$DA$13:$DA$62=B5),2,TRUE),"None Today"); iferror(sort(FILTER(Sheet1!$DB$13:$DC$62,Sheet1!$DD$13:$DD$62=B5),2,TRUE),"None Today"); iferror(sort(FILTER(Sheet1!$DE$13:$DF$62,Sheet1!$DG$13:$DG$62=B5),2,TRUE),"None Today")} Each FILTER's first argument refers to two columns that contain the text I want to be returned based on the second argument as a condition (in this case equaling B5 or 1). The sort function organizes this alphabetically. However, if one of these FILTER formulas does not filter ANY results that equal B5 (or 1), the entire array function fails. How can I resolve this? Data lies on Sheet1 The array is placed in B6 on Sheet2 AI: ...understanding the ARRAY_LITERAL ERROR: until both queries/filters output something then all is good: however if one of those queries/filters doesn't have anything to output it outputs #N/A - No matches are found in QUERY/FILTER evaluation. - the issue is that #N/A is only in the 1st cell: but array expects that matrix on both sides to be same (4 columns from both queries/filters): so we wrap each query into IFERROR and in case of error we output fake row with 4 fake columns - {"","","",""} - which will trick the array to output it like: therefore try like this: ={IFERROR(SORT(FILTER(Sheet1!$AH$13:$AI$62,Sheet1!$AJ$13:$AJ$62=B5),2,1),{"None Today",""}); IFERROR(SORT(FILTER(Sheet1!$AK$13:$AL$62,Sheet1!$AM$13:$AM$62=B5),2,1),{"None Today",""}); IFERROR(SORT(FILTER(Sheet1!$AN$13:$AO$62,Sheet1!$AP$13:$AP$62=B5),2,1),{"None Today",""}); IFERROR(SORT(FILTER(Sheet1!$AQ$13:$AR$62,Sheet1!$AS$13:$AS$62=B5),2,1),{"None Today",""}); IFERROR(SORT(FILTER(Sheet1!$AT$13:$AU$62,Sheet1!$AV$13:$AV$62=B5),2,1),{"None Today",""}); IFERROR(SORT(FILTER(Sheet1!$AW$13:$AX$62,Sheet1!$AY$13:$AY$62=B5),2,1),{"None Today",""}); IFERROR(SORT(FILTER(Sheet1!$AZ$13:$BA$62,Sheet1!$BB$13:$BB$62=B5),2,1),{"None Today",""}); IFERROR(SORT(FILTER(Sheet1!$BC$13:$BD$62,Sheet1!$BE$13:$BE$62=B5),2,1),{"None Today",""}); IFERROR(SORT(FILTER(Sheet1!$BF$13:$BG$62,Sheet1!$BH$13:$BH$62=B5),2,1),{"None Today",""}); IFERROR(SORT(FILTER(Sheet1!$BI$13:$BJ$62,Sheet1!$BK$13:$BK$62=B5),2,1),{"None Today",""}); IFERROR(SORT(FILTER(Sheet1!$BL$13:$BM$62,Sheet1!$BN$13:$BN$62=B5),2,1),{"None Today",""}); IFERROR(SORT(FILTER(Sheet1!$BO$13:$BP$62,Sheet1!$BQ$13:$BQ$62=B5),2,1),{"None Today",""}); IFERROR(SORT(FILTER(Sheet1!$BR$13:$BS$62,Sheet1!$BT$13:$BT$62=B5),2,1),{"None Today",""}); IFERROR(SORT(FILTER(Sheet1!$BU$13:$BV$62,Sheet1!$BW$13:$BW$62=B5),2,1),{"None Today",""}); IFERROR(SORT(FILTER(Sheet1!$BX$13:$BY$62,Sheet1!$BZ$13:$BZ$62=B5),2,1),{"None Today",""}); IFERROR(SORT(FILTER(Sheet1!$CA$13:$CB$62,Sheet1!$CC$13:$CC$62=B5),2,1),{"None Today",""}); IFERROR(SORT(FILTER(Sheet1!$CD$13:$CE$62,Sheet1!$CF$13:$CF$62=B5),2,1),{"None Today",""}); IFERROR(SORT(FILTER(Sheet1!$CG$13:$CH$62,Sheet1!$CI$13:$CI$62=B5),2,1),{"None Today",""}); IFERROR(SORT(FILTER(Sheet1!$CJ$13:$CK$62,Sheet1!$CL$13:$CL$62=B5),2,1),{"None Today",""}); IFERROR(SORT(FILTER(Sheet1!$CM$13:$CN$62,Sheet1!$CO$13:$CO$62=B5),2,1),{"None Today",""}); IFERROR(SORT(FILTER(Sheet1!$CP$13:$CQ$62,Sheet1!$CR$13:$CR$62=B5),2,1),{"None Today",""}); IFERROR(SORT(FILTER(Sheet1!$CS$13:$CT$62,Sheet1!$CU$13:$CU$62=B5),2,1),{"None Today",""}); IFERROR(SORT(FILTER(Sheet1!$CV$13:$CW$62,Sheet1!$CX$13:$CX$62=B5),2,1),{"None Today",""}); IFERROR(SORT(FILTER(Sheet1!$CY$13:$CZ$62,Sheet1!$DA$13:$DA$62=B5),2,1),{"None Today",""}); IFERROR(SORT(FILTER(Sheet1!$DB$13:$DC$62,Sheet1!$DD$13:$DD$62=B5),2,1),{"None Today",""}); IFERROR(SORT(FILTER(Sheet1!$DE$13:$DF$62,Sheet1!$DG$13:$DG$62=B5),2,1),{"None Today",""})}
H: Submit response but not submit? I have a form for timesheet, that each row is a different job description, job number, hours booked to job etc. I have it so when you submit, it fills in the response sheet in order from top to bottom. Problem I have is I want to run some functions set by a trigger that sends a copy of the sheet, then deletes the data and resets it so the new responses start at the top, but I only want this trigger to run after all the response lines are filled. So basically I use submit to send each response, but I have several responses to input before this can happen. Is there a script that lets the response sheet rows be filled with the data as if submitted, but won't run the trigger until the final submition? If this makes sense. Thanks AI: How to make out when the final response is received? Do you want to get exactly xx responses to trigger the event? Forms does not work like this. It will much better if you can have a column with header "Updated". You can set up a trigger "on form submit" which will run when you receive a row. You can do whatever you want (like taking the values to a new sheet etc) and you can update the "updated" column with the date and time function onFormSumbit(e) { var item1 = e.source.getActiveSheet().getRange(e.range.rowStart,1).getValue(); var item2 = e.source.getActiveSheet().getRange(e.range.rowStart,2).getValue(); var item3 = e.source.getActiveSheet().getRange(e.range.rowStart,3).getValue(); //now do whatever you want (like populating a new sheet, send email etc) //update a column in the sheet with today - mark it is processed. }
H: Google Drive link parameter to hint which account (email) to access with Is it possible to construct a link to a Google Drive file and specify the email account to access the file as? I know that it is possible to use /u/1 or /u/2 in the path, but I am looking at generating a link to send to users who own multiple Google accounts, and I want to make it easy for them to access the file with the account which has read/write access, as opposed to accessing with an account which has readonly access. I think I have seen something like https://drive.google.com/open?id=123882182828&email=user@example.com but cannot recall where. AI: The authuser parameter can take both the number which is used in the /u/ part of the path, or an email address. So, appending this query parameter: authuser=email@example.com will make google drive use this account, if it is in the list of signed in accounts. E.g., https://drive.google.com/open?id=123882182828&authuser=user@example.com
H: Outputing Array Formula in one row I came across the below array formula, which works really well, I'm just struggling to tweak it, and barely understand it's inner workings, but it's very good. Instead of displaying a total of stock left per line, I wondered if someone could help me keep it on one line? Example on Google link below. Formula: =ARRAYFORMULA({"";IF(B4:B&C4:C="",,MMULT((VLOOKUP(ROW(A4:A),FILTER({ROW(A4:A),A4:A},A4:A<>""),2,1)=TRANSPOSE(VLOOKUP(ROW(A4:A),FILTER({ROW(A4:A),A4:A},A4:A<>""),2,1)))*(ROW(A4:A)>=TRANSPOSE(ROW(A4:A))),B4:B-C4:C))}) Google link: https://docs.google.com/spreadsheets/d/1YqG3KwGzIJCiYwSBicfct8MSKSppUtE8RTB-6iY1C8Q/edit#gid=0 AI: ={""; ARRAYFORMULA(IF(B4:B<>"", IFERROR(VLOOKUP(A4:A, QUERY(QUERY(QUERY(A4:C, "select A,sum(B),sum(C) where A is not null group by A label sum(B)'',sum(C)''", 0), "select Col1,Col2-Col3 label Col2-Col3''", 0), "where Col2 > 0", 0), 2, 0)), ))}
H: In ARRAY_LITERAL, an Array Literal was missing values for one or more rows I've been trying to get this array formula to work, but I get an error. It's just a vlookup array to display multiple columns. It works fine without the {""; bit, but I want it to drop down one row. ={"";ARRAYFORMULA(IFERROR(VLOOKUP($AA$4:$AA,CUSTOMER_DATA,{2,3,4,5,6},FALSE),""))} Without =ARRAYFORMULA(IFERROR(VLOOKUP($AA$4:$AA,CUSTOMER_DATA,{2,3,4,5,6},FALSE),"")) How do I get this to work? AI: ...understanding the ARRAY_LITERAL ERROR: until both queries/filters/formulas output something then all is good: however if one of those queries/filters/formulas doesn't have anything to output it outputs #N/A - No matches are found in QUERY/FILTER evaluation. - the issue is that #N/A is only in the 1st cell: but array expects that matrix on both sides to be same (4 columns from both queries/filters/formulas): so we wrap each query into IFERROR and in case of error we output fake row with 4 fake columns - {"","","",""} - which will trick the array to output it like: therefore try like this: ={{"","","","",""}; ARRAYFORMULA(IFERROR(VLOOKUP(AA4:AA, CUSTOMER_DATA, {2,3,4,5,6}, 0)))}
H: Skip arrayformula if the result of that formula is blank I have an array formula that looks like this: =ArrayFormula(IF(COUNTIF(B2:B, QUERY('Form Responses'!B2:G, "select G where B != ''"))=0, IFERROR(QUERY('Form Responses'!B2:G, "select B, G where B != ''"), ""))) It retrieves data from a different sheet that's connected to Google Forms. With the first IF and COUNTIF I try to check whether the G column from the form response sheet is already present in the B column in my current sheet. If that is not the case, I query column B and G. However, if the value is present already, I don't want to query it, but I also don't want an empty line, which is now happening because of the "" as the third argument for the IF statement. Is there a way in which I can only query if not a duplicate, without adding an empty line otherwise? AI: the "" is part of IFERROR not IF therefore try: =QUERY(ARRAYFORMULA(IF(COUNTIF(B2:B, IFERROR(QUERY('Form Responses'!B2:G, "select G where B !=''", 0)))=0, IFERROR(QUERY('Form Responses'!B2:G, "select B,G where B !=''", 0)), )), "where Col1 is not null", 0)
H: Conversion from LibreOffice to Google Sheets I use LibreOffice to create xlsx files. There are some formulas to test conditions. Everything is ok under LibreOffice but when I open the file with Google Sheets formulas give the wrong result. e.g. the following formula =IF(C32="","",IF(COUNTIF(C6:C28,"SA|PA|MA|PB|MB")=C32,"0",COUNTIF(C6:C28,"SA|PA|MA|PB|MB")-C32)) gives activates the second COUNTIF as if was an error. Some explanations: C32 = 5 C6:C28 contains 5 of the required pars (SA|PA|....) So I expect the value of 0 but I receive a -5 result. Hope I was clear. AI: =ARRAYFORMULA(IF(LEN(C32), IF(SUM(N(REGEXMATCH(C6:C28, "SA|PA|MA|PB|MB")))=C32, "0", SUM(N(REGEXMATCH(C6:C28, "SA|PA|MA|PB|MB")))-C32), )) alternatives: =IF(C32<>"", IF(COUNTIF(C6:C28, "SA")+ COUNTIF(C6:C28, "PA")+ COUNTIF(C6:C28, "MA")+ COUNTIF(C6:C28, "PB")+ COUNTIF(C6:C28, "MB")=5, 0, COUNTIF(C6:C28, "SA")+ COUNTIF(C6:C28, "PA")+ COUNTIF(C6:C28, "MA")+ COUNTIF(C6:C28, "PB")+ COUNTIF(C6:C28, "MB")-C32), ) =ARRAYFORMULA(IF(LEN(C32), IF(SUM(COUNTIF(C6:C28, {"SA"; "PA"; "MA"; "PB"; "MB"}))=5, 0, SUM(COUNTIF(C6:C28, {"SA"; "PA"; "MA"; "PB"; "MB"}))-C32), ))
H: How can I float text by text in Google Docs See the attached image below, which shows that a side-note is added so that the normal text of the document "floats around it": How is that technique called - Is there a name for it? And how can I accomplish that in Google Docs? AI: It is called text wrap and you can do it in Google Docs for example like this: If you want to do it with text box instead of an image add Drawing (Insert > Drawing...)
H: Pull image or skip to next cell if empty I am currently using Google Sheets to make a list of videos and thumbnails. I have various sheets titled: Frying, Stewing, Baking, etc. Within each sheet, there are only two columns which include a thumbnail image and a text link. I would like to create a page which pulls the images from all these sheets into a column. I have been using: =Baking!A2 =Baking!A3 which outputs the thumbnail images that I wanted. The problem with this is, I have to copy/paste the formula each time I add something to a list. Is there a formula which does something similar to: Check if the sheet1 A3 is empty; if true: skip to sheet2/3/4-100 A3 if not empty: output image. Here is an example sheet https://docs.google.com/spreadsheets/d/1miRsEzIuSWVpwAbcVWWHIp74jVo2nJ8rOE8K61vJ_gQ/edit?usp=sharing AI: you can solve this with ARRAYFORMULA like for example: =ARRAYFORMULA(Baking!A2:A) if you want to skip empty cells use FILTER like: =FILTER(Baking!A2:A, Baking!A2:A<>"") if you want to continue with next sheet use {} brackets to construct range (paste in A2 cell and drag to the right with a blue square): =FILTER({Frying!A2:A; Baking!A2:A; Stewing!A2:A}, {Frying!A2:A; Baking!A2:A; Stewing!A2:A}<>"") spreadsheet demo
H: Dynamically creating column names based on data in another tab I have a Google sheet that logs all submissions on my website of various contact forms. I need to know how many times each contact form has been submitted, and in which week they were submitted. The goal is to have a Google sheet to look like this: (Each tab in the Google sheet is the same name of these forms) Week Commencing | Number of Submissions 1st July 2019 | 37 8th July 2019 | 7 The data I have looks like this: (in a tab named "data") form name | date Custom Printed Premium Gift Boxes | 7/4/2019 12:01:28 Link to google sheet: https://docs.google.com/spreadsheets/d/1ffOVvGT7CGV3gXR1HP5kp6Pg1JgD40qRjlt6lwwFbo0/edit?usp=sharing My questions: How do I count the submissions from the data tab and put the total, by the week, into the correct tab? How do I get the week number, convert it to a correct row title of "1st July 2019" and then have the number of submissions for that very week go into the correct cell? Is there a better way to achieve what I'm doing? Am I square peg/round hole-ing? AI: to derive week number: =ARRAYFORMULA(IF(LEN(B2:B), WEEKNUM(B2:B, 2), )) to convert it into the 1st day of each week number: =ARRAYFORMULA(IF(LEN(B2:B), VLOOKUP(WEEKNUM(B2:B, 2), {WEEKNUM(ROW(INDIRECT("A"&DATEVALUE(MIN(B2:B))-7&":"& DATEVALUE(MAX(B2:B)))), 2), TEXT(ROW(INDIRECT("A"&DATEVALUE(MIN(B2:B))-7&":"& DATEVALUE(MAX(B2:B)))), "d. mmmm yyyy")}, 2, 0), )) to create full summary table: =ARRAYFORMULA(QUERY(IF(LEN(B2:B), {VLOOKUP(WEEKNUM(B2:B, 2), {WEEKNUM(ROW(INDIRECT("A"&DATEVALUE(MIN(B2:B))-7&":"& DATEVALUE(MAX(B2:B)))), 2), TEXT(ROW(INDIRECT("A"&DATEVALUE(MIN(B2:B))-7&":"& DATEVALUE(MAX(B2:B)))), "d. mmmm yyyy")}, 2, 0), A2:A}, ), "select Col2,Col1,count(Col1) where Col1 is not null group by Col1,Col2 label count(Col1)''")) to put it into correct tab (with script - manual recalculation): function sheetName() { return SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().getName(); } =ARRAYFORMULA(QUERY(QUERY(IF(LEN(data!B2:B), {VLOOKUP(WEEKNUM(data!B2:B, 2), {WEEKNUM(ROW(INDIRECT("A"&DATEVALUE(MIN(data!B2:B))-7&":"& DATEVALUE(MAX(data!B2:B)))), 2), TEXT(ROW(INDIRECT("A"&DATEVALUE(MIN(data!B2:B))-7&":"& DATEVALUE(MAX(data!B2:B)))), "d. mmmm yyyy")}, 2, 0), data!A2:A}, ), "select Col2,Col1,count(Col1) where Col1 is not NULL group by Col1,Col2 label count(Col1)''", 0), "select Col2,Col3 where Col1='"&SHEETNAME()&"'", 0)) to put it into correct tab (without script - manual input) =ARRAYFORMULA(QUERY(QUERY(IF(LEN(data!B2:B), {VLOOKUP(WEEKNUM(data!B2:B, 2), {WEEKNUM(ROW(INDIRECT("A"&DATEVALUE(MIN(data!B2:B))-7&":"& DATEVALUE(MAX(data!B2:B)))), 2), TEXT(ROW(INDIRECT("A"&DATEVALUE(MIN(data!B2:B))-7&":"& DATEVALUE(MAX(data!B2:B)))), "d. mmmm yyyy")}, 2, 0), data!A2:A}, ), "select Col2,Col1,count(Col1) where Col1 is not NULL group by Col1,Col2 label count(Col1)''", 0), "select Col2,Col3 where Col1='Contact Form'", 0))
H: Auto forward non alias emails to our G Suite domain To group emails from projects we send them to a project mail address (for example all mails of project "Vanardenne" are sent to "Vanardenne@reekmansverandabouw.be". To achieve this we make an extra alias. Is there a way to automatically forward these emails without having to make the alias? AI: You can add a plus sign and any word before the @ sign (e.g. emma.grey+project.1@gmail.com) and messages will still reach you. This way you can create an unlimited amount of new/unique email addresses for each occasion you need like: your.regular.email+Vanardenne@reekmansverandabouw.be
H: Adding date picker to Google Sheets cells while data validation is customized I have a column with customized data validation (custom formula) that accepts only dates, provided that a few other conditions are met. How can I add a date picker to the cells of this column? Changing the Format did not help. Edit: I want to pre-program my cells to have a date picker, just like they would have if the Data Validation criterion were set to Date. A good workaround is provided by @user0, but I am still interested to know if this is directly possible. AI: Unfortunately, you can't. Date picker in Google Sheets is available only when a cell contains a valid date. Empty cells can be pre-programmed to offer you the date picker (via Data Validation), but not if you use a custom formula in Data Validation. Your next best option is to have a chosen pre-programmed date, for example, like 1/1/1900 and have it hidden with white font color via Conditional Formatting. This way the date picker will be available in cells that look like they are empty until a different date is set.
H: How can I change the font of selected text within a cell in Google Sheets using keyboard shortcuts? I am attempting to change the font of selected text within a cell in Google Sheets using a keyboard shortcut. I have attempted the steps meant for google docs here: How can I change the font in Google Docs just with keyboards shortcuts? None of these steps have worked for me while inside the cell. I have also tried creating a macro (tools -> macro) that manually selects the font that I want, however, this does not work. I have not been able to change an active selection from within a cell without using the mouse. Any and all help is appreciated. AI: This is only possible to achieve manually: Unfortunately, it's only possible with the mouse, because the font selector can't be triggered from a cell that is being edited via keyboard shortcuts. So the manual sequence is: select cell to be edited press ENTER to enter editing mode navigate further with arrow keys make a selection with holding SHIFT + arrow keys when text selected pick a font with your mouse
H: Entire Column green if all cells in it are empty I would like all columns that only contain empty cells to light up green. In the below picture these should be: C3:C8, D3:D8, E3:E8, L3:L8 What would be the correct custom formula for this? Bonus question: I would also like columns that contain only a question mark (so no x) to show up yellow, what would be the correct formula for this? AI: custom formula for range B3:O8 =NOT(COUNTIF(B$3:B$8, "<>")) custom formula for range B3:O8 =FIND("?",A$3&A$4&A$5&A$6&A$7&A$8)
H: Google Sheets Split row in multiple rows I'm doing a spreadsheet for an event and I need to split a row into multiple rows. It's getting data from a form. I need a script that can arrange the data like in the blue rectangle. AI: ={Sheet1!A1:D1; ARRAYFORMULA(TRIM(SPLIT(TRANSPOSE(SPLIT(TRIM(QUERY(TRANSPOSE(QUERY(TRANSPOSE(IF(LEN({ IF(LEN(Sheet1!B2:B); "♣"&Sheet1!B2:B&"♣"&Sheet1!C2:C&"♣"&Sheet1!D2:D;)\ IF(LEN(Sheet1!E2:E); "♣"&Sheet1!E2:E&"♣"&Sheet1!F2:F&"♣"&Sheet1!G2:G;)\ IF(LEN(Sheet1!H2:H); "♣"&Sheet1!H2:H&"♣"&Sheet1!I2:I&"♣"&Sheet1!J2:J;)}); "♦"&Sheet1!A2:A&{ IF(LEN(Sheet1!B2:B); "♣"&Sheet1!B2:B&"♣"&Sheet1!C2:C&"♣"&Sheet1!D2:D;)\ IF(LEN(Sheet1!E2:E); "♣"&Sheet1!E2:E&"♣"&Sheet1!F2:F&"♣"&Sheet1!G2:G;)\ IF(LEN(Sheet1!H2:H); "♣"&Sheet1!H2:H&"♣"&Sheet1!I2:I&"♣"&Sheet1!J2:J;)};)) ;;999^99));;999^99)); "♦")); "♣")))} spreadsheet demo ={Sheet1!A1:H1; ARRAYFORMULA(TRIM(SPLIT(TRANSPOSE(SPLIT(TRIM(QUERY(TRANSPOSE(QUERY(TRANSPOSE(IF(LEN({ IF(LEN(Sheet1!F2:F); "♣"&Sheet1!F2:F&"♣"&Sheet1!G2:G&"♣"&Sheet1!H2:H;)\ IF(LEN(Sheet1!I2:I); "♣"&Sheet1!I2:I&"♣"&Sheet1!J2:J&"♣"&Sheet1!K2:K;)\ IF(LEN(Sheet1!L2:L); "♣"&Sheet1!L2:L&"♣"&Sheet1!M2:M&"♣"&Sheet1!N2:N;)}); "♦"&Sheet1!A2:A&"♣"&Sheet1!B2:B&"♣"&Sheet1!C2:C&"♣"&Sheet1!D2:D&"♣"&Sheet1!E2:E&{ IF(LEN(Sheet1!F2:F); "♣"&Sheet1!F2:F&"♣"&Sheet1!G2:G&"♣"&Sheet1!H2:H;)\ IF(LEN(Sheet1!I2:I); "♣"&Sheet1!I2:I&"♣"&Sheet1!J2:J&"♣"&Sheet1!K2:K;)\ IF(LEN(Sheet1!L2:L); "♣"&Sheet1!L2:L&"♣"&Sheet1!M2:M&"♣"&Sheet1!N2:N;)};)) ;;999^99));;999^99)); "♦")); "♣")))} spreadsheet demo
H: How to get an array for a range per a column in Google Sheets? I'm looking for creating a similar formula: =UNIQUE({A:A;B:B;C:C}) So, I need such kind of a range {A2:A;B2:B;C2:C;...} (each column separated with the semicolon) for several hundred columns. Seem, it will be a mess if I will try to type it manually. Can it be done by Google Sheets features? AI: drag down the A9 cell with the blue square as much down as you need retrieve your formula from C2 cell formula generator spreadsheet demo
H: Force Google Docs/Sheets to ALWAYS paste values only (merge formatting) I do a LOT of copying from external sources and pasting into Google Docs/Sheets. Is this at all possible? I know the keyboard shortcut but can't seem to get used to it. Would save me so much time! AI: Google Sheets & Google Docs does not allow to alter internal keyboard shortcuts so your options are: get used to official keyboard shortcut - CTRL + SHIFT + V remap your keyboard To easily remap your keyboard shortcut you can use powerful AutoHotKey script: IfWinActive, ahk_exe Chrome.exe { ^+V:: ;CTRL+SHIFT+V Send, {F2} return } Above example takes the given keyboard shortcut and binds it to F2 key. Resources: https://www.autohotkey.com/ https://www.autohotkey.com/docs/KeyList.htm https://www.autohotkey.com/docs/commands/WinActive.htm https://www.pcmag.com/feature/362116/how-to-remap-your-keyboard/3
H: How to format clipboard text as data row in Google Sheets? I've noticed copying text with a link preserves the link when pasted in Google Sheets. I've also tried copying an inline list from an HTML page and noticed it gets copied as two rows. Is it possible to format text such that it gets pasted as a single row and two columns in Google Sheets? If so, how? (I have control of the text being copied and I can use a bit of GApps JS) AI: Most likely you are looking for direct transposed paste which is supported in Google Sheets via keyboard shortcut combo: LEFT ALT + E + S + E (for Windows+Chrome) CONTROL + OPTION + E + S + E (for OSX) Also can be accessed via Special Paste: You are able to paste CSV data as is into the spreadsheet and go to Data selecting Split text to columns... and even further specifying the delimiter: Also, you can simply use keyboard shortcut combo: LEFT ALT + D + E (for Windows+Chrome) CONTROL + OPTION + D + E (for OSX)
H: How to setup a folder for other people drop photos into? I want to give people a link and have them click on the link and then be presented with a page where they can drag and drop photos into. I've tried doing it on OneDrive but that requires everyone to have an MS account. I've also tried Dropbox, but they want to send email invites to people. This doesn't work for me because I'd have to go collect emails which they may or may not read ever read. As far as Google Photos go, I am unclear on how to even set up a shared folder for others to access. So is it possible for what I want? I am open to any cloud provider or social network or whatever. AI: Well, there is a https://dropevent.com/ which may serve your purpose: Another option would be to create a OneDrive account with a shared folder that allows editing. Users, however, will not be allowed to anonymously upload files so you would need to set up a second OneDrive account and give your buddies the login details of the second account and they could use those credentials to upload files via a browser. Of course, this isn't a troll-proof solution. The proper way would be to set up an FTP server/folder for example with FileZilla (portable version is available too).
H: For polynomial prove that $r(x)=0$ or $\deg [r_k(x)]<\deg [b(x)]$ Suppose $a(x),b(x)\in \mathbb R[x]$, $\deg(b(x)) \geq 1$. Show that there exists $m=0,1,\dots$ and $r_0(x),\dots,r_m(x)\in\mathbb R[x]$ such that $$ a(x)=r_0(x)+r_1(x)b(x) + \cdots + r_m(x)b(x)^m$$ with the property that either $r_k(x)=0$ or $\deg[r_k(x)] < \deg[b(x)]$ for all $k = 0,1,\dots$. Is it possible to use induction for this question? Thank you. AI: Let $d$ be the degree of $b(x)$. We show by induction on $n$ that the result is true for all polynomials of degree $\lt nd$. For the induction step, we need to show that if the result is true for all $a(x)$ of degree $\lt nd$, then it is true for all $a(x)$ of degree $\lt (n+1)d$. So we only need to deal with $a(x)$ of degree $\ge nd$, and $\lt (n+1)d$. For the proof of the induction step. we can proceed as follows. By the ordinary "Division Algorithm" for polynomials, there is an $r_0(x)$ with the right degree restriction, and a polynomial $q(x)$, such that $a(x)=r_0(x)+q(x)b(x)$. Show that $q(x)$ has degree $\lt nd$. Then by the induction hypothesis $q(x)$ can be expressed in the right form, and now from $a(x)=r_0(x)+q(x)b(x)$ we get the right form for $a(x)$. Note that this is an analogue for polynomials of the ordinary base $b$ expansion of positive integers.
H: On the primality of integers of the form $p^2+k$ I am not able to find an answer to the following question: For which positive even integers $k$ is the integer $$p^2+k$$ prime, where $p$ is a prime number $\gt5$? AI: $p^2 \equiv 1(\mod 3)$ $p^2+ k \not \equiv 0(\mod 3) \implies k $ is of form $3n$ or $3n+1$. $p^2 \equiv 1(\mod 2) \implies k \equiv 0( \mod 2)$ (since it is the stronger condition) You can get $k$ in $(\mod 6)$,using CRT. Similarily, you have $p^2 \equiv \pm 1\mod 5 \implies k \equiv 2,3$ or $0(\mod 5)$ . You can use CRT again to get $k \equiv x(\mod 30)$, you get a stronger condition. Note that $\gcd(3,4)
H: Find quotient space on $\mathbb{N} $ On $\mathbb{N}$ is given equivalence relation R with $nRm \iff 4|n-m$. Topology on $\mathbb{N}$ is defined with $\tau=\{\emptyset\}\cup\{U\subseteq\mathbb{N}|n\in U \wedge m|n \implies m\in U\}$. I need to find quotient space $(\mathbb{N}/R,\tau_{R})$. I have solution: $\tau_{R}=\{\emptyset,\mathbb{N}/R,\{[1],[2],[3]\}\}$ where $\mathbb{N}/R=\{[1],[2],[3],[4]\}$. But I have no idea how to prove that $p^{-1}[\{[1],[2],[3]\}]=\cup_{k\in \mathbb{N}_0}\{4k+1,4k+2,4k+3\}$, where $p$ is quotient mapping, contains all divisors of its elements. (for other set it's easy to find element whose divisor is not in set) AI: Note that $p^{-1}(\{[1],[2],[3]\}) = \mathbb{N}\backslash 4\mathbb{N}$. We need to prove that $n\in\mathbb{N}\backslash 4\mathbb{N}$ and $m|n$ implies $m\in\mathbb{N}\backslash 4\mathbb{N}$ and we do this by contraposition. Suppose $m\notin\mathbb{N}\backslash 4\mathbb{N}$, then $m = 4k$ and thus $m|n$ implies $n = pm = 4pk$, hence $n\notin\mathbb{N}\backslash 4\mathbb{N}$ concluding the argument.
H: example of a particular type of graph I am searching for those classes of graphs where distance between any two vertices of the graph is $d$. Are there such type of graphs, after leaving the $Complete Graphs, K_n$. Thanks for your help. AI: I'd say no. If the graph is not complete, there are going to be two nodes $a$,$b$ without an edge $(a,b)$. Pick a path from $a$ to $b$, and let $n > 1$ be its length. Then the distance from $a$ to $b$ is $nd \neq d$. Unless of course, $d=0$, i.e. unless you assign the weight $0$ to every edge. This assumes that the graph is connected. If you require distance $d$ only for vertices which are reachable from one another, possible solutions are graphs whose connected components are complete graphs.
H: How to find the intersection of two given lines How to find intersection of two lines below: $$ \left \{ \begin{array}{ccc} 3x − 2y & = & 5\\ 7x + 3y & = & 4 \end{array} \right . $$ I know the answer is $(1,-1)$, but I cannot find it with the methods. I have already tried to solve pairs of linear equations. AI: try to equal any variable's coefficient in both eqn,either x or y.I take y to equal the coefficient.multiply 1st eqn by 3(2nd eqns y variable) and 2nd eqn by 2(1st eqns y variable) $$ (3x − 2y = 5)\cdot3$$ $$(7x + 3y = 4)\cdot2 $$ now eqn will be: $$ 9x − 6y = 15$$ $$14x + 6y = 8 $$ now add both eqn side by side $$9x − 6y +14x + 6y = 15+8$$ $$23x=23$$ $$x=1$$ put this value of x in any eqn .I am taking 2nd eqn. $$7\cdot(1)+3y=4$$ $$7+3y=4$$ $$3y=4-7$$ $$3y=-3$$ $$y=-1$$ so answer will be x=1 and y=-1 this is called elimination method
H: Infinitely many solutions vs one solution vs no solution in systems involving an unknown constant Just need a little clarification in case my assumptions are incorrect. If I were to have the matrix {{1, 3, 3}, {2, 7, 6}, {1, 4, k^2 - 18}} * {x1, x2, x3} = {1, 3, k+1} which has a row echelon form of: {{1, 3, 3}, {0, 1, -12}, {0, 0, 1}} * {x1, x2, x3} = {1, 3, (k - 3)/(k^2 - 9)} , didn't want to reduce any further to avoid dealing with that ugly fraction. would it be the case where k = 3, -3 that would be no solution? I mean logically I suppose so but in terms of linear algebra I thought no solution required an inconsistency and not an undefined point. Or would an undefined k value make for an inconsistency? for one solution is it right to assume any unique result? suppose I chose k = 0, then would the unique solution be whatever I get from plugging in? And if so is it safe to assume that we have infinitely many unique solutions so long k does not equal 3, -3? and for infinitely many solutions is it again the case where any result so long k does not equal 3, -3? I would really appreciate a response with an explanation that can be understood. Thank you. oh and how would k = 3 play into the solutions? since if we were to simplify (k -3)/(k^2 - 9) we would end up with 1/(k+3) in which case k = 3 fails for the former but is valid for the latter. AI: This is a case where complete row reduction is preferred, and leads to different values of $k$ to avoid: The complete row reduction leads to $$x_1=\frac{3-3k}{k^2-21}-2,\\ x_2=1,\\ x_3=\frac{k-1}{k^2-21}.$$ So the only cases where the solution might not be unique are when $k = \pm \sqrt{21}.$ A good way to deal with these, which avoids the "zero divide" in the above equations, and issues of undefined answers, is just to substitute $k=\pm \sqrt{21}$ into the original matrix having the formulas in it, and row reduce each. Neither has any solution, i.e. both particular systems are inconsistent, in this case. ADDED: I checked, and found your not-completely reduced matrix is off. It should have row 1 as $[1,3,3,1]$, row 2 as $[0,1,0,1]$, and the crucial row 3 as $$[0,0,1,(k-1)/(k^2-21)].$$ Thus you would be led to the same question about the only exceptions possible being $k=\pm \sqrt{21}$ which come from the completely reduced matrix. So the same course of action would be suggested, namely to substitute $k=\pm \sqrt{21}$ into the original system, obtaining matrices with only numbers, which would then be row reduced in the usual way to see if consistent. Note that before division the last row reads as $$[0,0,k^2-21,k-1].$$ So even here, without going back to the original system, you can see directly that if $k=\pm \sqrt{21}$ the last row reads $[0,0,0,(\pm \sqrt{21}-1]$ so the last entry is nonzero, making the system inconsistent. This avoids the plugging in of the radical expression for $k$ into the original system.
H: $\cos(x)+\cos(x\sqrt{2})$ is not periodic Show that the function $$f(x)=\cos(x)+\cos(x\sqrt{2})$$ is not periodic. I tried $x = a$ and $a\sqrt{2}$. I am guessing that the method of contradiction would be of some help over here. What else should I try? AI: Assume $ \cos(x) + \cos(\sqrt{2} x) = \cos(x+T) + \cos(\sqrt{2} x+ \sqrt{2} T) $. Let $x=0$. Then $$2=\cos T + \cos \sqrt{2}T$$ Since the cosine is at most one, this means that simultaneously $\cos T = 1$ and $\cos \sqrt{2} T = 1$. This is equivalent to: $$T = 2\pi n, \ \mbox{for some } n \in \mathbb{Z}$$ $$\sqrt{2}T = 2\pi m, \ \mbox{for some } m \in \mathbb{Z}$$ Substitute $T$ from the first into the second: $$\sqrt{2} (2\pi n)= 2\pi m$$ $$\sqrt{2}=\frac{m}{n}$$ So $\sqrt{2} \in \mathbb{Q}$ which is a contradiction, or $T=0$. Either way, you're done.
H: Reordering vector product If I have vectors $a, b, c \in \mathbb{R}^3$, and if we have e.g. $a = b\times c$, is there any way to express $b$ in terms of the other two? AI: Write out the vectors as $a=(a_1,a_2,a_3)$, and so on, do the cross product, set the two sides equal, and you'll get a system of three linear equations in the three unknown components of $b$.
H: How to solve expectation / first moment of Gaussian Integral? How can I solve the following integral? $E[I] = \int_{I=0}^\infty I \frac{1}{\sqrt{2\pi}\sigma}\exp(-\frac{(\mu-f-I)^2}{2\sigma^2}) dI$ The result is supposed to be: $\sigma[\frac{\mu - f}{\sigma}\Phi(\frac{\mu - f}{\sigma}) + \phi(\frac{\mu - f}{\sigma})]$, where $\Phi(.)$ and $\phi(.)$ are the Gaussian probability density function and the cumulative probability function. I tried integration by parts and variable substitution like done here. But neither approach gets me the solution. I would like to know the steps to get to the result. This whole thing is from Bayesian Optimisation, like here: p.23 E. Brochu, PhD Thesis 2010: Interactive Bayesian Optimization, https://circle.ubc.ca/bitstream/handle/2429/30519/ubc_2011_spring_brochu_eric.pdf?sequence=3 AI: Using the change of variable $\sigma x=\mu-f-I$ and the shorthand $\alpha=(\mu-f)/\sigma$, one sees that the integral to be computed is $$ J=\int_{-\infty}^\alpha\sigma\cdot(\alpha-x)\cdot\varphi(x)\mathrm dx. $$ The last piece of information you might need to conclude is that, since $x\varphi(x)=-\varphi'(x)$, $$ \int_{-\infty}^\alpha(-x)\cdot\varphi(x)\mathrm dx=\varphi(\alpha). $$
H: number of solutions to an equation? Given $x$ and $y$ are multiples of $2$ satisfying $$x^2 - y^2 = 27234702932$$ Find the number of solutions to $x$ and $y$. AI: As $27234702932=2^2\cdot181\cdot37616993$ where the last two factors are primes If $x=2X,y=2Y$ $$X^2-Y^2=181\cdot37616993$$ If $X^2-Y^2=p\cdot q$ where $p,q$ are primes, the possible cases for $X+Y,X-Y$ are $\pm pq, \pm 1$ and $\pm p,\pm q $ For example, if $X+Y=1,X-Y=pq$ The number of positive factors of $p\cdot q$ is $(1+1)\cdot(1+1)=4$ So, there should be $4\cdot2 =8$ solutions in integers.
H: Proof about that operator is self-adjoint In Linear Algebra: Suppose I have a matrix $A$ that represents the linear product (the Gramian matrix) Suppose I have a matrix $B$ that represents a linear transformation from Vector Space $V$ to itself. I'm trying to prove that $T$ cannot be self adjoint. I'm reading through this explanation but cannot seem to understand the logic behind the second last step. Why would $B^TA = AB$ ? Why is this true: If $\langle T(\mathbb{E}x), \mathbb{E}y \rangle = \langle \mathbb{E}x, T(\mathbb{E}y)\rangle \implies x^T(B^TA)y = x^T(AB)y$ Thanks! AI: It follows from $$ x^T (B^TA) y = x^T (AB) y \quad\text{for all $x,y$.} $$ Assume that $B^TA \neq A B$. Then there'd be a vector $y$ with $B^TAy \neq ABy$. Let $y_1 := B^TAy$ and $y_2 := ABy$. Now, since $y_1 \neq y_2$ you can find an $x$ such that $x^T y_1 \neq x^Ty_2$. But then you'd have $$ x^T(B^TA)y \neq x^T(AB)y $$ which contradicts the initial assumption.
H: Painting chess board The task is to paint each of the $64$ squares on a chess board either blue or red. I need to find the number of distinct ways this can be done given that any $2\times 2$ square on the board has two red and two blue squares. I've tried solving it for a $4\times 4$ board, but I am getting no where. Would appreciate any help AI: For an $m\times n$ chessboard there are $2^m+2^n-2$ ways. Case I. There are two horizontally adjacent squares of the same color: $2^m-2$ ways. Case II. There are two vertically adjacent squares of the same color: $2^n-2$ ways. Case III. None of the above: $2$ ways. Hint for Case I: There are $2^m-2$ ways to color one row so that two adjacent squares have the same color. The rest of the coloring is determined from that; colors must alternate in each column. (Note, therefore, that Cases I and II do not overlap.)
H: Sum of kth roots ($\sum\sqrt[k]{m}$) I'm trying to find an asymptotic to $$S(n) = \sum_{k=1}^n\sqrt[k]{m}$$ From computational tests, it seems to grow nearly as slowly as $n$. However even $$\sum_{k=1}^\infty\sqrt[k]{m}-1$$ diverges (for $m\neq1$) by the comparison test. I'm thinking it might be something like $n\log{\log n}$, but I don't know how to show it. Update: So it turns out to be closer to $n\sqrt[n]{m}$. Does anybody know if there is a nice formula? AI: You have : $$ M^{1/k} = 1 + \frac{1}{k} \ln M + \frac{1}{2} \ln^2 M \frac{1}{k^2} + O(1/k^3)$$ Since $$\sum_{k=1}^n \frac{1}{k} = \ln n + \gamma + \frac{1}{2n} + O(1/n^2)$$ $$\sum_{k=1}^n \frac{1}{k^2} = \frac{\pi^2}{6} - \frac{1}{n} + O(1/n^2)$$ we deduce : $$\sum_{k=1}^n M^{1/k} = n + \ln M. \ln n + C + (\ln M + \ln^2 M) \frac{1}{2n} + O(1/n^2),$$ for some constant $C$.
H: On the definition of the structure sheaf attached to $Spec A$ Let $A$ be a ring (commutative with $1$),if $X=Spec A$ we want to attach a sheaf of rings to $X$. If $f\in A$, $D(f)=X\setminus V(f)$ is an element of the base and we define $$\mathcal O_X(D(f)):=A_f$$ I've problems to show that $\mathcal O_X(\cdot)$ is well defined on the set $\mathcal B=\{D(f)\,:\, f\in A \}$. If $D(f)=D(g)$, then it is easy to show that $A_f\cong A_g$, but these two rings are not the same, so we have that $\mathcal O_X(D(f))\neq \mathcal O_X(D(g))$ even if they are isomorphic. Textbooks say "we can identify $A_f$ with $ A_g$" but what they exactly mean with the word "identify"? AI: Since $A_f,A_g$ are localizations of $A$, there is almost one homomorphism of $A$-algebras between $A_f$ and $A_g$. Therefore all identifications between them are compatible with each other. So there is no harm to identify $A_f$ with $A_g$ when $D(f)=D(g)$. However, I always wonder why this approach to the structure sheaf is so popular. As you observe, it is not clear at all why this is well-defined in the usual sense of this word. And it is also quite clumsy! Instead, you can do the following: 1) Define $\mathcal{O}_X(U)$ to be the set of all functions $s$ on $U$ with $s(\mathfrak{p}) \in A_{\mathfrak{p}}$, such that locally $s$ is equal to some fraction in $A_f$. Details can be found in Hartshorne's book, for example. 2) Let $S_U = A \setminus \cup_{\mathfrak{p} \in U} \mathfrak{p}$ and $\mathcal{O}'(U) = A[S_U^{-1}]$. Then $\mathcal{O}'$ is a presheaf of rings, and define $\mathcal{O}$ to be the associated sheaf. Details can be found in MO/80548.
H: complex holomorphic function which only has finite roots Suppose that D is a bounded region, f $\in$ H(D)$\bigcap$C($\bar D$).Prove that f has only finite roots if f$\neq$0 on $\partial D$. AI: Assume $f$ would have an infinite number of distinct roots. Let $(z_i)$ be a sequence of distinct roots. Since $\bar D$ is compact there exists a sub sequence of $(z_i)$ with a limit $\zeta$. Since $f$ is continuous on $\bar D$, we have $f(\zeta)=0$. Hence lies in the interiour of $D$. A holomorphic function on a region with an accumulation point of zeros inside that region is constant. Hence $f=0$. End of proof.
H: A probability problem involving probability density function I am going through a probability book where the following has been claimed : If $$f_{X}(x) = \int_{-\infty}^{\infty}f_{U}(x-y)f_{V}(y)dy$$ then $f_{X}=f_{U}*f_{V}$ where $X, U, V$ are continuous random variables where $U$ and $V$ are independent. I don't understand this argument. AI: It's just the probability density of $X=U+V$, which is given by the convolution of the PDFs of $U$ and $V$. So it's just the definition of convolution, for which the symbol '$*$' is used. Addition of independent RVs corresponds to the convolution of their PDFs.
H: Convergence, link with Sierpinski triangle This image shows the construction of the Sierpinski triangle up to the fourth iteration. My question is simple. If I construct a sequence of subsets of the triangle in this way : $\mathcal{E}_{0}=\emptyset$ $\mathcal{E}_{i}$ is the union of the white closed subsets in the triangle at the i-th iteration of the Sierpinski triangle construction. I know that the k-th element of this sequence is the closed complementary of the approximation of the Sierpinski triangle and that this sequence is increasing and bounded so i suppose that it converges. So I would like to know if this sequence tends to the triangle or tends to the triangle difference ``something''. AI: Perhaps a definition is needed for "tends to". Sequence $\mathcal E_n$ tends to the filled-in triangle $\mathcal T$ in the Hausdorff metric. Every point of $\mathcal T$ is arbitrarily close to some point of $\mathcal E_n$ for large enough $n$. (And every point of $\mathcal E_n$ is already in $\mathcal T$.)
H: How prove this equality $\sum\limits_{r=0}^{n_{k}}C_{n}^{r}M^{N-n_{k}+r}x^{n_{k}-r}\le(1+1)^N(M+x)^N$ prove that $$\sum_{r=0}^{n_{k}}C_{n}^{r}M^{N-n_{k}+r}x^{n_{k}-r}\le(1+1)^N(M+x)^N$$ and $x\in R,x>0, n_{k},N \in N^{+},N-n_{k}+r>0,n_{k}-r>0$ where $C_{n}^{m}=\dfrac{n!}{m!(n-m)!}$ AI: In fact, you can prove that (thanks to binomial coefficients) $\sum_{r=0}^{n_{k}}C_{n_k}^{r}M^{N-n_{k}+r}x^{n_{k}-r} = M^{N-n_k} (M+x)^{n_k}$. Assume $M>0$. So now we need to prove that $\left(\frac{M}{M+x}\right)^{N-n_k}\le 2^N$, which is obvious.
H: GgT, (polynomial) division and finite fields... Exercise: Let $f,g \in \mathbb{Z}_2[x]$ be the polynomials $f = x^6 + x^5 + x^4 + 1$ and $g = x^5 + x^4 + x^3 + 1$. Has the diophantic equation $f u + g u = x^4 + 1$ solutions $u,v \in \mathbb{Z}[x]$? If so, determine them all. My Solution: First I observed that in $\mathbb{Z}_2$ the relations \begin{align} -x & = x \\ x + x & = 0 \\ x^n = x \end{align} hold. From this the polynomials $f,g$ reduce to $f = g = x + 1$, so they are the same and so $ggT(f,g) = x + 1$. Now $x^4 + 1 = x + 1$, so $u = 0, v = 1$ is a special solution. To get all solutions, I add solutions of the homogenous part $fu + gv = 0$, i.e. $fu = gv$ with my relations. But because $f = g$, this forces $u = v$, so I could choose for $u$ and $v$ some arbitrary polynomial. So all solutions $(u,v)$ are of the form \begin{align} u & = p \\ v & = 1 + p \end{align} for some polynomial $p \in \mathbb Z_2$. Reference Solution: First it has to be checked if $x^4 + 1$ is a multiple of the ggT of $f$ and $g$, then the equation has a solution (criterium for lineare diophantic equations). The euclidean algorithms yields the ggT. It is $f = (x+1)g + x^4 + x^3 + x^2 + x = (x+1)g + r_1$, $g = xr_1 + x^2 + 1$ and $r_1 = (x^2 + x)(x^2 + 1)$. So $ggT(f,g) = x^2 + 1$, and because of $(x^2+1)^2 = x^4 + 1$ the diophantic equation has a solution. The general solution is given by the sum of a special solution and the general solution of the homogenous part $fu + gv = 0$. The special solution could be obtained by the euclidean algorithm (Lemma of Bezout). With $1 = -1$ we got $$ x^2 + 1 = g + xr_1 = g + x(f + (x+1)g)) = xf + (x^2 + x + 1)g. $$ One special solution for the representation of the ggT is therefore $(x, x^2 + x + 1)$, one special solution of the original equation $(x(x^2+1), (x^2+x+1)(x^2+1)) = (x^3 + x, x^4 + x^3 + x + 1)$. For the homogenous part $fu = gv$ we divide by the ggT. It is $f = (x^4+1)(x^2+1)$ and $g = (x^3+x^2+1)(x^2+1)$, a solution $(u,v)$ thus has the property $x^2+x^2+1 | u$ and $x^4+1 | v$. Therefore $u = p \cdot (x^3 + x^2 + 1)$. Substitution yields $v = p\cdot (x^4 + 1)$ and furthermore every $u = p\cdot (x^3 + x^2 + 1)$ and $v = p\cdot (x^4 + 1)$ are solutions. Therefore $\{ (p\cdot (x^3+x^2+1), p\cdot (x^4+1)) : p \in \mathbb Z_2[x]\}$ is the solution set of the homogenous part. The solution set is therefore $$ \{ (x^3 + x + p\cdot (x^3 + x^2 + 1), x^4 + x^3 + x + 1 + p\cdot (x^4+1)) : p \in \mathbb Z_2[x] \}. $$ Now I understand the reference solution, it is the standard way of solving the problem. But my solution seems much simpler to mean, so I wonder why they didn't consider it, or maybe my solution is just wrong? But then why should it be wrong? AI: I immediately spotted one problem that you have. You have confused the notions of a polynomial and that of a polynomial function. Consequently your claim that $x^n=x$ for all positive integers $n$ is simply false. A (univariate) polynomial over a field $F$ is simply a formal sum $\sum_{i=0}^na_ix^i$ with $i$ ranging over a finite set of non-negative integers, and $a_i$ are elements of $F$ for all $i$. Two polynomials $\sum_ia_ix^i$ and $\sum_ib_ix^i$ are the same polynomial, if (this is the definition!!) $a_i=b_i$ for all $i$. The set of polynomials over the field $F$ forms a ring $F[x]$ known as the ring of polynomials over $F$. This ring has many nice algebraic properties such as greatest common divisors and such. A polynomial $p(x)\in F[x]$ gives rise to a polynomial function. This is a function $p$ from $F$ to itself gotten by evaluating $p$ at all the elements of $F$. In other words, $p:z\mapsto\sum_i a_i z^i$ for all $z\in F$. We sometimes do not make the distinction between polynomials and polynomial functions, but in the case of finite fields not making the distinction leads to problems. So you have noticed that all the polynomials $p_n(x)=x^n$, with $n$ any positive integer, give rise to the same polynomial function $p_n$ from $\mathbb{Z}_2$ to itself. Your exercise, however, resides in the universe of polynomials - not in the universe of polynomial functions. Polynomial functions from a field to itself also form a ring. But this ring is kind of ugly, in particular when $F$ is finite. For example, it has zero divisors and such.
H: Uniqueness of Seifert graphs If we make the bands and disks of a Seifert surface really small and really thin the surface collapses to a graph. It is called a Seifert graph. If it is not a directed and weighted graph, can we say that for every unique Seifert graph there is a Seifert surface and vice versa? If it is not a directed but weighted graph, can we say that for every unique Seifert graph there is a Seifert surface and vice versa? If it is a both directed and weighted graph, can we say that for every unique Seifert graph there is a Seifert surface and vice versa? AI: With regards to your first question, I will assume that you are taking your Seifert graph to be embedded in $\mathbb R^3$. This can correspond to multiple Seifert surfaces by taking any Seifert surface with this graph and then adding lots of full twists into one of the bands. I am not sure what you expect the weights and directions to mean for the Seifert surface, so I am not sure how to respond to questions 2 and 3.
H: Existence of a power series converging non-uniformly to a continuous function I am wondering whether there exist a function $f(z) = \sum_{n\geq0} a_n z^n$ such that: $f$ converges and is continuous on the closed unit disk $D$ and the series $\sum_n a_n z^n$ does not converge uniformly on $D$. I have tried to construct a counter-example, but with no success so far. AI: Yes. See D.R. Lick's article, "Sets of non-uniform convergence of Taylor Series." It is shown there that for every closed subset $F$ of the boundary $\partial D$, there is such a series that converges everywhere on the closed disk to a continuous function, and whose set of non-uniform convergence is $F$. This means that the series converges uniformly in a neighborhood (open arc) of each point in $\partial D\setminus F$, but not in any neighborhood of any point in $F$. I have been interested in this question before, which is why I have a reference handy. I referred to this article in another answer, to a question about power series in Banach algebras. As mentioned there, the sequence of Cesàro means of the power series will converge uniformly on the closed disk.
H: How to show that $|f(x)-g(x)|<\epsilon~\forall~x\in[a,b]?$ Let $[a,b]$ be a closed and bounded interval in $\mathbb R$ and $f$ is continuous on $[a,b].$ How to show that for $\epsilon>0~\exists$ a piecewise linear continuous function $g$ on $[a,b]$ such that $|f(x)-g(x)|<\epsilon~\forall~x\in[a,b]?$ Help me! I'm clueless. AI: Hint Since $f$ is continuous on the closed interval $[a,b]$, it is uniformly continuous on $[a,b]$. Then, there exists some $\delta>0$ so that $$|x-y|<\delta \Rightarrow |f(x)-f(y)|<\epsilon \,.$$ Pick some integer $n>0$ so that $\frac{b-a}{n}<\delta$. Split the interval $[a,b]$ in $n$ equal subintervals, $[x_{i-1},x_i]$. Let $g$ be the piecewise line which connects the points $(x_i,g(x_i)$. Prove that it works.
H: Coinflip statistics There is a betting strategy for coinflips, called Martingale, in which the player should pick heads or tails and keep betting on it (doubling their bet on every loss) to eventually make a win when it appears. In theory this is watertight, but with one caveat: there can be very long strings of losses, and the player runs out of money, and looses it all. Now, some people wait until they have seen a very long string of outcomes for one side, and start betting at the other side, with the idea that has a larger chance now. I know that mathematicly this is nonsense, both sides still have 50% chance no matter what happend before. Although I can understand a dice/coin/ball has no notion of past/future, so will always remain 50% chance, I never quite understanded the following. You can proof there is only a very slight possibility of me ever witnessing 50 heads in a row during my lifetime. So after 49 spins, I will either observe something extraordinary (50 heads) or something less special (first tail), how can that not effect chance? Maybe the answer is obvious, that for math/statistics it doesnt matter whether someone is observing the event or not, but please enlighten me. AI: I would say that if it's the case that you have already seen 49 heads in a row (history), you have already witnessed something extremely unlikely. What you presently see on the $50$th flip, heads or tails, is a "toss-up" (excuse the pun!): the outcome of which is hardly extraordinary: tails or heads. You're right, Joshua. The probability of getting $49$ heads followed by a head $\left(\dfrac 1{2}\right)^{50}$ is equal to that of getting $49$ heads, followed by a tails: $\left(\dfrac 1{2}\right)^{49} \cdot \dfrac 12.\;$ Both extremely unlikely events, taken as a whole.
H: Possible ways to do stability analysis of non-linear, three-dimensional Differential Equations For example Lorenz system, $$ \frac{d}{dt}\begin{pmatrix} x\\ y\\ z \end{pmatrix}=\begin{pmatrix} -\sigma & \sigma & 0\\ \rho & -1 & -x\\ y & 0 & -\beta \end{pmatrix}\begin{pmatrix} x\\ y\\ z \end{pmatrix} $$ The article on Wiki describes the system of differential equations to have stable equilibrium for a specific value of $\rho$. Given some three dimensional system of differential equations, I would like to know how to do the stability analysis? or explain how stability analysis of Lorenz system is done ... AI: Consider the Lorenz equations: $$x' = f(x,y,z) = \sigma(y-x)$$ $$y' = g(x,y,z) = \rho x - y -xz$$ $$z' = h(x,y,z)= -\beta z + xy$$ where $\sigma$ and $\beta$ are viewed as fixed positive constants and $\rho$ is a parameter. Here is a guide to work through given that the Wiki describes what happens at each of the critical points. The outline of how to derive those is as follows: $(1)$ Find the critical points of the system, that is, where you simultaneously have $x' = y' = z' = 0$. Clearly, a critical point is given by $(x, y, z) = (0,0,0)$. $(2)$ Find the Jacobian matrix of the system of equations. The Jacobian matrix (using partial derivatives) is given by: $$\tag 2 \displaystyle J = \begin{bmatrix} \frac{\partial f}{\partial x} & \frac{\partial f}{\partial y}& \frac{\partial f}{\partial z} \\\frac{\partial g}{\partial x} & \frac{\partial g}{\partial y}& \frac{\partial g}{\partial z}\\ \frac{\partial h}{\partial x} & \frac{\partial h}{\partial y}& \frac{\partial h}{\partial z}\end{bmatrix} = \begin{bmatrix}-\sigma & \sigma & 0\\\rho - z & -1 & -x\\ y & x & -\beta\end{bmatrix}$$ $(3)$ Lastly, evaluate the eigenvalues of the Jacobian evaluated at each of the critical points for stability analysis. So, evaluating $(2)$ at the CP $(0,0,0)$, yields the matrix: $$\displaystyle J_{0,0,0} = \begin{bmatrix}-\sigma & \sigma & 0\\\rho & -1 & 0\\ 0 & 0 & -\beta\end{bmatrix}$$ To find the eigenvalues, we set-up and solve for the characteristic polynomial using: $$| A - \lambda I| = 0 \rightarrow -\beta \lambda^2-\beta \lambda+\beta r \sigma-\beta \lambda \sigma-\beta \sigma-\lambda^3-\lambda^2+\lambda \rho \sigma-\lambda^2 \sigma-\lambda \sigma = 0$$ This leads to the three eigenvalues (note, we could have written these straight off given the special form of the diagonal matrix above) and their corresponding eigenvectors as: $\displaystyle \lambda_1 = -\beta, v_1 = (0, 0, 1)$ $\displaystyle \lambda_2 = \frac{1}{2} \left(-\sqrt{4 \rho \sigma+\sigma^2-2 \sigma+1)}-\sigma-1\right), v_2 = -\frac{-1+\sigma+\sqrt{1-2 \sigma+4 \rho \sigma+\sigma^2}}{2 \rho}, 1, 0)$ $\displaystyle \lambda_3 = \frac{1}{2}\left(\sqrt{4 \rho \sigma+\sigma^2-2 \sigma+1)}-\sigma-1\right), v_3 = -\frac{-1+\sigma-\sqrt{1-2 \sigma+4 \rho \sigma+\sigma^2}}{2 \rho}, 1, 0)$ Of course those $\lambda$ are the eigenvalues we use to do a stability analysis. To study the stability of this, we need some complex center manifold theory, so I am going to stay away from that. It leads to a pitchfork bifurcation at the origin. It is worth noting that there are two other pairs of fixed points at: $x = y = \pm \sqrt{\beta(\rho - 1)}, z = \rho -1$ To find this, notice that the first equation gives us $y=x$, substituting this into the second equation gives $x(\rho - 1) - xz = 0 \rightarrow z = \rho-1$, and we substitute these previous two values into the third and have $x^2 = \beta z \rightarrow x = \pm \sqrt{\beta(\rho - 1)}$. To simplify matters, lets linearize the system by removing the nonlinear terms and analyze the simpler system. The linearization (eliminate the $xy$ and $xz$ nonlinear terms from the system) is given by: $$x' = \sigma(y-x)$$ $$y' = \rho x - y$$ $$z' = -\beta z$$ If you look at the equation for $z'$, you notice that it is decoupled from the other two equations and it can be solved outright as $z(t) = c_1 e^{-\beta t}$ and $z(t) \rightarrow 0$ exponentially fast. The other two directions are governed by the system: $$\begin{bmatrix}x'\\y'\end{bmatrix} = \begin{bmatrix}-\sigma & \sigma\\\rho & -1\end{bmatrix}\begin{bmatrix}x\\y\end{bmatrix}$$ You should be able to analyze this system from all the data provided now. As you can see, these systems are very complex and include a rich set of mathematics to deal with, so it takes time to get there. Here is another guide with some of the details for you to work out.
H: Limit as n approaches infinity involving roots $$\lim_{n\to\infty}\frac{n}{1+2\sqrt{n}}$$ Given my understanding of how to solve these problems, I need to take the highest power of $n$ in the denominator and then divide both the numerator and denominator by that power. But the highest power in the denominator is lower than the one in the numerator, so I will still be left with $n^{1/2}$ in the numerator, which gives $\frac{\infty}{2}=\infty$. Is that the correct answer or am I missing something? I would have thought that since the power of the denominator is smaller than the numerator that you could factor it by long division, but I'm not sure I know how to do that. AI: It's correct, but I'd avoid writing things like $\dfrac{\infty}{2}=\infty$ for anything other than intuition. You could use long division if you really wanted to: $$\dfrac{n}{1+2\sqrt{n}} = \dfrac{1}{2}\sqrt{n} + \dfrac{1}{4} - \frac{1}{4} \cdot \dfrac{1}{1+2\sqrt{n}}$$ This clearly gives you the same answer.
H: If $f^2(b) - f^2(a) = b^2 - a^2$, then the equation $f'(x)f(x) = x$ has at least one root in (a, b). Suppose $f$ is continuous on [a, b] and differentiable on the open interval (a, b). How to that if $f^2(b) - f^2(a) = b^2 - a^2$, then the equation $f'(x)f(x) = x$ has at least one root in (a, b). AI: Consider $$ F(x)=f^2(x)-x^2 $$ and apply Rolle's theorem
H: Is it ever proper to say that the limit of a function equals infinity? If I calculate a limit and get the value $\infty$, what is the proper way to communicate this? Can I say that the $\lim_{n\to\infty}a_n=\infty$ and therefore the sequence $\{a_n\}$ diverges, or do I say that the limit does not exist? AI: I would say the limit "tends to" $\infty$ and therefore your sequence diverges. When working out limits, what you're doing is looking at what happens as you get very close to some point. So when working out the limit as $n \to \infty$, you're looking to see what happens as $n$ gets very big and as you're not working (whatever) out at a specific point, I wouldn't say its correct to say it "equals". "Tends to" means that it gets close to that point.
H: Solving the simultaneous equations I need to solve the following simultaneous equations for the constants $A$ and $B$: $$zA + (1-z)B = 1$$ $$\hspace{1.8cm} z^2A + (1-z)B = z^2 - z + 1$$ where$z$ is just a variable. What I did was this: $$zA = 1 - (1-z)B \implies z^2A = z - (z - z^2)B$$ and so subbing this into the second equation gives me $$z - (z - z^2)B + (1-z)B = z^2 -z + 1$$ Rearanging gives me $$(z^2 - 2z + 1) = (1 - z)^2 = \{(1-z) - z(1 - z)\}B $$ which can then be simplified to get $$(1 - z) = (1 - z)B \implies B = 1$$ which is wrong beacuse in my answers it says $B = \frac{1-z}{1 - 2z}$. I think I will get $A$ once I have $B$ but I can't see my mistake right now. AI: Hints: From eq. (1): $$(1-z)B=1-Az$$ From eq. (2): $$(1-z)B=(1-A)z^2-z+1$$ so $$ (1)=(2)\implies (1-A)z^2-(1-A)z=0\implies A=1\;\; \text {or} \;\,\,z(z-1)=0\;\;\ldots$$
H: Linear bijection between a normed vector space and its proper subspace Let $X,Y$ be normed vector spaces such that $X$ is a proper subspace of $Y$ (i.e., $X$ is a subspace of $Y$ and $X\neq Y$), and $X$ is dense in $Y$. Is there a linear bijection $T$ from $X$ to $Y$? If it does exist, can $T$ and $T^{-1}$ both be bounded? I only know that in finite dimensional spaces, this is impossible. But I have no idea how to come up with an example with such $T$ even in indefinite dimensional spaces (or disprove the existence). AI: First question. In general the desired bijection does not exist. Consider dense subspace $X$ of countable dimension and compete separable Banach space $Y$ (for example $X=c_{00}$, $Y=\ell_2$), then cardinality of Hamel basis of $X$ is $\aleph_0$, of $Y$ is $\mathfrak{c}$. Since cardianality of Hamel basis is preserved under linear bijections, then there is no bijective linear operator between $X$ and $Y$. Second question. I don't know the answer but the following can be stated. If such $T$ exists then $Y$ is incomplete. Indeed $T$ is an isomorphism, so if $Y$ is complete then $X$ is complete too. Then you can easily show that $X=Y$. So counterexamples (if they exist) are among incomplete normed spaces.
H: GCD of elementary symmetric functions It is easy to show that p/ $\sigma_j$ ( where $\sigma_j$ is the sum of all products of j distinct members of the set {1,2,...,p-1}) for all $1 \leq j \leq p-2$, but how would you go about showing that the greatest common divisor of $\sigma_1,\sigma_2,...,\sigma_{p-2}$ is in fact p itself? My first thought was to consider $ \sigma_1 = 1+2+3+\cdots p-1=\frac{p(p-1)}{2}$. Since we know that p divides each $\sigma_j$, we consider $\frac{\sigma_j}{p}=\frac{p-1}{2}$. Now if I can show that no prime dividor of $\frac{p-1}{2}$ divides any other $ \sigma_j$, then I'm done. However, I've run into problems with this and I am not entirely sure this is the proper way to approach the problem. Any suggestions would be nice. AI: Hint: We want to show that if $q$ is a prime factor of $p-1$, then $q \nmid \sigma_i$ for some $i$. Consider $$(x-1)(x-2) \ldots (x-(p-1)) \equiv [x(x-1) \ldots (x-(q-1))]^{\frac{p-1}{q}} \pmod{q}$$ Hint 2: We have $$(x-1)(x-2) \ldots (x-(p-1))=x^{p-1}+\sum_{i=1}^{p-2}{\sigma_i(-1)^ix^{p-1-i}}+(-1)^{p-1}(p-1)!$$ If $q$ were to divide $\sigma_i$ for all $i$, then the above will be congruent to $x^{p-1} \pmod{q}$. Can $[x(x-1) \ldots (x-(q-1))]^{\frac{p-1}{q}}$ be congruent to $x^{p-1} \pmod{q}$?
H: Contour Integral I have this question: I'm aware that $e^{iz^2}$ is analytic, and hence $I_R = 0$ by Cauchy's Integral theorem. I'm not really sure what to do from there. Thanks! AI: The closed contour is split into 3 pieces: The original integral: $$\int_0^R dx \, e^{i x^2}$$ The integral over the angled line of the contour; parametrize with $z=e^{i \pi/4} t$: $$e^{i \pi/4} \int_R^0 dt \, e^{- t^2}$$ (because $i e^{i \pi/2} = -1$). The third piece is the integral over the circular arc subtending an angle of $\pi/4$ with respect to the origin. Parametrize using $z=R e^{i \theta}$, $\theta \in [0,\pi/4]$: $$i R \int_0^{\pi/4} d\theta \, e^{i \theta} \, e^{-R^2 \sin{2 \theta}} e^{i R^2 \cos{2\theta}}$$ which, in absolute value, is $$\le R \int_0^{\pi/4} d\theta \, e^{-R^2 \sin{2 \theta}} \le R \int_0^{\pi/4} d\theta \, e^{-4 R^2 \theta/\pi} \le \frac{\pi}{4 R}$$ as $R \to \infty$. Note that I used the relation $\sin{2 \theta} \ge \frac{4 \theta}{\pi}$ when $\theta \in [0,\pi/4]$. So when we set $R \to \infty$, this integral vanishes. Thus, in this limit, we are left with $$\int_0^{\infty} dx \, e^{i x^2} - e^{i \pi/4} \int_0^{\infty} dt \, e^{- t^2} = 0$$ Thus, you may now evaluate the integral on the left in terms of the integral on the right, which you know converges.
H: Find the limit of $2+\left(-\frac{2}{e}\right)^n$, as $n\to\infty$, if it exists I'm absolutely unsure about how to approach this. I've considered changing it to $-2=\left(-\frac{2}{e}\right)^n$ and then using the properties of lograrithms, but $\ln(-2)$ is undefined, as is $\ln(-\frac{2}{e})$. I can't use L'Hopital's rule either because the limit is of the form $1^{\infty}$, and I have no clue how to manipulate it so I can apply it. I'm tempted to say that it approaches infinity, but I can't be confident that there isn't another way to solve it. Any tips? Thanks. AI: $e>2$ so $\frac{2}{e}<1$ so $$\lim_{n \to \infty}{\left(-\frac{2}{e}\right)^n}=0$$ so $$\lim_{n \to \infty}{2+\left(-\frac{2}{e}\right)^n}=2$$
H: $\int_0^1\frac{(f(x)-1)^2 -4x^2}{x^{3.5}}\,dx$ exists. Calculate $f(0)$ and $f'(0)$ I've tried somehow using Taylor to try and figure this one out. Unfortunately, I couldn't seem to get a solid answer. Thank you very much for your help! Let f be a continuos function, $$f:R\rightarrow R$$ $$f(x), \ f'(x) \ , \ f''(x) \ \text{are continuous} $$ and let the integral $$\int_0^1\frac{(f(x)-1)^2 -4x^2}{x^{3.5}}\,dx \space \text{exist and be finite}$$ Find the value of $$f(0)\ \text{and}\ |f'(0)|$$ AI: Let $a=f(0)-1, b=f'(0)$. Then continuity of the second derivative gives $f(x)= 1+a+ bx+O(x^2)$ and hence the integrand is $$\frac{(a+bx+O(x^2))^2-4x^2}{x^{3.5}} = \frac{a^2+2abx+(b^2+a\times\cdots-4)x^2+O(x^3)}{x^{3.5}}$$ A function like $x^c$ is integrable at the origin only if $c>-1$ (check) and hence the first term in the numerator which may be nonzero is the cubic term. You should be able to figure out what $a,|b|$ are now.
H: Use of epsilon in proofs about diameters I have been working on the following question: Assume that $K$ is a compact metric space. Prove that there are two points $x,y \in K$ such that $d(x,y)=$diam $K$. (Recall that diam $K = sup${$d(x,y) | x,y \in K$}. Here is an attempted proof (imitating Baby Rudin proof 3.10(a)). By definition of sup, $\forall \epsilon >0$, $\exists x,y \in K$ s.t. $d(x,y)+\epsilon ≥ $ diam $K$. We also have that $d(x,y) ≤ $ diam $K$ $\forall x,y \in K$. Since $\epsilon$ was arbitrary, it follows that $d(x,y)=$diam $K$. This proof can't be right since it doesn't require compactness of K (and it's easy to come up with examples where the statement doesn't hold for K not compact). Can you help me understand where it's going wrong? Thanks! AI: There's something missing. For each $\epsilon>0$ (for example $\epsilon=\frac1n$) you may find different $x,y$, that is you actually get sequences $x_n,y_n$ with $d(x_n,y_n)\to \operatorname{diam}(K)$. By compactness you can find a subsequence that converges to som $(x,y)$. A nicer proof is: If $K$ is compact, then so is $K\times K$, hence the continuos function $K\times K\to\mathbb R$, $(x,y)\mapsto d(x,y)$ assumes its maximum.
H: Who was V. Viskovatov? I'd be interested to learn some biographical detail about Vasilii Viskovatov, whose name is associated with a method for converting (a ratio of) power series to a "corresponding" continued fraction, c.f. Handbook of Continued Fractions for Special Functions, p. 20 (Springer, 2008). A few Internet hits (prominently Google books links, not wholly accessible) provide the following literature reference to his work, albeit with apparent mis-transliterated initial: B. Viskovatov: 'De la méthode générale pour réduire toutes sortes des quantités en fractions continues', Memoires de L'Academie Impériale des Sciences de St. Petersburg, 1(1803-1806), pp. 226-247 [Trans.: 'A general method for reducing all types of quantities to continued fractions'.] The algorithm itself can be described simply. Given the ratio of two power series $p(z)/q(z)$ with $q(0) = 1$, remove as a constant term $b_0 = p(0)$, and after factoring out the leading term $z$ in the numerator, invert the remaining factor from $p(z) - p(0)q(z)$: $$ \frac{p(z)}{q(z)} = b_0 + \frac{a_ 1 z \cdot r(z)}{q(z)} = b_0 + \frac{a_1 z}{q(z)/r(z)} $$ where for simplicity I've assumed a single power of $z$ in the numerator. Continue to apply the process to $q(z)/r(z)$ and a corresponding-type continued fraction emerges. AI: It might be Vasilii Viskovatov: http://encyclopedia2.thefreedictionary.com/Viskovatov,+Vasilii+Ivanovich The time-frame and location is correct. Don't forget that 'Vasilii' written in Cyrillic starts with a glyph that looks like a roman B:
H: Reciprocal of Laurent series I understand how to use long division to find the reciprocal of a power series. Are there any theorems that allow you to divide Laurent series that have a finite number of terms with negative exponents? That is, if I have a Laurent series around $0$, such as $f(z) = \frac{1}{z^2} + 3z + 5z^4 + \ldots$, can I use long division to come up with a series for $\frac{1}{f(z)}$ and know anything about its convergence? AI: If you want to find out how the function behaves around a tiny neighbourhood of $\,z=0\,$, for example, then you can do $$\frac1{f(z)}=\frac1{\frac1{z^2}+3z+5z^4+\ldots}=\frac{z^2}{1+3z^3+5z^6+\ldots}=$$ $$=z^2\cdot\frac1{1+3z^3+\mathcal O(z^6)}=z^2\left(1-3z^3+9z^6-27z^9+\ldots\right)=z^2-3z^5+\ldots$$ And the above is valid whenever $$|3z^3|<1\implies|z|<\frac1{\sqrt[3]3}$$ Thus, our function, which is undefined at $\,z=0\,$, has a removable singularity there and that point behaves as a double zero.
H: Gaussian Elimination, Question Check. I'm going through my practice problems, and just want to know if I am doing this right: $$ 2x_1 - 3x_2 = -2$$ $$ 2x_1 + x_2 = 1$$ $$ 3x_1 + 2x_2 = 1$$ And this is my solution: $$ \begin{align} \begin{bmatrix} 2 & 3 & -2\\ 2 & 1 & 1\\ 3 & 2 & 1 \end{bmatrix} \end{align} $$ $$ \begin{align} \begin{bmatrix} 1 & -3/2 & -1\\ 2 & 1 & 1\\ 3 & 2 & 1 \end{bmatrix} \end{align} $$ $$ \begin{align} \begin{bmatrix} 1 & -3/2 & -1\\ 0 & -1 & -1\\ 3 & 2 & 1 \end{bmatrix} \end{align} $$ $$ \begin{align} \begin{bmatrix} 1 & -3/2 & -1\\ 0 & -1 & -1\\ 0 & -1 & -2 \end{bmatrix} \end{align} $$ $$ \begin{align} \begin{bmatrix} 1 & -3/2 & -1\\ 0 & 1 & 1\\ 0 & -1 & -2 \end{bmatrix} \end{align} $$ $$ \begin{align} \begin{bmatrix} 1 & -3/2 & -1\\ 0 & 1 & 1\\ 0 & 0 & -1 \end{bmatrix} \end{align} $$ Can anyone tell me if I did this right, or if I did a mistake where? Thanks. AI: In your second matrix, assuming you meant to divide by 2 in the first row, you incorrectly negated the second entry. If you meant to divide by $-2$, then the first entry should be negated, and the third entry should be positive. In your third matrix, when you doubled row 1 and added to row 2, your entry in the middle row, middle column should be $-3 + 1 =-2$. I'm afraid then, that the error will "trickle down" in later reductions using that row. Likewise, in the fourth matrix, when you tripled row 1 and added to row 3, your middle value in the bottom row should be $-\frac 92 + 2 = -\frac 52$. $$ \begin{align} \begin{bmatrix} 2 & 3 & -2\\ 2 & 1 & 1\\ 3 & 2 & 1 \end{bmatrix} \end{align} $$ Subtract row 1 from row 2: $$ \begin{align} \begin{bmatrix} 2 & 3 & -2\\ 0 & -2 & 3\\ 3 & 2 & 1 \end{bmatrix} \end{align} $$ 1/2 row 1: $$ \begin{align} \begin{bmatrix} 1 & 3/2 & -1\\ 0 & -2 & 3\\ 3 & 2 & 1 \end{bmatrix} \end{align} $$ Add $-3 R1$ to row 3 $$ \begin{align} \begin{bmatrix} 1 & 3/2 & -1\\ 0 & -2 & 3\\ 0 & -5/2 & 4 \end{bmatrix} \end{align} $$ -1/2 Row 2, 2 times Row 3: $$ \begin{align} \begin{bmatrix} 1 & 3/2 & -1\\ 0 & 1 & -3/2\\ 0 & -5 & 8 \end{bmatrix} \end{align} $$ 5 Row 2 + row 3 = row 3 $$ \begin{align} \begin{bmatrix} 1 & 3/2 & -1\\ 0 & 1 & 1\\ 0 & 0 & 1/2 \end{bmatrix} \end{align} $$ We can now multiply the last row by 2: $$ \begin{align} \begin{bmatrix} 1 & 3/2 & -1\\ 0 & 1 & 1\\ 0 & 0 & 1 \end{bmatrix} \end{align} $$
H: A completely regular topological space which is $T_0$ but not $T_1$? The question pretty much says it all. I need a completely regular (the definition not requiring $T_1$) topological space which is $T_0$ but not $T_1$. I've sifted through Counterexamples in Topology but I just can't find one. I've also tried google and searching this site but I'm not coming up with anything. It seems the counterexample should be simple but everything I try doesn't work (like Sierpinski topology, open extension topology, topology on $\mathbb{R}$ whose open sets are $(a,+\infty)$, etc.). EDIT: By a completely regular topological space I mean a topological space $(X,\tau)$ so that for every $x\in X$ and closed $\mathscr{C}\subseteq X$ such that $x\not\in\mathscr{C}$ there exists a continuous function $f:X\to[0,1]$ so that $f(x)=0$ and $f(\mathscr{C})=\{1\}$. By a $T_0$ space I mean a topological space in which any two distinct points are topologically distinguishable. By a $T_1$ space I mean a space in which for any two distinct points both of them are contained in neighborhoods which do not contain the other. I was thinking completely regular + $T_0$ did not imply $T_1$ since the definitions of Tychonoff/$T_{3\frac{1}{2}}$ spaces I've seen require completely regular and $T_1$ rather than completely regular and $T_0$. EDIT EDIT: Turns out no such counterexample exists. AI: If $X$ is completely regular (closed set and point can be separated by a continuous real-valued function), then it is also regular. Let $x\in X$ be a point and $A\subset X$ be a closed set not containing $x$, then there is a continuous function $f:X\to\Bbb R$ with $f(x)=0$, $f(A)=1$, so $f^{-1}([0,\frac12))$ and $f^{-1}((\frac12,1])$ are disjoint open neighborhoods of $x$ and $A$, respectively. To show that a regular $T_0$-space $X$ is $T_2$, let $x,y\in X$. There is a closed set $A$ containing one point, say $y$, but not the other. By regularity, there are disjoint open sets $U\ni x$ and $V\supseteq A\ni y$. So $X$ is Hausdorff.
H: Poisson process of alternating sources, pairing products of the two of them I have a problem I've been thinking for a while, but it's confusing me quite a lot. There are two independen machines, A and B. A produces a product at a rate of 2/minute, and B does it at a rate of 3/minute, both of them following a Poisson process. The products of both machines get into a line where a person packs them by pairs as they arrive. I need to find the mean and the variance of the time I have to wait until there is a package formed by a product of A and a product of B. I don't really know where to start, because I can't even decide what the "success" is. I know that i can get the mean of both the machines, but how can i be sure i'm alternating between the two machines? Thank you very much beforehand. AI: This is a magic property of Poisson processes. Let $\mu = 2$ and $\lambda = 3$ be the rates of your two machines Now I want to know the probability that I get nothing out of either machine in the first $t$ minutes. I get nothing out of machine $A$ with probaiblity $e^{-\mu t}$ and nothing out of machine $B$ with probability $e^{-\lambda t}$. So as the machines are independent I get nothing out of the either machine with probability $e^{-(\mu+\lambda)t}$. So the two machines working together act like a Poisson machine producing at a rate of $5$ per minute. You should be able to recognise the distribution of the waiting time above and calculate the mean. Now lets try a similar approach for the question you actually asked so that I can pretend that was a warm up exercise and not just idiot boy here not reading the question. We already know that the first product comes out of the machine after an exponential waiting time mean $\frac 15$ and variance $\frac 1{25}$. So the amount of time I have to wait before I get two is the sum of two independent exponentials, hence has mean $\frac 25$ and variance $\frac 2{25}$. So how many pairs do I need to see before I get a package with one from each? For a fixed time $t$ the probability I've seen one product from $A$ and none from $B$ is $e^{-(\lambda+\mu)} \frac \mu{0!\cdot 1!}$ and the probability I've seen one from $B$ and none from $A$ is $e^{-(\lambda+\mu)} \frac \lambda{0!\cdot 1!}$ so conditioned on the event only one product has been seen the probability it came from $A$ is $\frac{\mu}{\mu+\lambda}$ or $\frac 25$. Now the output of the machines is independent and memoryless so the sequence of products is an iid sequence. Therefore the probability the firs pair gives a proper package is $2\cdot \frac 25\cdot\frac 35 = \frac{12}{25}$. Let $N$ be the number of packages we make before we get a good one. (So the $N$th package is good) We have $$P(N = n) = \left(\frac {13}{25}\right)^{n-1}\left(\frac {12}{25}\right)$$ Now the packages arrive at independent intervals of length $T_i$ each of which has $E(T) = \frac 15$ and $E(T^2) = \frac 2{25}$ so with total Waiting time $$T = \sum_{i=1}^N T_i$$ So if I know $N$ I can write $$E(T|N) = NE(T_i) = \frac N5$$and $$E(T^2|N) = \left(\sum_{i=1}^N T_i\right)^2 = \sum_{i=1}^N E(T_i)^2 + 2\sum_{i\neq j} E(T_i)E(T_j)$$ $$= NE(T_i^2) + (N^2-N)E(T_i)^2 = \frac{N^2 + N}{25}$$ You get to take it from here. You know the distribution of $N$ so you can work out $E(T) = \frac{E(N)}5$ and $E(T^2) = \frac{E(N^2+N)}{25}$ So you should be able to get the mean and variance.
H: Integrate: $\int_0^\infty \frac{\sin^2(x)}{x^2}dx$ I am trying to integrate $\displaystyle \int_0^\infty \frac{\sin^2(x)}{x^2} dx$ by method of contour. I am considering the following contour but I am not being able to. Also I am not sure if it's right approach. $$\int_\Gamma f(z) dz + 2 \int_0^\infty f(z) dz + \int_\gamma f(z)dz = 0$$ The first integral tends to zero as $R \to \infty $, but letting $\epsilon \to 0$, for the last integral I am getting. $$\int_{\pi }^0 \frac{\sin^2({\epsilon e^{i\theta}})}{\epsilon^2 e^{i2\theta }} i \epsilon e^{i\theta}d\theta = 0$$ ADDED:: Taking the above contour, we do not have any pole inside the contour. $$\int_{-\infty}^\infty \frac{1 - e^{i2z}}{2z^2}dz + \int_\Gamma \frac{1 - e^{i2z}}{2z^2} dz + \int_\gamma \frac{1 - e^{i2z}}{2z^2} dz = 0 \hspace{1 cm }(1)$$ $\displaystyle \int_\Gamma \frac{1 - e^{i2z}}{2z^2} dz \to 0$ due to Jordan Lemma. To evaluate $\displaystyle \int_\gamma \frac{1 - e^{i2z}}{2z^2} dz $ let the radius of the small semi circle be $\epsilon \to 0 $. $$\lim_{\epsilon \to 0}\int_\pi^0 \frac{1 - e^{i2\epsilon e^{i\theta}}}{2\epsilon ^2 e^{i2\theta}} i \epsilon e^{i\theta}d\theta =\lim_{\epsilon \to 0} \int_\pi^0 \frac{1 - 1 - 2i\epsilon e^{i\theta} + O(\epsilon^2)}{2\epsilon e^{i\theta}} i = \lim_{\epsilon \to 0} \int_\pi^0 1+ O(\epsilon) d\theta = -\pi \hspace{1 cm }(2)$$ From $(2)$, $(1)$ reduces to $$\int_{-\infty}^\infty \frac{1 - e^{i2z}}{2z^2}dz - \pi = 0 \implies \Re \int_{-\infty}^\infty \frac{1 - e^{i2z}}{2z^2}dz = \int_{-\infty}^{\infty}\frac{\sin(x)^2}{x^2}dx = \pi$$ Including singularity at $z = 0$, we will have that small inner circle on lower plane. $$\int_{-\infty}^\infty \frac{1 - e^{i2z}}{2z^2}dz + \int_\Gamma \frac{1 - e^{i2z}}{2z^2} dz + \int_\gamma \frac{1 - e^{i2z}}{2z^2} dz = 2 \pi i \text{Residue}[f(z), z = 0] = 2\pi \hspace{1 cm }(3)$$ As for $\displaystyle \int_\gamma \frac{1 - e^{i2z}}{2z^2} dz = \lim_{\epsilon \to 0}\int_{-\pi}^0 \frac{1 - e^{i2\epsilon e^{i\theta}}}{2\epsilon ^2 e^{i2\theta}} i \epsilon e^{i\theta}d\theta = \pi \hspace{1 cm }(4)$ From $(3)$ and $(4)$ we get the same result. AI: What you try to do won't work since your function is (almost) analytic insde the path you take and thus won't help you to evaluate the real integral. Let us try the following: $$\cos 2x=1-2\sin^2x\implies \sin^2x=\frac{1-\cos2x}{2} \;\text{define}\;\;f(z):=\frac{1-e^{2iz}}{2z^2}:$$ $$\text{Res}_{z=0}(f)=\lim_{z\to 0}\,zf(z)=\lim_{z\to 0}\frac{1-e^{2iz}}{2z}\stackrel{\text{l'Hospital}}=-i$$ Question: The above implies $\,z=0\,$ is a simple pole...why is this so and not a double one? Taking your contour, taking the limits and etc. and using the lemma and, specially, its corollary in the 2nd. answer here , we get after comparing real and imaginary parts $$\int\limits_{-\infty}^\infty\frac{\sin^2x}{x^2}dx=\pi\;\;\ldots\ldots$$
H: A question regarding moment generating function The moment generating function of a real-valued random variable $X$ on a probability space $(\Omega,\mathscr A,P)$ is defined as $G_{X}(t)=E[e^{tx}]$ $(t \in \mathbb{R})$. Prove that $G_{\alpha X+\beta}(t)=e^{\beta t}G_{X}(\alpha t)$ for $\alpha, \beta \in \mathbb{R}$. Attempt $G_{X}(t)=E[e^{tx}]$, then $$G_{\alpha X+\beta}(t)=E[e^{t(\alpha x+\beta)}]=E[e^{\alpha xt}e^{\beta t}]=E[e^{\alpha xt}]E[e^{\beta t}]=e^{\beta t}E[e^{\alpha xt}]=e^{\beta t}G_{X}(\alpha t).$$ Show that $G_{X+Y}=G_{X} \cdot G_{Y}$. Attempt $$G_{X+Y}(t)=E[e^{t(x+y)}]=E[e^{xt}e^{yt}]=E[e^{xt}]E[e^{yt}]=G_{X}(t)\cdot G_{Y}(t).$$ Questions Are my attempts correct? In general, does $E[XY]=E[X]\cdot E[Y]$? If yes, what conditions do the random variables $X, Y$ have to satisfy for $E[XY]=E[X]\cdot E[Y]$ to be true? Suppose we have a random variable $X$, and $g$ is not a function of $x$, then does it follow that $E[g]=g$ for all $g$? Thank you for your time. AI: Yes. $E[XY]=E[X]E[Y]$ means that $X$ and $Y$ are orthogonal. Independence of $X$ and $Y$ is a sufficient (but not necessary) condition for this equality to be true. Yes, if the expectation is with respect to $X$.
H: Evaluating a Gaussian Integral How to prove that $$\int_{\mathbb{R}^N}e^{-\langle Ax,x\rangle}\operatorname{dm}(x)=\left(\frac{\pi^N}{\det A}\right)^{\frac{1}{2}}$$ Where $A:\mathbb{R}^{N}\to\mathbb{R}^{N}$ is a symmetric positive-definite linear transformation. My approach: Given a $x\in\mathbb{R}$, one have $$\left(\int_{\left[-r,r\right]} e^{-x^2}\right)^{N}=\prod_{j=1}^{N}\left(\int_{\left[-r,r\right]}e^{-y_{j}^{2}}\operatorname{dm}(y_{j})\right)$$ So, by Fubinni's therem $$\left(\int_{\left[-r,r\right]} e^{-x^2}\right)^{N}=\int_{\left[-r,r\right]^{N}}e^{-(y_{1}^{2}+\dots+y_{N}^{2})}\operatorname{dm}(y_1,\dots,y_N)=\int_{\left[-r,r \right]^N}e^{-||y||^2}\operatorname{dm}(y)$$ And, since $A$ is symmetric and positive-definite, there exist a $B:\mathbb{R}^N\to\mathbb{R}^N$ invertible such that $B^{-1}AB$ is diagonal. But I got stuck and can't find a change of variables that work. AI: Since $A$ is symmetric positive definite, we have the Cholesky decomposition, i.e., $A = LL^T$. Hence, we have $$\langle Ax,x \rangle = x^TL^TLx$$ Now make the transformation $y = Lx$. We then get $$\int \exp(-\langle Ax,x \rangle) dx = \int \exp \left(-y^Ty \right) \dfrac{dy}{\det(L)} = \dfrac1{\sqrt{\det(A)}} \int\exp(-y^Ty) dy = \dfrac{\pi^{N/2}}{\sqrt{\det(A)}}$$
H: An open cover that is not locally finite I could not understand why example $13.4$ is not locally finite. Can you give me an explanation please. AI: An open cover $\mathscr{U}$ of a space $X$ is point-finite if $\{U\in\mathscr{U}:x\in U\}$ is finite for each $x\in X$: each point of $X$ belongs to only finitely many members of $\mathscr{U}$. Every locally-finite cover of a space is automatically point-finite as well. And this open cover of $\Bbb R$ is not even point-finite. In fact, it fails in the worst way to be point-finite: each $x\in\Bbb R$ belongs to infinitely many members of the cover. To see this, let $x\in\Bbb R$. For each $n\in\Bbb Z^+$ there is a rational number $q_n$ such that $\left|x-q_n\right|<\frac1n$, and we may further assume that $q_n\notin\{q_k:k<n\}$, since there are infinitely many rational numbers within $\frac1n$ of $x$. But then $x\in U_{q_n,n}$ for each $n\in\Bbb Z^+$, and the sets $U_{q_n,n}$ are all distinct, so $x$ belongs to infinitely many members of the cover. (This is a real distinction, by the way: there are point-finite covers that are not locally finite.)
H: What is an overlap? I want to ask what an overlap is. My teacher said that for example $1$: Everything is an overlap hence it is not locally finite. For example $2$, it doesnt overlap. Please teach me these two examples. Thanks. AI: There are two families of sets mentioned on that page. One is $\left\{\left(-\frac1n,\frac1n\right):n\in\Bbb Z^+\right\}$; it’s an open cover of $(-1,1)$, and it is not even point-finite, since $0$ belongs to all of the sets. The sets $U_p$ mentioned just below it do not seem to have anything to do with it, however, or with anything else on the page. The other is $\mathscr{F}=\{[n,n+1]:n\in\Bbb Z^+\}$; it’s a closed cover of $[1,\to)$ (or if you prefer, $[1,\infty)$), and it is locally finite. To see this, suppose that $x\ge 1$. If $x$ is not an integer, then there is a positive integer $n$ such that $n<x<n+1$; let $U_x=(n,n+1)$. Then $U_x$ is an open neighborhood of $x$, and the only member of $\mathscr{F}$ that intersects $U_x$ is $[n,n+1]$: if $m\in\Bbb Z^+$, and $m\ne n$, then $[m,m+1]\cap(n,n+1)=\varnothing$, because either $m<n$, in which case $m+1\le n$, or $n<m$, in which case $n+1\le m$. If $x$ is an integer, let $U_x=(x-1,x+1)$. Suppose that $n\in\Bbb Z^+$ and $U_x\cap[n,n+1]\ne\varnothing$; then either $x=n$, or $x=n+1$, since $x$ is the only integer in $U_x$. In either case, then, $U_x$ intersects at most two members of $\mathscr{F}$. Thus, every $x\ge 1$ has an open neighborhood that intersects only finitely many members of $\mathscr{F}$, which by definition means that $\mathscr{F}$ is locally finite. Finally, it appears that your teacher means that sets $A$ and $B$ overlap if $A\cap B$ contains an open interval, i.e., is more than just one point. With this definition $(0,2]$ and $[1,3)$ overlap, because their intersection, $[1,2]$, contains the open interval $(1,2)$, but $[0,1]$ and $[1,2]$ do not overlap, because $\{1\}$, their intersection, does not contain an open interval.
H: How to find the inverse Laplace Transforms? How do you find the inverse Laplace Transform of the following, $$\frac{2 (s^2+4 s+5)^2+40}{(s^2+4 s+5)^2}$$ Separating them into complex coefficients is to long. AI: Let $F(s)$ denote the fraction in the post, hence $F(s)=2+40\frac1{(s^2+4s+5)^2}$. The $2$ part of $F(s)$ is the Laplace transform of twice the Dirac measure at $0$. The fraction $\frac1{s^2+4s+5}$ is a linear combination of $\frac1{s+2\pm\mathrm i}$ hence it is the Laplace transform of a linear combination of the functions $t\mapsto\exp(-(2\pm\mathrm i)t)$ on $t\geqslant0$, namely, the Laplace transform of $f$ where $f(t)=\mathrm e^{-2t}\sin(t)$ for every $t\geqslant0$. Thus, the fraction $\frac1{(s^2+4s+5)^2}$ is the Laplace transform of $f\ast f$, which might (or might not, check for yourself) be such that $(f\ast f)(t)=\frac12\mathrm e^{-2t}(\sin(t)-t\cos(t))$ for every $t\geqslant0$. Finally, the function $F$ is the Laplace transform of the measure $\nu=2\delta_0+40\mu$ where $\mu$ has density $f\ast f$ with respect to the Lebesgue measure on $t\geqslant0$. Note that $F$ is the Laplace transform of no function, only a measure can do, and one has $$ F(s)=\int_0^{+\infty}\mathrm e^{-st}\mathrm d\nu(t). $$
H: Prove that $c^3f(c)+c f(c)\ge1$ Let $f:[0,1] \rightarrow \mathbb{R}$ a continuous function that satisfies $\int_0^1 2 x f(x) dx >\pi/2$. I need to prove there is $c\in(0,1)$ such that $c^3f(c)+c f(c)\ge1$. My guess is the mean value theorem. Am I on the right track? AI: Since $$\int_0^1\big(xf(x)-\frac{1}{1+x^2}\big)dx=\int_0^1xf(x)dx-\frac{\pi}{4}>0,$$ there exists $c\in(0,1)$, such that $cf(c)-\frac{1}{1+c^2}>0$. The conclusion follows. Remark: It suffices to assume that $f$ is (Riemann or Lebesgue) integrable on $[0,1]$. Continuity is not necessary.
H: Inclusion Exclusion Principle Problem There are 28 people in your family consisting of 18 adults, 13 females, and 11 who have purple hair. There are 11 adult females, 6 of whom sport purple hair. There are 10 adults with purple hair. No female children have purple hair. How many male children without purple hair are in the family? I know this problem is an application of the inclusion exclusion principle. However I am not sure how to express one of the statements in the prompt: "No female children have purple hair. How many male children without purple hair are in the family?" I'm pretty confident in expressing the rest up until that sentence: A = adults, F = females, P = purple hair, and $N()$ represents the cardinal number of a set $N(A) = 18$ $N(F) = 13$ $N(P) = 11$ $N(A \cap F) = 11$ $N(A \cap F \cap P) = 6$ $N(A \cap P) = 10$ I thought maybe it meant $N(F \cap P)=0$, but when I did that I didn't get the right answer which is 7. Any help is appreciated. Thank you in advance! AI: No female children have purple hair. If $X$ is the set of female children with purple hair, we’re told that $N(X)=0$. The problem, then, is to express $X$ in terms of $F$, $A$, and $P$. If you’re made a Venn diagram, you can see that $X$ is the region inside both $F$ and $P$, but outside $A$. In other words, $X=(F\cap P)\setminus A$. If you’re more accustomed to complements than to set differences, you might be more familiar with that as $X=F\cap P\cap A^c$.
H: Finding two numbers when having their sum and product I have two numbers, their sum is 41 and their product is 238. What are the numbers? I got during this far in my calculations: $a+b=41,\quad ab=238,\quad 238=41-b.$ I appreciate answers or tips to help me complete this. Thanks in advance AI: Your first two equations are correct. One way to continue is to solve one of them for a variable. For example, you could find $$ a = 41 - b $$ and substitute into the other equation to get $$ (41 - b)b = 238. $$ The equation in $b$ can be rewritten $b^2 - 41b + 238 = 0$, which has solutions $7$ and $34$ (you can use the quadratic formula to find these). If we use this information in $a + b = 41$, we also get solutions of $7$ and $34$ for $a$. As far as we are concerned in this problem, there is no difference between the solution $a = 7$ and $b = 34$ and the solution $a = 34$ and $b = 7$. We may simply say: "The two numbers with sum $41$ and product $238$ are $7$ and $34$."
H: Is it true $\operatorname{st}(^\ast A) = \overline{A}$, when $A$ is a bounded subset of $\mathbb{R}$? Given a bounded subset of $\mathbb{R}$, let $\operatorname{st}(^\ast A)$ be the set of the standard parts of all elements in $^\ast$-transform of $A$, $\overline{A}$ is the closure of $A$.Is it true $\operatorname{st}(^\ast A) = \overline{A}$? It seems to me it's true $\overline{A} \subseteq \operatorname{st}(^\ast A)$.For every $x \in \overline{A}$, there is a sequence $r = \{r_i\}_{i \in \mathbb{N}} \in ^\ast A$ such that $r_i \in A$ for all $i \in \mathbb{N}$ and $\lim_{k \to \infty} r_k = x$. $\operatorname{st}(r) = x$, because for an arbitary $\epsilon$, $\{ i \in \Bbb{N}:|r_i - x|>\epsilon\}$ is finite. But what about the other direction? AI: It appears that you’re using the ultrapower construction. Let $\mathscr{U}$ be the ultrafilter. Suppose that $x\in\operatorname{st}{}^*A$. Then there is $a\in{}^*A$ that is represented by a sequence $\langle a_n:n\in\omega\rangle$ in $A$ with the property that for each $n\in\omega$, $$U_n\triangleq\{k\in\omega:|a_k-x|<2^{-n}\}\in\mathscr{U}\;.$$ For each $n\in\omega$ fix $k(n)\in U_n$; then $\langle a_{k(n)}:n\in\omega\rangle$ is a sequence in $A$ converging to $x$, so $x\in\operatorname{cl}A$.
H: Addition in polar form $$u_{1}(t) = 120\sqrt{2}e^{j5000t}$$ $$u_{2}(t) = -j160\sqrt{2}e^{j5000t}$$ I need to add these two values, so: $u(t) = u_{1}(t) + u_{2}(t) = (120 - j160)\sqrt{2}e^{j5000t} = ...$ What next? How can I do this without changing the form of the numbers? AI: Write $120-j160$ in polar form; that is, find the $r>0$ and $\theta\in[0,2\pi)$ such that $$120-j160=re^{j\theta}.$$ Then you'll have $$u(t)= (120 - j160)\sqrt{2}e^{j5000t} = re^{j\theta}\cdot\sqrt{2}e^{j5000t}=(r\sqrt{2})e^{j(\theta+5000t)}.$$
H: Question on a French math text by P. Masani I'm trying to translate a paper on matrix-valued functions by P. Masani, published in C. R. Acad. Sci. Paris, 249, 1959, p. 873. (see http://temp-share.com/show/FHKd40yi6 for scanned pdf). My specific question is now as follows: On the first page, in the first section after the abstract, he writes "(..) et rang $\Psi$=Cte $\rho$, p.p. où $1\le\rho\le q$, (..)" where $\Psi$ is a $q\times q$ matrix-valued function on the unit circle. What does "Cte $\rho$" mean? AI: "Cte" is an abbreviation for "constante", which means, as you can guess, constant.
H: Whether the limit on representable functors be non-representable? I'm looking for examples of the following situation: Let $A$ be a complete and cocomplete category, $B$ is a small category and $T\colon B\to\mathbf{Set}^{A^{op}}$ be a functor, such that for any $b\in B$ functor $T(b)$ is representable. Could it be that the functor $\varprojlim T$ is not representable? AI: By the Yoneda-Lemma, $T$ lifts to a diagram $X : B \to A$, which has a limit $\{L \to X_b\}$. Then one easily checks that $\{\hom(-,L) \to T_b\}$ is a limit (in fact the Yoneda embedding preserves all limits).
H: Does this proof contain a contradiction? I have made the following proof and I am asking if there is anything wrong in my steps: Let $f:\mathbb{R}\to\mathbb{R}$ be a real analytic function with infinitely many zeros. Let $a\neq 0$ be a real number. We know that the set $f^{-1}(a)$ is discrete. I want to make a bijection between (not necessarily an isomorphism) $f^{-1}(a)$ and a finite Abelian group $T$. I have two cases: 1) If the set $f^{-1}(a)$ is finite, then a bijection exists if the two sets $f^{-1}(a)$ and $T$ have the same number of elements. 2) If the set $f^{-1}(a)$ is infinite, then we can find a bijection between $f^{-1}(a)$ and $ℤ$, hence we can mod out (http://en.wikipedia.org/wiki/Modulo_(jargon)) $ℤ$ by an integer $n≠0$ to obtain a smaller and finite structure whose elements are the classes, namely we obtain the finite group $ℤ/nℤ$. Hence in this cases we can construct a bijection between $ℤ/nℤ$ and a finite Abelian group $T$. AI: I have to object to the second part of your proof. If you have an infinite set, you can't construct a bijection with a finite set, essentially by definition. It also seems to me that it woud be more natural in this problem to consider a bijection between $f^{-1}(a)$ and some finite set $S$, as you are not trying to construct an isomorphism (or homomorphism). The end result would be the same, and it seems that this would be less confused. Trying to relate the set $f^{-1}(a)$ to a group is only causing confusion: the part when you construct a bijection and then mod out doesn't make sense (in the context of this problem/proof). If you want to show that there exists a bijection between $f^{-1}(a)$ and a finite set, you will have to show that case $2$ cannot occur.
H: Why do we need to find the intersection between these lines? We have the functions $$ x = -1 + 2 \cos(t)$$ $$ y = 3 + 2 \sin(t)$$ They give P's orbit with $t$ on $\left[0, \dfrac{3}{2} \pi\right]$ Find (to 2 decimal places accurate) for which values of t the Point t is left of the line $x=-2.$ So we're allowed to use our calculators, and the answer model says that to find the solution you first need to find the intersection between $\;y=-2\;$ and $\;y=-1 + 2\cos (x)$. My question is; why does this work? AI: I agree with Ross Millikan that there is a typo, and the suggestion is to solve the intersection between $x = -2$ and $x = -1 + 2\cos t$. Solving for $t$ at that intersection will give you the value of $t$ exactly where $x = -2$. Knowing that, you can then determine which values of $t$ must therefore lie to the left of the line $x = -2$. Essentially, the lines will intersect when $x = -2$ and $x = -1 + 2\cos t$, i.e., when $$-2 = -1 + 2\cos t\iff 2\cos t = -1\iff \cos t = \frac{-1}{2}$$ So, when $\cos t = -\frac 12$, we're on the line $x = -2$. So when $\cos t \lt -\frac 12$, we're to the left of the line $x = -2$.
H: Convergence of $\int_0^1 \sqrt[3]{\ln(1/x)} \mathrm{d}x $ Does $$\int_0^1 \sqrt[3]{\ln\left(\frac{1}{x}\right)} \mathrm{d}x$$ converge? WA says it is equal to $\Gamma(4/3)$, however calculating the antiderivative seems approachless to me and can't compare to other functions. I would appreciate any help. Thanks. AI: Hint: Substitute $x=e^{-t}$ in the integral. You should end up with $$\int_0^{\infty} dt \, e^{-t} \,t^{1/3}$$