Julia PyPlot无法创建二次函数

时间:2016-08-30 19:19:22

标签: matplotlib julia

我正在尝试使用PyPlot学习使用Julia绘制内容,并尝试绘制二次函数。它不喜欢我正在调整x。我尝试使用x ** 2和x * x,编译器也不接受它们。我应该用什么方格x? 感谢

Code @ line 7:

<?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ms="urn:schemas-microsoft-com:xslt" xmlns:dt="urn:schemas-microsoft-com:datatypes" xmlns:exsl="http://exslt.org/common" extension-element-prefixes="exsl"> <xsl:output method="html" encoding="UTF-8" indent="yes" omit-xml-declaration="yes" />


    <xsl:variable name="totalValue">
        <xsl:for-each select="//*[not(Prop[@prop_name = 'imageurl']/@val = following::Prop[@prop_name = 'imageurl']/@val)]">
            <n><xsl:value-of select="Prop[@prop_name = 'tradeval']/@val"/></n>
        </xsl:for-each>
    </xsl:variable>    <xsl:template match="/">
     <span style='color:#cf181e'>   You Have <xsl:value-of select="count(//*[Prop[@prop_name = 'tradeval']/@val and not(Prop[@prop_name = 'imageurl']/@val = preceding::Prop[@prop_name = 'imageurl']/@val)])" />    Things Worth $   <xsl:value-of select="$totalValue" />   </span> </xsl:template>


    <xsl:template match="@*|node()">
        <sum>
            <xsl:copy-of select="sum(exsl:node-set($totalValue)/n)"/>
        </sum>
    </xsl:template>    </xsl:stylesheet>

错误:

<Msg>
  <Props>
    <transactionline_to_customers>
      <transactionline_to_customer>
        <Prop entity_id="117" pk_id="103009" prop_id="10152" prop_name="transactionline_to_productsku.sku" type_id="20" encrypt_flag="0" val="119893" />
        <Prop entity_id="117" pk_id="103009" prop_id="10253" prop_name="transactionline_to_productsku.tradeval" type_id="40" encrypt_flag="0" val="20.0000" />
        <Prop entity_id="117" pk_id="103009" prop_id="10254" prop_name="transactionline_to_productsku.imageurl" type_id="25" encrypt_flag="0" val="http://www.google.com/common/images/1193b.jpg" />
        <transactionline_to_productsku>
          <Prop entity_id="117" pk_id="103009" prop_id="10254" prop_name="imageurl" type_id="25" encrypt_flag="0" val="http://www.google.com/common/images/1193b.jpg" />
          <Prop entity_id="117" pk_id="103009" prop_id="10253" prop_name="tradeval" type_id="40" encrypt_flag="0" val="20.0000" />
          <Prop entity_id="117" pk_id="103009" prop_id="10152" prop_name="sku" type_id="20" encrypt_flag="0" val="119893" />
        </transactionline_to_productsku>
      </transactionline_to_customer>
    </transactionline_to_customers>
    <resdetail_to_customers>
      <resdetail_to_customer>
        <Prop entity_id="117" pk_id="96699" prop_id="10152" prop_name="resdetail_to_prodsku.sku" type_id="20" encrypt_flag="0" val="113573" />
        <Prop entity_id="117" pk_id="96699" prop_id="10253" prop_name="resdetail_to_prodsku.tradeval" type_id="40" encrypt_flag="0" val="20.0000" />
        <Prop entity_id="117" pk_id="96699" prop_id="10254" prop_name="resdetail_to_prodsku.imageurl" type_id="25" encrypt_flag="0" val="http://www.google.com/common/images/1173b.jpg" />
        <resdetail_to_prodsku>
          <Prop entity_id="117" pk_id="96699" prop_id="10152" prop_name="sku" type_id="20" encrypt_flag="0" val="113573" />
          <Prop entity_id="117" pk_id="96699" prop_id="10253" prop_name="tradeval" type_id="40" encrypt_flag="0" val="20.0000" />
          <Prop entity_id="117" pk_id="96699" prop_id="10254" prop_name="imageurl" type_id="25" encrypt_flag="0" val="http://www.google.com/common/images/1173b.jpg" />
        </resdetail_to_prodsku>
      </resdetail_to_customer>
    </resdetail_to_customers>
  </Props>
</Msg>

2 个答案:

答案 0 :(得分:6)

要对数组的每个元素求平方,请使用x.^2

答案 1 :(得分:1)

您正在尝试对数组的所有元素进行平方。这意味着您需要使用元素明细版本x.^2