Function graph plotter
Type an expression, get the graph · several curves together · shaded inequality regions · zeros, extrema and intersections marked · SVG and PNG export
函数图像生成器怎么用
第一栏写函数。一行一条曲线,最多 8 条,颜色自动分配。直接写 x 的表达式就行,不用写「y=」(写了也会自动去掉)。想只看某一条,把别的删掉即可;两条写在一起就能看它们的交点。
第二栏写定义域(选填)。这是画分段函数的关键:第一条写 x^2、定义域写 x<0,第二条写 2x+1、定义域写 x>=0,一张图上的分段函数就出来了。区间端点会自动区分实心点(含端点)和空心圈(不含端点),和课本上的画法一致。
第三栏写不等式。支持 y>x^2-2 这种已经解出 y 的,也支持 2x+3y<=12、x^2+y^2<=4 这种没解出来的;几条不等式同时写就是不等式组,阴影部分就是它们的公共部分(可行域),高中线性规划直接能用。边界线按课本口径区分:带等号画实线,不带等号画虚线。
调窗口有三种办法。直接填 x、y 的范围点「应用窗口」;或者在图上拖动平移、滚轮缩放、双击回到初始;或者点「按曲线适应 y」让页面自己找到看得清的纵向范围。勾选「等比例」(默认已开启)时 x 与 y 的单位长度严格相同,圆看起来才是正圆、直线斜率 1 才是 45°。
导出。PNG 是 2 倍分辨率的位图,直接贴进 Word、微信、作业平台都行;SVG 是矢量文件,放大不糊,可以拖进 AI / Figma / PowerPoint 继续改。两个按钮导出的内容和你在屏幕上看到的完全一致(同一份绘图数据)。
支持的写法、函数与两个容易踩的口径
三角与反三角 sin、cos、tan、cot、sec、csc、asin、acos、atan;双曲 sinh、cosh、tanh;对数指数 ln(自然对数)、lg 与 log(常用对数)、log2、exp;幂与根 ^、sqrt、cbrt,并且 x^(1/3) 在 x 为负时也给出实数结果(多数编程语言会直接返回无意义,课本不认);取整与其他 abs(也可以写 |x|)、sign、floor、ceil、round、trunc、min、max、mod、atan2、logb;常数 pi(或 π)、e、tau。括号可用中英文,×÷−=≤≥、全角数字都认。
口径一:渐近线处一定断线。画 tan(x) 或 1/x 时,很多在线工具会在渐近线位置画出一根从上贯到下的大黑竖线——那根线不是图像的一部分,是采样点被硬连起来造成的。本工具在相邻采样点出现「跳变且中值发散」时判定为极点并断开折线,遇到 floor、sign 这类台阶也拒绝补那根假竖线。所以你的图上看不到它是对的,不是没画出来。
口径二:定义域外什么都不画。sqrt(x)、ln(x)、asin(x) 在实数范围内没有定义的地方,图上就是空白,不会贴着一根假线走。高频振荡的函数(比如 sin(1000x))在任何工具上都会失真,把 x 范围调到 10 个周期以内、或把采样调到「细 3200」再看的结论才可靠。
关于数据。表达式、图像、关键点全部在你本机浏览器里算出来:页面不发起任何网络请求,不写 localStorage、cookie 或网址参数,刷新即清空。表达式解析是页面里自带的递归下降解析器,不使用 eval,输入的内容不可能被执行成脚本。
FAQ
No - just write the expression in x (a leading y= or f(x)= is stripped automatically). Supported: polynomials, rational expressions, trig and inverse trig, hyperbolic functions, exponentials and logarithms (ln / lg / log / log2), powers and roots, absolute value (abs or |x|), rounding family (floor / ceil / round / sign), min / max / mod, and the constants pi (or π), e, tau; the multiplication sign may be omitted (2x and 3sin(x) count as products). Up to 8 curves in one frame at a time.
Because that line was never part of the graph. The values on the two sides of an asymptote run to +infinity and -infinity; connecting them would draw a fake vertical stroke from top to bottom. The tool breaks the polyline when it detects a jump with a diverging midpoint - the same applies to step functions (floor, sign). The absence of the line on the plot is the correct result.
One piece per line: on line 1 write the expression x^2 with the domain x<0; on line 2 write 2x+1 with the domain x>=0. Domains accept chained notation (-2<=x<2) and and-combinations (x>=0 and x<5). Interval endpoints are drawn automatically as filled dots (endpoint included) or open circles (excluded), matching textbook convention.
Type it into the inequality field: forms with y solved (y>x^2-2) and unsolved forms (2x+3y<=12, x^2+y^2<=4) are both supported; entering several at once gives a system whose shading is their common area - ready-made for the feasible regions of high-school linear programming. Boundary lines follow the textbook: with an equals sign (<=, >=) solid, without (<, >) dashed.
Purely numerically: points are sampled across the viewport's x-range at the current sample count, sign changes are found on the already-broken segments, then bisection converges to double-precision limits; extrema start from a three-point direction change and get polished by a 1-D search; intersections run the same procedure on the difference of the two curves. So the digits are near machine precision, but only within the window you currently see - zoom into a point and the readings get steadier. Tangent-style zeros such as x²=0 have no sign change, so the program marks them as extrema; the position is still x=0.
Curve mode requires y expressed in x, so the whole circle x²+y²=4 cannot be one curve (one x maps to two y). Two equivalent ways: ① in the inequality field write x^2+y^2<=4 - you get the disk, and its boundary is the circle; ② split into two curves sqrt(4-x^2) and -sqrt(4-x^2) and keep 'equal aspect' checked (on by default). Parametric and polar modes are not offered yet.
PNG is a 2× resolution bitmap with the best compatibility - paste it into Word, chat apps or homework platforms; SVG is vector: sharp at any zoom, and you can drag it into Illustrator, Figma or Inkscape to keep editing colors and stroke widths. Both come from the same drawing data as the screen, so what you see is what you export.
No. The expressions, graphs and key points are all computed in your browser; the page makes no network requests, writes nothing to localStorage, cookies or URL parameters, and refreshing clears everything. The parser is the page's own recursive-descent implementation and does not use eval - your input cannot be executed as script.