Sub Project_5_EN(ByVal VecType, m, n, m1, n1 As Integer) ' 05_Cross product_EN ' Updated: 26/03/24 ' Created by: Ariel R. Becerra (21/11/23) ' Modified by: _________________ ' This is the code of your new project. ' Steps to embed the code to ScienSolar: ' Note 1: The number 5 in the name of this function must match the one in the list of the CONFIG sheet for this project. If not, please correct it. ' Note 2: This code will be integrated into the main code to automate the download of the project. ' Note 3: The formulas and cell values generated here correspond only to the first 30 columns from INICIO to the right in the sheet. All your formulas and values are recommended to be written in these columns. ' Step 1. Go to the CONFIG sheet and add a short name and the number of your new project to the last row in the projects list. ' Step 2. Make sure that the list of projects in CONFIG sheet has the correct ascending numbering. ' Step 4. Open the VBA editor (Alt + F11 in Windows or Fn + Option + F11 in macOS). To avoid mistakes, make sure you only have one workbook open. ' Step 5. On the left, in the project explorer, select a non full module (or add a new one). ' Step 6. Select all the code in this file, copy and paste it at the end of the existing code in the module (or in the new one). ' Step 7. To load the project and to check it in a new sheet, go to the CONFIG sheet and click the New Sheet button, then select the project from the list and click the +Vector button. ' Step 8. Click any XYZ button to get the project in the coordinate system. Enjoy it! ' Visit www.sciensolar.com for news and updates of ? ScienSolar. Cells(m1 - 1, n1 + 2).FormulaR1C1 = "1" Cells(m1 + 0, n1 + 2).FormulaR1C1 = "=CONFIG!R3C4" Cells(m1 + 0, n1 + 3).FormulaR1C1 = "850" Cells(m1 + 0, n1 + 6).FormulaR1C1 = "=CONFIG!R3C8" Cells(m1 + 0, n1 + 7).FormulaR1C1 = "8" Cells(m1 + 0, n1 + 8).FormulaR1C1 = "Ariel R. Becerra (21/11/23)" Cells(m1 + 1, n1 + 2).FormulaR1C1 = "=CONFIG!R4C4" Cells(m1 + 1, n1 + 3).FormulaR1C1 = "400" Cells(m1 + 1, n1 + 4).FormulaR1C1 = "=CONFIG!R4C6" Cells(m1 + 1, n1 + 5).FormulaR1C1 = "0" Cells(m1 + 1, n1 + 6).FormulaR1C1 = "=CONFIG!R4C8" Cells(m1 + 1, n1 + 7).FormulaR1C1 = "45" Cells(m1 + 2, n1 + 2).FormulaR1C1 = "=CONFIG!R5C4" Cells(m1 + 2, n1 + 3).FormulaR1C1 = "20" Cells(m1 + 2, n1 + 4).FormulaR1C1 = "=CONFIG!R5C6" Cells(m1 + 2, n1 + 5).FormulaR1C1 = "15" Cells(m1 + 2, n1 + 6).FormulaR1C1 = "=CONFIG!R5C8" Cells(m1 + 2, n1 + 7).FormulaR1C1 = "0" Cells(m1 + 3, n1 + 0).FormulaR1C1 = "a" Cells(m1 + 3, n1 + 2).FormulaR1C1 = "=CONFIG!R6C4" Cells(m1 + 3, n1 + 3).FormulaR1C1 = "200" Cells(m1 + 3, n1 + 4).FormulaR1C1 = "=CONFIG!R6C6" Cells(m1 + 3, n1 + 5).FormulaR1C1 = "735" Cells(m1, n1 + 9).FormulaR1C1 = " ?" Dim HELPtxt As String HELPtxt = "CROSS PRODUCT" & Chr(10) & _ " The vector product of two vectors a and b (written a x b) is called vector c whose length is equal to |a||b|sin alpha, which corresponds to the area of " & ChrW(233) & "" & ChrW(233) & "the parallelogram built on these vectors, and whose direction is perpendicular to both vectors and is given by the right hand rule. If the lengths of the vectors and the angle between them are given, then vector c can be found. If the vectors are given in the form a = (ax,ay,az) and b = (bx,by,bz), then the vector c is calculated in Cartesian coordinates using the formula:" & Chr(10) & _ " a x b = (aybz - azby)i + (azbx - axbz)j+ (axby - aybx)k" & Chr(10) & _ " Enter the initial coordinates of the first vector in cells A10, B10, C10, the increments of its coordinates in A12, B12, C12. For the second vector correspondingly in A19, B19, C19 and A21, B21, C21. The result is a vector whose coordinates are observed in cells A30, B30, C30 and whose origin can be changed through cells A28, B28, C28." Cells(m1, n1 + 9).Comment.Text Text:=HELPtxt If m = m1 + 0 Then ' vector 3 Cells(m + 3, n + -1).FormulaR1C1 = "1" Cells(m + 3, n + 0).FormulaR1C1 = "a" Cells(m + 3, n + 2).FormulaR1C1 = "=CONFIG!R6C4" Cells(m + 3, n + 3).FormulaR1C1 = "200" Cells(m + 3, n + 4).FormulaR1C1 = "=CONFIG!R6C6" Cells(m + 3, n + 5).FormulaR1C1 = "735" Cells(m + 4, n + -1).FormulaR1C1 = "1" Cells(m + 4, n + 0).FormulaR1C1 = "183" Cells(m + 4, n + 2).FormulaR1C1 = "Cross product" Cells(m + 4, n + 12).FormulaR1C1 = "VECTOR PRODUCT OF TWO VECTORS" Cells(m + 4, n + 24).FormulaR1C1 = "INSTRUCTIONS" Cells(m + 5, n + -1).FormulaR1C1 = "1" Cells(m + 5, n + 0).FormulaR1C1 = "1" Cells(m + 5, n + 1).FormulaR1C1 = "0" Cells(m + 6, n + -1).FormulaR1C1 = "aox" Cells(m + 6, n + 0).FormulaR1C1 = "aoy" Cells(m + 6, n + 1).FormulaR1C1 = "aoz" Cells(m + 7, n + -1).FormulaR1C1 = "2" Cells(m + 7, n + 0).FormulaR1C1 = "4" Cells(m + 7, n + 1).FormulaR1C1 = "=R[-7]C+R[-9]C" Cells(m + 7, n + 4).FormulaR1C1 = " | a x b | =" Cells(m + 7, n + 5).FormulaR1C1 = "=ROUND(SQRT(R[20]C[-6]^2+R[20]C[-5]^2+R[20]C[-4]^2),2)" Cells(m + 7, n + 21).FormulaR1C1 = "The vector product of two vectors a and b (written a x b) is a vector c whose length is" Cells(m + 8, n + -1).FormulaR1C1 = "ax" Cells(m + 8, n + 0).FormulaR1C1 = "ay" Cells(m + 8, n + 1).FormulaR1C1 = "az" Cells(m + 8, n + 2).FormulaR1C1 = "=IF(R[-4]C[-1]>1,"" <-- Variable coordinates"","""")" Cells(m + 8, n + 4).FormulaR1C1 = "(Eq-5-2)" Cells(m + 8, n + 21).FormulaR1C1 = "equal to the product of the magnitudes of the vectors times the sine of the angle between them and" Cells(m + 9, n + -1).FormulaR1C1 = "2" Cells(m + 9, n + 0).FormulaR1C1 = "0" Cells(m + 9, n + 1).FormulaR1C1 = "0" Cells(m + 9, n + 2).FormulaR1C1 = "<< --- a" Cells(m + 9, n + 21).FormulaR1C1 = "whose direction is perpendicular to both vectors and is governed by the right-hand rule. If the lengths are given" Cells(m + 10, n + -1).FormulaR1C1 = "1" Cells(m + 10, n + 0).FormulaR1C1 = "0" Cells(m + 10, n + 1).FormulaR1C1 = "1" Cells(m + 10, n + 4).FormulaR1C1 = "=IF(RC[-4]>0,"" For aditional formula (FA),"","""")" Cells(m + 10, n + 21).FormulaR1C1 = "and the angle alpha between them, then the resulting vector can be found by determining its direction by the " Cells(m + 11, n + -1).FormulaR1C1 = "3" Cells(m + 11, n + 0).FormulaR1C1 = "0" Cells(m + 11, n + 1).FormulaR1C1 = "1" Cells(m + 11, n + 4).FormulaR1C1 = "=IF(R[-1]C[-4]>0,""<-- use these cells."","""")" Cells(m + 11, n + 21).FormulaR1C1 = "right-hand rule and its magnitude by the formula ab Sine alpha. On the other hand, if the vectors are given " Cells(m + 3, n + 1).Interior.Color = "11892015" Cells(m + 3, n + 1).Font.Size = "11" Cells(m + 3, n + 1).Font.name = "Calibri" Cells(m + 4, n - 1).Value = 1 Cells(m1 + 1, n1 + 1).Value = "b" Call AddNewVector End If ' vector ends If m = m1 + 9 Then ' vector 2 Cells(m + 3, n + -1).FormulaR1C1 = "2" Cells(m + 3, n + 0).FormulaR1C1 = "b" Cells(m + 3, n + 21).FormulaR1C1 = "in the form" Cells(m + 4, n + -1).FormulaR1C1 = "1" Cells(m + 4, n + 0).FormulaR1C1 = "183" Cells(m + 5, n + -1).FormulaR1C1 = "1" Cells(m + 5, n + 0).FormulaR1C1 = "1" Cells(m + 5, n + 1).FormulaR1C1 = "0" Cells(m + 5, n + 27).FormulaR1C1 = "(Eq-3-2)" Cells(m + 6, n + -1).FormulaR1C1 = "box" Cells(m + 6, n + 0).FormulaR1C1 = "boy" Cells(m + 6, n + 1).FormulaR1C1 = "boz" Cells(m + 7, n + -1).FormulaR1C1 = "=R[-9]C" Cells(m + 7, n + 0).FormulaR1C1 = "=R[-9]C" Cells(m + 7, n + 1).FormulaR1C1 = "=R[-9]C" Cells(m + 8, n + -1).FormulaR1C1 = "bx" Cells(m + 8, n + 0).FormulaR1C1 = "by" Cells(m + 8, n + 1).FormulaR1C1 = "bz" Cells(m + 8, n + 2).FormulaR1C1 = "=IF(R[-4]C[-1]>1,"" <-- Variable coordinates"","""")" Cells(m + 8, n + 21).FormulaR1C1 = "then the vector c is calculated in Cartesian coordinates by the formula:" Cells(m + 9, n + -1).FormulaR1C1 = "0" Cells(m + 9, n + 0).FormulaR1C1 = "0" Cells(m + 9, n + 1).FormulaR1C1 = "3" Cells(m + 9, n + 2).FormulaR1C1 = "<< --- b" Cells(m + 10, n + -1).FormulaR1C1 = "1" Cells(m + 10, n + 0).FormulaR1C1 = "0" Cells(m + 10, n + 1).FormulaR1C1 = "1" Cells(m + 10, n + 4).FormulaR1C1 = "=IF(RC[-4]>0,"" For aditional formula (FA),"","""")" Cells(m + 10, n + 27).FormulaR1C1 = "(Eq-5-1)" Cells(m + 11, n + -1).FormulaR1C1 = "3" Cells(m + 11, n + 0).FormulaR1C1 = "0" Cells(m + 11, n + 1).FormulaR1C1 = "1" Cells(m + 11, n + 4).FormulaR1C1 = "=IF(R[-1]C[-4]>0,""<-- use these cells."","""")" Cells(m + 3, n + 1).Interior.Color = "49407" Cells(m + 3, n + 1).Font.Size = "11" Cells(m + 3, n + 1).Font.name = "Calibri" Cells(m + 4, n - 1).Value = 1 Cells(m1 + 1, n1 + 1).Value = "a x b" Call AddNewVector End If ' vector ends If m = m1 + 18 Then ' vector 1 Cells(m + 3, n + -1).FormulaR1C1 = "3" Cells(m + 3, n + 0).FormulaR1C1 = "a x b" Cells(m + 4, n + -1).FormulaR1C1 = "1" Cells(m + 4, n + 0).FormulaR1C1 = "183" Cells(m + 5, n + -1).FormulaR1C1 = "1" Cells(m + 5, n + 0).FormulaR1C1 = "1" Cells(m + 5, n + 1).FormulaR1C1 = "0" Cells(m + 5, n + 21).FormulaR1C1 = "The coordinates of the first vector are entered into the cells:" Cells(m + 6, n + -1).FormulaR1C1 = "a x box" Cells(m + 6, n + 0).FormulaR1C1 = "a x boy" Cells(m + 6, n + 1).FormulaR1C1 = "a x boz" Cells(m + 7, n + -1).FormulaR1C1 = "=R[-18]C" Cells(m + 7, n + 0).FormulaR1C1 = "=R[-18]C" Cells(m + 7, n + 1).FormulaR1C1 = "=R[-18]C" Cells(m + 7, n + 22).FormulaR1C1 = "a_ox in cell A10" Cells(m + 8, n + -1).FormulaR1C1 = "a x bx" Cells(m + 8, n + 0).FormulaR1C1 = "a x by" Cells(m + 8, n + 1).FormulaR1C1 = "a x bz" Cells(m + 8, n + 2).FormulaR1C1 = "=IF(R[-4]C[-1]>1,"" <-- Variable coordinates"","""")" Cells(m + 8, n + 22).FormulaR1C1 = "a_oy in cell B10" Cells(m + 9, n + -1).FormulaR1C1 = "=R[-18]C[1]*R[-9]C[2]-R[-18]C[2]*R[-9]C[1]" Cells(m + 9, n + 0).FormulaR1C1 = "=-R[-18]C[-1]*R[-9]C[1]+R[-18]C[1]*R[-9]C[-1]" Cells(m + 9, n + 1).FormulaR1C1 = "=R[-18]C[-2]*R[-9]C[-1]-R[-18]C[-1]*R[-9]C[-2]" Cells(m + 9, n + 2).FormulaR1C1 = "(Eq-5-1)" Cells(m + 9, n + 22).FormulaR1C1 = "a_oz in cell C10" Cells(m + 10, n + -1).FormulaR1C1 = "1" Cells(m + 10, n + 0).FormulaR1C1 = "0" Cells(m + 10, n + 1).FormulaR1C1 = "1" Cells(m + 10, n + 4).FormulaR1C1 = "=IF(RC[-4]>0,"" For aditional formula (FA),"","""")" Cells(m + 11, n + -1).FormulaR1C1 = "3" Cells(m + 11, n + 0).FormulaR1C1 = "0" Cells(m + 11, n + 1).FormulaR1C1 = "1" Cells(m + 11, n + 4).FormulaR1C1 = "=IF(R[-1]C[-4]>0,""<-- use these cells."","""")" Cells(m + 11, n + 22).FormulaR1C1 = "a_x in cell A12" Cells(m + 3, n + 1).Interior.Color = "255" Cells(m + 3, n + 1).Font.Size = "11" Cells(m + 3, n + 1).Font.name = "Calibri" Cells(m + 4, n - 1).Value = 1 Cells(m1 + 1, n1 + 1).Value = "" Cells(m1 + 2, n1 - 1).Value = 3 End If ' vector ends If m = m1 + 18 Then Cells(m + 12, n + 22).FormulaR1C1 = "a_y in cell B12" Cells(m + 13, n + 22).FormulaR1C1 = "a_z in cell C12" Cells(m + 15, n + 21).FormulaR1C1 = "The coordinates of the second vector are entered into the cells:" Cells(m + 17, n + 22).FormulaR1C1 = "b_ox in cell A19" Cells(m + 18, n + 22).FormulaR1C1 = "b_oy in cell B19" Cells(m + 19, n + 22).FormulaR1C1 = "b_oz in cell C19" Cells(m + 21, n + 22).FormulaR1C1 = "b_x in cell A21" Cells(m + 22, n + 22).FormulaR1C1 = "b_y in cell B21" Cells(m + 23, n + 22).FormulaR1C1 = "b_z in cell C21" Cells(m + 25, n + 21).FormulaR1C1 = "The magnitude of the resulting vector a x b is shown in cell G10." Cells(m + 26, n + 21).FormulaR1C1 = "The coordinates of the resulting vector are located in cells A30, B30 and C30. Press the button" Cells(m + 27, n + 21).FormulaR1C1 = "located in D31 to see the equations that take place for its components." Cells(m + 29, n + 21).FormulaR1C1 = "EXAMPLE 1. Given the vectors a = (2,0,0), b = (0,0,3), find c = a x b. Solution: enter A12=2," Cells(m + 30, n + 21).FormulaR1C1 = " B12=0, C12=0, and A21=0, B21=0, C21=3. Press XYZ. You will observe the components of the vector c" Cells(m + 31, n + 21).FormulaR1C1 = "in cells A30=0, B30=6, C30=0. Experiment with other values for the coordinates of" Cells(m + 32, n + 21).FormulaR1C1 = "vectors, including negative values, decimals and multiples of a parameter (in the latter" Cells(m + 33, n + 21).FormulaR1C1 = "case, the parameters can be written in a cell in column G)." Cells(m + 34, n + 21).FormulaR1C1 = "Press XYZ to see the results. Press C to rotate the coordinate system" Cells(m + 35, n + 21).FormulaR1C1 = "and use YZ, XZ and XY to view the vectors from different planes, observe how the" Cells(m + 36, n + 21).FormulaR1C1 = "coordinates of both the resulting vector and the multiplying vectors." Cells(m + 38, n + 21).FormulaR1C1 = "EXERCISE 1. Find i x j, where i, j are versions of the Cartesian system." Cells(m + 39, n + 21).FormulaR1C1 = "EXERCISE 2. Find j x i, where i, j are versions of the Cartesian system." Cells(m + 40, n + 21).FormulaR1C1 = "EXERCISE 3. Find k x j, where k, j are versions of the Cartesian system." Call BlackWhiteDesk Call PutEqBut End If ' actualizar hoja End Sub