分享

你知道哪些用计算机画数学函数图像的方法?

 pgl147258 2014-06-27

苏椰的回答(12票)】

本地不开源:Matlab,Mathematica

本地开源:Octave

在线:http://Wolframalpha.com

我平时做实验都用Octave,因为有cmd模式,写好脚本后,和自己的实验程序可以无缝集合。这类矩阵运算程序都是做过大量优化的,运算速度非常快,自己写的画图代码很难达到,所以一般没必要自己写。

【王超的回答(8票)】

    最近正好在找画图方法,我知道的就是下面这些:
  • 用matlab、octave、scilab(就是那几个plot命令) 这类软件
  •  用opengl(有点杀鸡用牛刀的味道)
  • 用gnuplot(用起来很简单、可以与标准C配合使用。也很古老和unix同一时代的产物,当年没有Windows、python、matlab的时候他就已经被用于数学绘图了)

    你知道哪些用计算机画数学函数图像的方法?

  • 用python的mlab类(mayavi2很好用)

    你知道哪些用计算机画数学函数图像的方法?

    python源码: import numpy as np 

    from enthought.mayavi import mlab 

    x, y = np.ogrid[-2:2:20j, -2:2:20j] 

    z = x * np.exp( -x**2 -y**2) 

    pl = mlab.surf(x, y, z, warp_scale="auto") 

    mlab.axes(xlabel='x', ylabel='y', zlabel='z') 

    mlab.outline(pl) 

  • 熟悉某种图片格式(jpg,bmp,etc)后生成所需图片(这个比较非主流,是以前刚学了C后,想到的办法)

    你知道哪些用计算机画数学函数图像的方法?

    C源码:

    #include <stdio.h>

    #include <stdlib.h>

    #include <string.h>

    #include <math.h>

    typedef unsigned char  BYTE;

    typedef unsigned short WORD;

    typedef unsigned long  DWORD;

    typedef long                 LONG;

    #pragma pack(2)

    typedef struct {

            WORD    bfType;

            DWORD   bfSize;

            WORD    bfReserved1;

            WORD    bfReserved2;

            DWORD   bfOffBits;

    } BITMAPFILEHEADER;

    typedef struct {

            DWORD      biSize;

            LONG       biWidth;

            LONG       biHeight;

            WORD       biPlanes;

            WORD       biBitCount;

            DWORD      biCompression;

            DWORD      biSizeImage;

            LONG       biXPelsPerMeter;

            LONG       biYPelsPerMeter;

            DWORD      biClrUsed;

            DWORD      biClrImportant;

    } BITMAPINFOHEADER;

    void saveBitmap()

    {

       // Define BMP Size

       const int height = 600;

       const int width = 800;

       const int size = height * width * 3;

       double x, y;

       int index;

       // Part.1 Create Bitmap File Header

       BITMAPFILEHEADER fileHeader;

       fileHeader.bfType = 0x4D42;

       fileHeader.bfReserved1 = 0;

       fileHeader.bfReserved2 = 0;

       fileHeader.bfSize = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER) + size;

       fileHeader.bfOffBits = sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER);

       // Part.2 Create Bitmap Info Header

       BITMAPINFOHEADER bitmapHeader = {0};

       bitmapHeader.biSize = sizeof(BITMAPINFOHEADER);

       bitmapHeader.biHeight = height;

       bitmapHeader.biWidth = width;

       bitmapHeader.biPlanes = 3;

       bitmapHeader.biBitCount = 24;

       bitmapHeader.biSizeImage = size;

       bitmapHeader.biCompression = 0; //BI_RGB

       // Part.3 Create Data

       BYTE *bits = (BYTE *)malloc(size);

       // Clear

       memset(bits, 0xFF, size);

       //generate Sin Graph

       for(x = 0; (x < 800) ; x += 0.5)

       {

          y=sin(x / 100.0) * 200 + 300;

         //y=log(x*10.0+1.0)*10;

         if ((y>0)&&( y<600))

          {index = (int)y * 800 * 3 + (int)x * 3;

          bits[index + 0] = 255; // Blue

          bits[index + 1] = 0;   // Green

          bits[index + 2] = 0; }  // Red

       }

       // Write to file

       FILE *output = fopen("output.bmp", "wb");

       if(output == NULL)

       {

          printf("Cannot open file!\n");

       }

       else

       {

          fwrite(&fileHeader, sizeof(BITMAPFILEHEADER), 1, output);

          fwrite(&bitmapHeader, sizeof(BITMAPINFOHEADER), 1, output);

          fwrite(bits, size, 1, output);

          fclose(output);

       }

       printf("\n finished");

    }

    int main()

    {

       saveBitmap();

       getch();

       return 0;

    }

更多参考 http://en.wikipedia.org/wiki/List_of_information_graphics_software#Plotting_programs_.28graphing_programs.29

【dheera的回答(3票)】

有許多在線數學描圖器

1. Fooplot http://fooplot.com/

這其實是我自己編的程序。。。網址後面可添加任何函數,比如 http://fooplot.com/sin(x)

你知道哪些用计算机画数学函数图像的方法?

2. Desmos http://desmos.com/

你知道哪些用计算机画数学函数图像的方法?

3. http://graph.tk

你知道哪些用计算机画数学函数图像的方法?

【党文亮的回答(1票)】

matplotlib  http://matplotlib.sourceforge.net/

【王成的回答(2票)】

Google

【金秉文的回答(0票)】

不用安装

跨平台

UI简单易用

无需编程知识

只要你会写函数表达式且有web浏览器就可以用,请猛击 http://iel.ucdavis.edu/chhtml/lang/lib/libch/plot/index.html

【happyface的回答(0票)】

以前一直用MATLAB,现在在用GNUPLOT。

【刘舟的回答(0票)】

1.画简单函数图像

初高中的简单函数图像,可以用"几何画板"。只需要输入参数,就可以直接显示出函数图像。

2.画复杂函数图像

①matlab。

可以画各种图像,无论是数学的还是工程的,最重要的是学习起来比较简单,缺点是图像不太好看,安装也比较麻烦;

②mathematic

画的图像比较漂亮,但个人感受代码编写没有matlab直观。

3.画概率统计类图表

①matlab可以画,但比较麻烦,不是强项;

②SPSS

比较方便,属于傻瓜式

③R

这个风格像matlab,需要自己编写程序,但是开源的。

【付超的回答(0票)】

Mathematica吧,方正我现在大一,高数书本中就是用的这个软件做项目,各种函数图像,积分计算什么的

【余天升的回答(0票)】

补充一个Maxima,也是开源的。

http://maxima.sourceforge.net/ 

【kession的回答(0票)】

http://www.wolframalpha.com

wolframalpha也算吧,能画图还能计算

http://www.wolframalpha.com/input/?i=x%5E2%2By%5E2%3D1 

原文地址:知乎

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多