473,796 Members | 2,465 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
Aug 26 '08 #1
7 2145
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
Aug 26 '08 #2
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

http://www.cwdjr.net/geometricDraw/curve_write.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.

Aug 26 '08 #3
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.
Aug 26 '08 #4
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

http://www.cwdjr.net/geometricDraw/curve_write.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
Aug 26 '08 #5
Message-ID:
<f8************ *************** *******@v26g200 0prm.googlegrou ps.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
Aug 26 '08 #6
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
http://www.cwdjr.net/geometricDraw/curve_write.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.

Aug 26 '08 #7
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
>http://www.cwdjr.net/geometricDraw/curve_write.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.
Aug 26 '08 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2780
by: Tomi Holger Engdahl | last post by:
I am looking for a solution to add on-line drawing tool to a phpBB discussion board. The idea would be that the users can draw their own simple drawings with the tool and attach them easily as images in the discussion. The idea is to easily add small drawings to the postings. The drawign tool should be easy to use and learn. It should be easily integrate to the phpBB system.
2
12346
by: Champika Nirosh | last post by:
Hi, I want to create drawing board application that can draw Line, rectagle, circle and free hand drawing. Each drawing need to be transparent, moveable (draggable), have bring to front and send to back feature etc. How can I do this .. where should I start?
1
3237
by: Hadar | last post by:
Hi, I'm getting "object is currently in use elsewhere" when I use System.Drawing.Graphics.MesureString. This is what I do: My controls use a utility class the helps it to mesure strings. To get the best performance for the utility class, its members, as well as the System.Drawing.Graphics object, are static:
7
8744
by: Marc Pelletier | last post by:
Hello all, I have a class which includes a method to create a chart. I want to be able to call this method from asp.net code as well as windows application code, so I have sketched it out as returning a bitmap instance. In my asp.net code I think I should call this method to return a bitmap and then somehow stream it using the response object to the Webcontrols.image. Is that right? The image object is on a page with a number of...
2
6700
by: active | last post by:
I find Bitmap.Save works for WMF files but Bitmap.FromFile does not. If I use FromFile on a WMF file that came with VS I get an exception. If I use it on a WMF file created with Bitmap.Save I don't get an exception but it appears the Bitmap is blank. Can anyone share some knowledge on this?
3
2611
by: Chris Saunders | last post by:
I am fairly new to .Net and C# but am familiar with the Win32 API. I wish to set the pixels of the client area of a window one at a time with a specific color. I have so far discovered that System.Drawing.Bitmap has a SetPixel() method but I can't seem to find out how to have the bitmap displayed. I would actually like to have the pixels appear as I set them. Regards Chris Saunders
5
3376
by: Jerry J | last post by:
I want to use the System.Drawing.Image class. According to the help file, this is an abstract base class. Because it is supposedly abstract, I created another class that inherits from it. However, when I did this I got the following error: 'System.Drawing.Image.Image()' is inaccessible due to its protection level Looking at other online examples, I found that the proper way to use it is like this:
2
2330
by: ThatsIT.net.au | last post by:
I have this code that writes a pie chart in a asp.net page, but I want to use it in a server control. When I try I get a error on the last line "Response.OutputStream" Obviously there is no response object but how do I write it to screen? Dim objBitmap As New System.Drawing.Bitmap(400, 440) Dim objGraphics As System.Drawing.Graphics objGraphics = System.Drawing.Graphics.FromImage(objBitmap) objGraphics.Clear(Drawing.Color.White)
7
3561
by: raylopez99 | last post by:
I have a logical drawing space much bigger than the viewport (the screen) and I'd like to center the viewport (the screen) to be at the center of the logical drawing space. After following the excellent transforms specified on Bob Powell's site, I still wonder if there's an easier way of centering it than the following procedure? Here is what I do now (it's awkward but it works): 1) I follow the transforms specified on Bob Powell's...
0
9680
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9528
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10174
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6788
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5442
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5575
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4118
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2926
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.