{"id":4862,"date":"2021-07-27T06:29:22","date_gmt":"2021-07-27T06:29:22","guid":{"rendered":"https:\/\/www.aiproblog.com\/index.php\/2021\/07\/27\/a-gentle-introduction-to-vector-valued-functions\/"},"modified":"2021-07-27T06:29:22","modified_gmt":"2021-07-27T06:29:22","slug":"a-gentle-introduction-to-vector-valued-functions","status":"publish","type":"post","link":"https:\/\/www.aiproblog.com\/index.php\/2021\/07\/27\/a-gentle-introduction-to-vector-valued-functions\/","title":{"rendered":"A Gentle Introduction To Vector Valued Functions"},"content":{"rendered":"<p>Author: Mehreen Saeed<\/p>\n<div>\n<p>Vector valued functions are often encountered in machine learning, computer graphics and computer vision algorithms. They are particularly useful for defining the <span style=\"font-weight: 400;\">parametric<\/span> equations of space curves. It is important to gain a basic understanding of vector valued functions to grasp more complex concepts.<\/p>\n<p>In this tutorial, you will discover what vector valued functions are, how to define them and some examples.<\/p>\n<p>After completing this tutorial, you will know:<\/p>\n<ul>\n<li>Definition of vector valued functions<\/li>\n<li>Derivatives of vector valued functions<\/li>\n<\/ul>\n<p>Let\u2019s get started.<\/p>\n<div id=\"attachment_12633\" style=\"width: 415px\" class=\"wp-caption aligncenter\">\n<a href=\"https:\/\/machinelearningmastery.com\/wp-content\/uploads\/2021\/07\/mano.png\"><img decoding=\"async\" aria-describedby=\"caption-attachment-12633\" loading=\"lazy\" class=\"wp-image-12633 \" src=\"https:\/\/machinelearningmastery.com\/wp-content\/uploads\/2021\/07\/mano-300x235.png\" alt=\"\" width=\"405\" height=\"318\" srcset=\"https:\/\/machinelearningmastery.com\/wp-content\/uploads\/2021\/07\/mano-300x235.png 300w, https:\/\/machinelearningmastery.com\/wp-content\/uploads\/2021\/07\/mano-1024x802.png 1024w, https:\/\/machinelearningmastery.com\/wp-content\/uploads\/2021\/07\/mano-768x602.png 768w, https:\/\/machinelearningmastery.com\/wp-content\/uploads\/2021\/07\/mano-1536x1204.png 1536w, https:\/\/machinelearningmastery.com\/wp-content\/uploads\/2021\/07\/mano.png 1756w\" sizes=\"(max-width: 405px) 100vw, 405px\"><\/a><\/p>\n<p id=\"caption-attachment-12633\" class=\"wp-caption-text\">A gentle iIntroduction to vector valued functions. Photo by Noreen Saeed, some rights reserved<\/p>\n<\/div>\n<h2>Tutorial Overview<\/h2>\n<p>This tutorial is divided into two parts; they are:<\/p>\n<ol>\n<li>Definition and examples of vector valued functions<\/li>\n<li>Differentiating vector valued functions<\/li>\n<\/ol>\n<h2 id=\"Definition-of-a-Vector-Valued-Function\">Definition of a Vector Valued Function<\/h2>\n<p>A vector valued function is also called a vector function. It is a function with the following two properties:<\/p>\n<ol>\n<li>The domain is a set of real numbers<\/li>\n<li>The range is a set of vectors<\/li>\n<\/ol>\n<p>Vector functions are, therefore, simply an extension of scalar functions, where both the domain and the range are the set of real numbers.<\/p>\n<p>In this tutorial we\u2019ll consider vector functions whose range is the set of two or three dimensional vectors. Hence, such functions can be used to define a set of points in space.<\/p>\n<p>Given the unit vectors i,j,k parallel to the x,y,z-axis respectively, we can write a three dimensional vector valued function as:<\/p>\n<p style=\"text-align: center;\">r(t) = x(t)i + y(t)j + z(t)k<\/p>\n<p>It can also be written as:<\/p>\n<p style=\"text-align: center;\">r(t) = &lt;x(t), y(t), z(t)&gt;<\/p>\n<p>Both the above notations are equivalent and often used in various textbooks.<\/p>\n<h3 id=\"Space-Curves-and-Parametric-Equations\">Space Curves and Parametric Equations<\/h3>\n<p>We defined a vector function r(t) in the preceding section. For different values of t we get the corresponding (x,y,z) coordinates, defined by the functions x(t), y(t) and z(t). The set of generated points (x,y,z), therefore, define a curve called the space curve C. The equations for x(t), y(t) and z(t) are also called the <span style=\"font-weight: 400;\">parametric<\/span> equations of the curve C.<\/p>\n<h2 id=\"Examples-of-Vector-Functions\">Examples of Vector Functions<\/h2>\n<p>This section shows some examples of vector valued functions that define space curves. All the examples are also plotted in the figure shown after the examples.<\/p>\n<h3 id=\"1.1--A-Circle\">1.1 A Circle<\/h3>\n<p>Let\u2019s start with a simple example of a vector function in 2D space:<\/p>\n<p style=\"text-align: center;\">r_1(t) = cos(t)i + sin(t)j<\/p>\n<p>Here the parametric equations are:<\/p>\n<p style=\"text-align: center;\">x(t) = cos(t)<\/p>\n<p style=\"text-align: center;\">y(t) = sin(t)<\/p>\n<p>The space curve defined by the <span style=\"font-weight: 400;\">parametric<\/span> equations is a circle in 2D space as shown in the figure. If we vary t from -\ud835\udf0b to\u00a0\ud835\udf0b, we\u2019ll generate all the points that lie on the circle.<\/p>\n<h3 id=\"1.2-A-Helix\">1.2 A Helix<\/h3>\n<p>We can extend the r_1(t) function of example 1.1, to easily generate a helix in 3D space. We just need to add the value along the z <span style=\"font-weight: 400;\">axis\u00a0<\/span>that changes with t. Hence, we have the following function:<\/p>\n<p style=\"text-align: center;\">r_2(t) = cos(t)i + sin(t)j + tk<\/p>\n<h3 id=\"1.3-A-Twisted-Cubic\">1.3 A Twisted Cubic<\/h3>\n<p>We can also define a curve called the twisted cubic with an interesting shape as:<\/p>\n<p style=\"text-align: center;\">r_3(t) = ti + t^2j + t^3k<\/p>\n<div id=\"attachment_12623\" style=\"width: 820px\" class=\"wp-caption aligncenter\">\n<a href=\"https:\/\/machinelearningmastery.com\/wp-content\/uploads\/2021\/07\/vecfun1.png\"><img decoding=\"async\" aria-describedby=\"caption-attachment-12623\" loading=\"lazy\" class=\"wp-image-12623\" src=\"https:\/\/machinelearningmastery.com\/wp-content\/uploads\/2021\/07\/vecfun1-300x97.png\" alt=\"Parametric curves\" width=\"810\" height=\"262\" srcset=\"https:\/\/machinelearningmastery.com\/wp-content\/uploads\/2021\/07\/vecfun1-300x97.png 300w, https:\/\/machinelearningmastery.com\/wp-content\/uploads\/2021\/07\/vecfun1-1024x331.png 1024w, https:\/\/machinelearningmastery.com\/wp-content\/uploads\/2021\/07\/vecfun1-768x248.png 768w, https:\/\/machinelearningmastery.com\/wp-content\/uploads\/2021\/07\/vecfun1.png 1466w\" sizes=\"(max-width: 810px) 100vw, 810px\"><\/a><\/p>\n<p id=\"caption-attachment-12623\" class=\"wp-caption-text\">Parametric curves<\/p>\n<\/div>\n<h2 id=\"Derivatives-of-Vector-Functions\">Derivatives of Vector Functions<\/h2>\n<p>We can easily extend the idea of the derivative of a scalar function to the derivative of a vector function. As the range of a vector function is a set of vectors, its derivative is also a vector.<\/p>\n<p>If<\/p>\n<p style=\"text-align: center;\">r(t) = x(t)i + y(t)j + z(t)k<\/p>\n<p>then the derivative of r(t) is given by r'(t) computed as:<\/p>\n<p style=\"text-align: center;\">r'(t) = x'(t)i + y'(t)i + z'(t)k<\/p>\n<h2 id=\"Examples-of-Derivatives-of-Vector-Functions\">Examples of Derivatives of Vector Functions<\/h2>\n<p>We can find the derivatives of the functions defined in the previous example as:<\/p>\n<h3 id=\"2.1-A-Circle\">2.1 A Circle<\/h3>\n<p>The parametric\u00a0equation of a circle in 2D is given by:<\/p>\n<p style=\"text-align: center;\">r_1(t) = cos(t)i + sin(t)j<\/p>\n<p>Its derivative is therefore computed by computing the corresponding derivatives of x(t) and y(t) as shown below:<\/p>\n<p style=\"text-align: center;\">x'(t) = -sin(t)<\/p>\n<p style=\"text-align: center;\">y'(t) = cos(t)<\/p>\n<p>This gives us:<\/p>\n<p style=\"text-align: center;\">r_1\u2032(t) = x'(t)i + y'(t)j<\/p>\n<p style=\"text-align: center;\">r_1\u2032(t) = -sin(t)i + cos(t)j<\/p>\n<p>The space curve defined by the parametric equations is a circle in 2D space as shown in the figure. If we vary t from -\ud835\udf0b to \u03c0, we\u2019ll generate all the points that lie on the circle.<\/p>\n<h3 id=\"2.2-A-Helix\">2.2 A Helix<\/h3>\n<p>Similar to the previous example, we can compute the derivative of r_2(t) as:<\/p>\n<p style=\"text-align: center;\">r_2(t) = cos(t)i + sin(t)j + tk<\/p>\n<p style=\"text-align: center;\">r_2\u2032(t) = -sin(t)i + cos(t)j + k<\/p>\n<h3 id=\"2.3-A-Twisted-Cubic\">2.3 A Twisted Cubic<\/h3>\n<p>The derivative of r_3(t) is given by:<\/p>\n<p style=\"text-align: center;\">r_3(t) = ti + t^2j + t^3k<\/p>\n<p style=\"text-align: center;\">r_3\u2032(t) = i + 2tj + 3t^2k<\/p>\n<p>All the above examples are shown in the figure, where the derivatives are plotted in red. Note the circle\u2019s derivative also defines a circle in space.<\/p>\n<div id=\"attachment_12624\" style=\"width: 773px\" class=\"wp-caption aligncenter\">\n<a href=\"https:\/\/machinelearningmastery.com\/wp-content\/uploads\/2021\/07\/vecfun2.png\"><img decoding=\"async\" aria-describedby=\"caption-attachment-12624\" loading=\"lazy\" class=\"wp-image-12624\" src=\"https:\/\/machinelearningmastery.com\/wp-content\/uploads\/2021\/07\/vecfun2-300x103.png\" alt=\"Parametric functions and their derivatives\" width=\"763\" height=\"262\" srcset=\"https:\/\/machinelearningmastery.com\/wp-content\/uploads\/2021\/07\/vecfun2-300x103.png 300w, https:\/\/machinelearningmastery.com\/wp-content\/uploads\/2021\/07\/vecfun2-1024x353.png 1024w, https:\/\/machinelearningmastery.com\/wp-content\/uploads\/2021\/07\/vecfun2-768x265.png 768w, https:\/\/machinelearningmastery.com\/wp-content\/uploads\/2021\/07\/vecfun2.png 1490w\" sizes=\"(max-width: 763px) 100vw, 763px\"><\/a><\/p>\n<p id=\"caption-attachment-12624\" class=\"wp-caption-text\">Parametric functions and their derivatives<\/p>\n<\/div>\n<h2 id=\"More-Complex-Examples\">More Complex Examples<\/h2>\n<p>Once you gain a basic understanding of these functions, you can have a lot of fun defining various shapes and curves in space. Other popular examples used by the mathematical community are defined below and illustrated in the figure.<\/p>\n<p><strong>The toroidal spira<\/strong>l:<\/p>\n<p style=\"text-align: center;\">r_4(t) = (4 + sin(20t))cos(t)i + (4 + sin(20t))sin(t)j + cos(20t)k<\/p>\n<p><strong>The trefoil knot<\/strong>:<\/p>\n<p style=\"text-align: center;\">r_5(t) = (2 + cos(1.5t)cos (t)i + (2 + cos(1.5t))sin(t)j + sin(1.5t)k<\/p>\n<p><strong>The cardioid:<\/strong><\/p>\n<p style=\"text-align: center;\">r_6(t) = cos(t)(1-cos(t))i + sin(t)(1-cos(t))j<\/p>\n<div id=\"attachment_12625\" style=\"width: 842px\" class=\"wp-caption alignnone\">\n<a href=\"https:\/\/machinelearningmastery.com\/wp-content\/uploads\/2021\/07\/vecfunc3.png\"><img decoding=\"async\" aria-describedby=\"caption-attachment-12625\" loading=\"lazy\" class=\"wp-image-12625\" src=\"https:\/\/machinelearningmastery.com\/wp-content\/uploads\/2021\/07\/vecfunc3-300x85.png\" alt=\"Graphs of more complex curves\" width=\"832\" height=\"236\" srcset=\"https:\/\/machinelearningmastery.com\/wp-content\/uploads\/2021\/07\/vecfunc3-300x85.png 300w, https:\/\/machinelearningmastery.com\/wp-content\/uploads\/2021\/07\/vecfunc3-1024x289.png 1024w, https:\/\/machinelearningmastery.com\/wp-content\/uploads\/2021\/07\/vecfunc3-768x217.png 768w, https:\/\/machinelearningmastery.com\/wp-content\/uploads\/2021\/07\/vecfunc3.png 1468w\" sizes=\"(max-width: 832px) 100vw, 832px\"><\/a><\/p>\n<p id=\"caption-attachment-12625\" class=\"wp-caption-text\">More complex curves<\/p>\n<\/div>\n<h2>Importance of Vector Valued Functions in Machine Learning<\/h2>\n<p>Vector valued functions play an important role in machine learning algorithms. Being an extension of scalar valued functions, \u00a0you would encounter them in tasks such as multi-class classification and multi-label problems. <a href=\"https:\/\/en.wikipedia.org\/wiki\/Kernel_methods_for_vector_output\">Kernel methods<\/a>, an important area of machine learning, can involve computing vector valued functions, which can be later used in multi-task learning or transfer learning.<\/p>\n<h2 id=\"Extensions\">Extensions<\/h2>\n<p>This section lists some ideas for extending the tutorial that you may wish to explore.<\/p>\n<ul>\n<li>Integrating vector functions<\/li>\n<li>Projectile motion<\/li>\n<li>Arc length in space<\/li>\n<li><a href=\"https:\/\/en.wikipedia.org\/wiki\/Kernel_methods_for_vector_output\">Kernel methods for vector output<\/a><\/li>\n<\/ul>\n<p>If you explore any of these extensions, I\u2019d love to know. Post your findings in the comments below.<\/p>\n<h2 id=\"Further-Reading\">Further Reading<\/h2>\n<p>This section provides more resources on the topic if you are looking to go deeper.<\/p>\n<h3 id=\"Tutorials\">Tutorials<\/h3>\n<ul>\n<li><a href=\"https:\/\/machinelearningmastery.com\/a-gentle-introduction-to-multivariate-calculus\">A Gentle Introduction to Multivariate Calculus<\/a><\/li>\n<li><a href=\"https:\/\/machinelearningmastery.com\/a-gentle-introduction-to-function-derivatives\" target=\"_blank\" rel=\"noopener\">Derivatives<\/a><\/li>\n<\/ul>\n<h3 id=\"Resources\">Resources<\/h3>\n<ul>\n<li>Additional resources on <a href=\"https:\/\/machinelearningmastery.com\/calculus-books-for-machine-learning\/\">Calculus Books for Machine Learning<\/a>\n<\/li>\n<\/ul>\n<h3 id=\"Books\">Books<\/h3>\n<ul>\n<li>\n<a href=\"https:\/\/amzn.to\/35Yeolv\" target=\"_blank\" rel=\"noopener\">Thomas\u2019 Calculus<\/a>, 14th edition, 2017. (based on the original works of George B. Thomas, revised by Joel Hass, Christopher Heil, Maurice Weir)<\/li>\n<li>\n<a href=\"https:\/\/www.amazon.com\/Calculus-3rd-Gilbert-Strang\/dp\/0980232759\/ref=as_li_ss_tl?dchild=1&amp;keywords=Gilbert+Strang+calculus&amp;qid=1606171602&amp;s=books&amp;sr=1-1&amp;linkCode=sl1&amp;tag=inspiredalgor-20&amp;linkId=423b93db012f7cc6bb92cb7494a3095f&amp;language=en_US\" target=\"_blank\" rel=\"noopener\">Calculus<\/a>, 3rd Edition, 2017. (Gilbert Strang)<\/li>\n<li>\n<a href=\"https:\/\/amzn.to\/3kS9I52\" target=\"_blank\" rel=\"noopener\">Calculus<\/a>, 8th edition, 2015. (James Stewart)<\/li>\n<\/ul>\n<h2 id=\"Summary\">Summary<\/h2>\n<p>In this tutorial, you discovered what vector functions are and how to differentiate them.<\/p>\n<p>Specifically, you learned:<\/p>\n<ul>\n<li>Definition of vector functions<\/li>\n<li>\n<span style=\"font-weight: 400;\">Parametric<\/span> curves<\/li>\n<li>Differentiating vector functions<\/li>\n<\/ul>\n<h2 id=\"Do-you-have-any-questions?\">Do you have any questions?<\/h2>\n<p>Ask your questions in the comments below and I will do my best to answer.<\/p>\n<p>The post <a rel=\"nofollow\" href=\"https:\/\/machinelearningmastery.com\/a-gentle-introduction-to-vector-valued-functions\/\">A Gentle Introduction To Vector Valued Functions<\/a> appeared first on <a rel=\"nofollow\" href=\"https:\/\/machinelearningmastery.com\/\">Machine Learning Mastery<\/a>.<\/p>\n<\/div>\n<p><a href=\"https:\/\/machinelearningmastery.com\/a-gentle-introduction-to-vector-valued-functions\/\">Go to Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Author: Mehreen Saeed Vector valued functions are often encountered in machine learning, computer graphics and computer vision algorithms. They are particularly useful for defining the [&hellip;] <span class=\"read-more-link\"><a class=\"read-more\" href=\"https:\/\/www.aiproblog.com\/index.php\/2021\/07\/27\/a-gentle-introduction-to-vector-valued-functions\/\">Read More<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":4863,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"categories":[24],"tags":[],"_links":{"self":[{"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/posts\/4862"}],"collection":[{"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/comments?post=4862"}],"version-history":[{"count":0,"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/posts\/4862\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/media\/4863"}],"wp:attachment":[{"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/media?parent=4862"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/categories?post=4862"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/tags?post=4862"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}