Jquery + Math + Flot (e html 5)
Ola pessoal, fiz um pequeno projeto usando as cancalharias citadas no titulo. A idéia é simples: montei alguns gráficos usando as principais funções trigonométricas e recursos nativos do web browser. A tarefa em si já não é muito dificil, mas com as bibliotecas citadas ser torna coisa de criança :-). E você não precisa de softwares matemáticos complexos para renderizar.
A Biblioteca Math
A biblioteca Math já provê algumas (poucas) constantes e funções que da a base para várias coisa legais. Não tem nada de muito avançado, mas já tem o básico para começar a brincadeira. Achei a seguinte tabela de referência da biblioteca no site w3schools :
Math Object Properties
|
Property
|
Description
|
|---|---|
|
|
Returns Euler's number (approx. 2.718)
|
|
|
Returns the natural logarithm of 2 (approx. 0.693)
|
|
|
Returns the natural logarithm of 10 (approx. 2.302)
|
|
|
Returns the base-2 logarithm of E (approx. 1.442)
|
|
|
Returns the base-10 logarithm of E (approx. 0.434)
|
|
|
Returns PI (approx. 3.14159)
|
|
|
Returns the square root of 1/2 (approx. 0.707)
|
|
|
Returns the square root of 2 (approx. 1.414)
|
Math Object Methods
|
Method
|
Description
|
|---|---|
|
|
Returns the absolute value of x
|
|
|
Returns the arccosine of x, in radians
|
|
|
Returns the arcsine of x, in radians
|
|
|
Returns the arctangent of x as a numeric value between -PI/2 and PI/2 radians
|
|
|
Returns the arctangent of the quotient of its arguments
|
|
|
Returns x, rounded upwards to the nearest integer
|
|
|
Returns the cosine of x (x is in radians)
|
|
|
Returns the value of Ex
|
|
|
Returns x, rounded downwards to the nearest integer
|
|
|
Returns the natural logarithm (base E) of x
|
|
|
Returns the number with the highest value
|
|
|
Returns the number with the lowest value
|
|
|
Returns the value of x to the power of y
|
|
|
Returns a random number between 0 and 1
|
|
|
Rounds x to the nearest integer
|
|
|
Returns the sine of x (x is in radians)
|
|
|
Returns the square root of x
|
|
|
Returns the tangent of an angle
|
Fonte: http://www.w3schools.com/jsref/jsref_obj_math.asp
Jquery e Flot
A biblioteca Flot é uma biblioteca para plotagem de gráficos que promete funcionar em vários browsers (inclusive IE6), usando o tão falado HTML Canvas do HTML 5. Em browsers mais antigos (como o IE6) eles usam uma simulação canvas também via JS. Para maiores informações, visite a página oficial do projeto http://code.google.com/p/flot/ .
Alguns gráficos de funções
Cos, sin, tan, cotan, sec, cossec:

Parabola, Parabola (inv), Cubic, Log, Abs:

cos * (1/x) :
cos(1/sin(x)) , sin(1/cos(x)):

Para quem se interessou, coloquei todos os arquivos com os gráficos acima no meu github - http://github.com/pedrolopesme/Flot-Samples. Coloquei lá um livedemo que você passa a função e ele constrói o gráfico. Se alguém se habilitar em fazer uma coisa mais legal para plotagem de gráficos de funções rodando direto via browser, entre em contato :-)
Procurando algumas funções Javascript que fossem equivalentes a funções em PHP acabei esbarrando no projeto