Ploting or drawing a mathcurve

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • serave

    Ploting or drawing a mathcurve

    Hi i'm new in this group. I need some help with php. I need to draw
    any mathematical function i get through a form?

    Please help me
  • Jeff

    #2
    Re: Ploting or drawing a mathcurve

    serave wrote:
    Hi i'm new in this group. I need some help with php. I need to draw
    any mathematical function i get through a form?
    You may be able to do this using either IMagick or GD. These are your
    php options. You may find this easier to do client side with either
    flash or javascript.

    Jeff
    Please help me

    Comment

    • cwdjrxyz

      #3
      Re: Ploting or drawing a mathcurve

      On Aug 25, 9:18 pm, serave <ramirez.sebast ...@gmail.comwr ote:
      Hi i'm new in this group. I need some help with php. I need to draw
      any mathematical function i get through a form?

      Do you mean you need to draw a curve from the results of solving an
      exact equation or do you mean you need to fit the best curve to a set
      of experimental measured points that always have some error. In the
      second case, a good bit of statistical calculation often is required.
      If you are a glutton for punishment, you can do this with the Math
      functions of Javascript or php. You would be much better off using a
      language such as c++ or even old Fortran which are better designed for
      math and science calculations and curve fitting. There are all sorts
      of math programs for curve fitting, plotting, solving equations, etc
      and these are what most people now use when working with math. You
      will find such programs advertised in many scientific and math
      journals. Unfortunately many of these programs are rather expensive
      for an individual, but they very soon pay for themselves in time saved
      for a company that needs many such math and curve fitting programs and
      has to hire many highly trained people with advanced degrees.

      I have 2 examples of drawing curves from solution of math equations
      at:




      This was done using the math functions of Javascript, but the Math
      functions of php could have been used. These pages are very old, and I
      likely would use different code if doing them today. Now if you wanted
      to input experimental points and curve fit to the data, the
      calculations become much more complicated because of the statistical
      calculations needed to give the curve that best fits the experimental
      data. You would input the experimental data into arrays most likely.



      Comment

      • C. (http://symcbean.blogspot.com/)

        #4
        Re: Ploting or drawing a mathcurve

        On 26 Aug, 07:53, cwdjrxyz <spamtr...@cwdj r.infowrote:
        On Aug 25, 9:18 pm, serave <ramirez.sebast ...@gmail.comwr ote:
        >
        Hi i'm new in this group. I need some help with php. I need to draw
        any mathematical function i get through a form?
        >
        Do you mean you need to draw a curve from the results of solving an
        exact equation or do you mean you need to fit the best curve to a set
        of experimental measured points that always have some error. In the
        second case, a good bit of statistical calculation often is required.
        <snip>

        But you might want to look at Google charts or JPgraph for simple
        solutions for rendering chart plots (but you'll need to generate
        numerical data yourself).

        C.

        Comment

        • serave

          #5
          Re: Ploting or drawing a mathcurve

          On 26 ago, 01:53, cwdjrxyz <spamtr...@cwdj r.infowrote:
          On Aug 25, 9:18 pm, serave <ramirez.sebast ...@gmail.comwr ote:
          >
          Hi i'm new in this group. I need some help with php. I need to draw
          any mathematical function i get through a form?
          >
          Do you mean you need to draw a curve from the results of solving an
          exact equation or do you mean you need to fit the best curve to a set
          of experimental measured points that always have some error. In the
          second case, a good bit of statistical calculation often is required.
          If you are a glutton for punishment, you can do this with the Math
          functions of Javascript or php. You would be much better off using a
          language such as c++ or even old Fortran which are better designed for
          math and science calculations and curve fitting. There are all sorts
          of math programs for curve fitting, plotting, solving equations, etc
          and these are what most people now use when working with math. You
          will find such programs advertised in many scientific and math
          journals. Unfortunately many of these programs are rather expensive
          for an individual, but they very soon pay for themselves in time saved
          for a company that needs many such math and curve fitting programs and
          has to hire many highly trained people with advanced degrees.
          >
          I have 2 examples of drawing curves from solution of math equations
          at:http://www.cwdjr.net/math/bessel_function2.html
          >

          >
          This was done using the math functions of Javascript, but the Math
          functions of php could have been used. These pages are very old, and I
          likely would use different code if doing them today. Now if you wanted
          to input experimental points and curve fit to the data, the
          calculations become much more complicated because of the statistical
          calculations needed to give the curve that best fits the experimental
          data. You would input the experimental data into arrays most likely.
          No i just need to draw the function, no need to draw the best
          aproximation. Is just drawing the curve based on a mathematical
          equation like y=e^(x-5)+sin(5x^3)-45x^(2/3) or something like that

          Comment

          • Geoff Berrow

            #6
            Re: Ploting or drawing a mathcurve

            Message-ID:
            <f8af41de-e353-4fac-ac74-4a0ae6f36e6d@v2 6g2000prm.googl egroups.comfrom
            serave contained the following:
            >No i just need to draw the function, no need to draw the best
            >aproximation . Is just drawing the curve based on a mathematical
            >equation like y=e^(x-5)+sin(5x^3)-45x^(2/3) or something like that
            Presumably you'd have to specify a range? If so a simple for loop would
            be all you'd need to generate the input array for something like
            jpgraph.

            --
            Geoff Berrow 011000100110110 0010000000110
            001101101011011 001000110111101 100111001011
            100110001101101 111001011100111 010101101011
            http://slipperyhill.co.uk - http://4theweb.co.uk

            Comment

            • cwdjrxyz

              #7
              Re: Ploting or drawing a mathcurve

              On Aug 26, 10:55 am, serave <ramirez.sebast ...@gmail.comwr ote:
              On 26 ago, 01:53, cwdjrxyz <spamtr...@cwdj r.infowrote:
              >
              >
              >
              On Aug 25, 9:18 pm, serave <ramirez.sebast ...@gmail.comwr ote:
              >
              Hi i'm new in this group. I need some help with php. I need to draw
              any mathematical function i get through a form?
              >
              Do you mean you need to draw a curve from the results of solving an
              exact equation or do you mean you need to fit the best curve to a set
              of experimental measured points that always have some error. In the
              second case, a good bit of statistical calculation often is required.
              If you are a glutton for punishment, you can do this with the Math
              functions of Javascript or php. You would be much better off using a
              language such as c++ or even old Fortran which are better designed for
              math and science calculations and curve fitting. There are all sorts
              of math programs for curve fitting, plotting, solving equations, etc
              and these are what most people now use when working with math. You
              will find such programs advertised in many scientific and math
              journals. Unfortunately many of these programs are rather expensive
              for an individual, but they very soon pay for themselves in time saved
              for a company that needs many such math and curve fitting programs and
              has to hire many highly trained people with advanced degrees.
              >
              I have 2 examples of drawing curves from solution of math equations
              at:http://www.cwdjr.net/math/bessel_function2.html
              >>
              This was done using the math functions of Javascript, but the Math
              functions of php could have been used. These pages are very old, and I
              likely would use different code if doing them today. Now if you wanted
              to input experimental points and curve fit to the data, the
              calculations become much more complicated because of the statistical
              calculations needed to give the curve that best fits the experimental
              data. You would input the experimental data into arrays most likely.
              >
              No i just need to draw the function, no need to draw the best
              aproximation. Is just drawing the curve based on a mathematical
              equation like y=e^(x-5)+sin(5x^3)-45x^(2/3) or something like that
              Then you solve the equation for say y at closely spaced points of x
              using the Math functions of Javascript or php at closely spaced points
              of the x coordinate and display each point calculated using a
              document.write in Javascript. The structure of code is much the same
              in php, but the details are rather different.

              In the first example I gave you, the Bessel function of the type given
              has no exact solution involving simple math functions. It must be
              solved in terms of infinite series, and this is quite tricky and
              requires a very good understanding of math that usually is taught at
              the college level in courses such as advanced calculus.

              The second example I gave you with several curves is much more simple,
              as the equation can be solved in terms of known simple functions.
              Considering the calculation of the 2 circles, the equations are solved
              using JavaScript math and points are written using document.write.
              That part of the code is:

              var c1=.02,c3=.01 // angle
              increment
              var px1=270 // center x
              var py1=180 // center y
              var r1=165,r2=175,r 3=160,r4=185 // radius
              var ns1=325,ns3=650 // number of steps

              var z=0,y,x ;
              for (i=0;i < ns1;++i) {
              x = (px1 + r1*Math.cos(z)) ; y= (py1 + r1*Math.sin(z)) ;
              document.write( '<div style=\"positio n:absolute; left:'+x+'px; top:'+y
              +'px; height:4px; width:4px; background-color: #ff0000; z-index:1;
              color:#ff0001; font-size:1px\">'+sy m+'<\/div>');
              z = z + c1;
              }

              var z2=0,y2,x2 ;
              for (i=0;i < ns1;++i) {
              x2 = (px1 + r2*Math.cos(z2) ); y2= (py1 + r2*Math.sin(z2) );
              document.write( '<div style=\"positio n:absolute; left:'+x2+'px;
              top:'+y2+'px; height:4px; width:4px; background-color: #00ff00; z-
              index:1; color:#00ff01; font-size:1px\">'+sy m+'<\/div>');
              z2 = z2 + c1;
              }

              It turns out that the equations for the 2 circles are best solved in
              terms of polar coordinates, and you loop over many points. You must
              keep in mind that the origin of the display is taken at the upper left
              corner of the monitor. The positive x direction points to the right as
              usual, but the positive y direction points down in contrast to
              pointing upward as usually used in math texts. This is just how
              JavaScript math functions were set up - don't blame me for that :-).

              Thus the key is a fair general knowledge of JavaScript or php, and a
              good knowledge of their math functions as well as a knowledge of how
              to solve mathematical equations in which you are interested. Every
              equation is somewhat different. Thus it is easy to appreciate why
              special programs are sold for solving math equations and plotting
              results.For calculations that are very time consuming, fewer exact
              points often are calculated and some type of extrapolation is used to
              calculate points between the exact points.

              Comment

              • cwdjrxyz

                #8
                Re: Ploting or drawing a mathcurve

                On Aug 26, 12:46 pm, cwdjrxyz <spamtr...@cwdj r.infowrote:
                On Aug 26, 10:55 am, serave <ramirez.sebast ...@gmail.comwr ote:
                >
                >
                >
                On 26 ago, 01:53, cwdjrxyz <spamtr...@cwdj r.infowrote:
                >
                On Aug 25, 9:18 pm, serave <ramirez.sebast ...@gmail.comwr ote:
                >
                Hi i'm new in this group. I need some help with php. I need to draw
                any mathematical function i get through a form?
                >
                Do you mean you need to draw a curve from the results of solving an
                exact equation or do you mean you need to fit the best curve to a set
                of experimental measured points that always have some error. In the
                second case, a good bit of statistical calculation often is required.
                If you are a glutton for punishment, you can do this with the Math
                functions of Javascript or php. You would be much better off using a
                language such as c++ or even old Fortran which are better designed for
                math and science calculations and curve fitting. There are all sorts
                of math programs for curve fitting, plotting, solving equations, etc
                and these are what most people now use when working with math. You
                will find such programs advertised in many scientific and math
                journals. Unfortunately many of these programs are rather expensive
                for an individual, but they very soon pay for themselves in time saved
                for a company that needs many such math and curve fitting programs and
                has to hire many highly trained people with advanced degrees.
                >
                I have 2 examples of drawing curves from solution of math equations
                at:http://www.cwdjr.net/math/bessel_function2.html
                >>
                This was done using the math functions of Javascript, but the Math
                functions of php could have been used. These pages are very old, and I
                likely would use different code if doing them today. Now if you wanted
                to input experimental points and curve fit to the data, the
                calculations become much more complicated because of the statistical
                calculations needed to give the curve that best fits the experimental
                data. You would input the experimental data into arrays most likely.
                >
                No i just need to draw the function, no need to draw the best
                aproximation. Is just drawing the curve based on a mathematical
                equation like y=e^(x-5)+sin(5x^3)-45x^(2/3) or something like that
                >
                Then you solve the equation for say y at closely spaced points of x
                using the Math functions of Javascript or php at closely spaced points
                of the x coordinate and display each point calculated using a
                document.write in Javascript. The structure of code is much the same
                in php, but the details are rather different.
                >
                In the first example I gave you, the Bessel function of the type given
                has no exact solution involving simple math functions. It must be
                solved in terms of infinite series, and this is quite tricky and
                requires a very good understanding of math that usually is taught at
                the college level in courses such as advanced calculus.
                >
                The second example I gave you with several curves is much more simple,
                as the equation can be solved in terms of known simple functions.
                Considering the calculation of the 2 circles, the equations are solved
                using JavaScript math and points are written using document.write.
                That part of the code is:
                >
                 var c1=.02,c3=.01                                        // angle
                increment
                        var px1=270                                   //  center x
                        var py1=180                                   //  center y
                        var r1=165,r2=175,r 3=160,r4=185              //  radius
                        var ns1=325,ns3=650                     // number of steps
                >
                var z=0,y,x ;
                 for  (i=0;i < ns1;++i) {
                x = (px1 + r1*Math.cos(z)) ; y= (py1 + r1*Math.sin(z)) ;
                document.write( '<div style=\"positio n:absolute; left:'+x+'px; top:'+y
                +'px; height:4px; width:4px; background-color: #ff0000; z-index:1;
                color:#ff0001; font-size:1px\">'+sy m+'<\/div>');
                z = z + c1;
                          }
                >
                var z2=0,y2,x2 ;
                 for  (i=0;i < ns1;++i) {
                x2 = (px1 + r2*Math.cos(z2) ); y2= (py1 + r2*Math.sin(z2) );
                document.write( '<div style=\"positio n:absolute; left:'+x2+'px;
                top:'+y2+'px; height:4px; width:4px; background-color: #00ff00; z-
                index:1; color:#00ff01; font-size:1px\">'+sy m+'<\/div>');
                z2 = z2 + c1;
                          }
                >
                It turns out that the equations for the 2 circles are best solved in
                terms of polar coordinates, and you loop over many points. You must
                keep in mind that the origin of the display is taken at the upper left
                corner of the monitor. The positive x direction points to the right as
                usual, but the positive y direction points down in contrast to
                pointing upward as usually used in math texts. This is just how
                JavaScript math functions were set up - don't blame me for that :-).
                >
                Thus the key is a fair general knowledge of JavaScript or php, and a
                good knowledge of their math functions as well as a knowledge of how
                to solve mathematical equations in which you are interested. Every
                equation is somewhat different. Thus it is easy to appreciate why
                special programs are sold for solving math equations and plotting
                results.For calculations that are very time consuming, fewer exact
                points often are calculated and some type of extrapolation is used to
                calculate points between the exact points.
                Ther is a free program for plotting data available from the US NIST
                (know as the Bureau of Standards in the past). It will not do as much
                as the newer commercial programs, but you can't argue with the price.
                The name of the prograsm is dataplot. It is available in several
                versions including C and a PC version which is likely the one you
                would want. Download sometimes is slow in the daytime in the US, so
                you may want to try in the evening.

                Go to ftp://ftp.nist.gov/pub/dataplot/ . then select "pc". On the pc
                screen select ReadMe.Doc and it will tell you where to go from there.
                There are a few files to download and it will take some time to learn
                how to do everything it can do. I have not used DataPlot in recent
                years, but it worked fairly well in the past.

                Comment

                Working...