File:Slope Field-modified.svg

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

Original file(SVG file, nominally 289 × 526 pixels, file size: 364 KB)

Captions

Captions

Slope field of dy/dx = 2*x^2 − x − 2

Summary

[edit]
Description
English: Slope field of dy/dx = 2*x^2 − x − 2. Green lines indicate the slope.
Date
Source Own work
Author Chen-Pan Liao

R code

[edit]
library(ggplot2)

f <- function(x, beta0) {
  (1 / 3) * x ^ 3 - (1 / 2) * x ^ 2 - 2 * x + beta0
}

d <-
  expand.grid(x = seq(-4, 4, 0.01), Intercept = c(-4, 0, 4))
d$y <- with(d, f(x, Intercept))

d.slope <-
  expand.grid(x = seq(-4, 4, 0.5),
              y = seq(-10, 10, 0.5))
d.slope$slope <- with(d.slope, x ^ 2 - x - 2)
d.slope$angle <- with(d.slope, atan(slope) / pi * 180)

ggplot(d, aes(x, y)) +
  geom_hline(yintercept = 0) +
  geom_vline(xintercept = 0) +
  geom_text(data = d.slope,
            aes(angle = angle, label = "—"),
            color = 3,
            size = 2.5) +
  geom_line(aes(color = as.factor(Intercept), group = as.factor(Intercept), size = as.factor(Intercept))) +
  scale_x_continuous("x", breaks = seq(-5, 5, 1)) +
  scale_y_continuous("y", breaks = seq(-50, 50, 1), limits = c(-8, 6)) +
  theme(panel.background = element_blank()) +
  theme(text = element_text(size = 12)) +
  theme(legend.position = "top") +
  scale_color_manual(values = c('green', 'red', 'blue')) +
  scale_size_manual(values = 1:3) +
  guides(size = guide_legend("Intercept"), color = guide_legend("Intercept")) +
  coord_fixed() +
  windows(5, 6)

Licensing

[edit]
I, the copyright holder of this work, hereby publish it under the following license:
Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current11:20, 1 November 2021Thumbnail for version as of 11:20, 1 November 2021289 × 526 (364 KB)Chen-Pan Liao (talk | contribs)fixes
11:05, 1 November 2021Thumbnail for version as of 11:05, 1 November 2021351 × 416 (244 KB)Chen-Pan Liao (talk | contribs)fixes
11:02, 1 November 2021Thumbnail for version as of 11:02, 1 November 2021385 × 430 (244 KB)Chen-Pan Liao (talk | contribs)fixes
10:55, 1 November 2021Thumbnail for version as of 10:55, 1 November 2021472 × 443 (247 KB)Chen-Pan Liao (talk | contribs)fixes
10:50, 1 November 2021Thumbnail for version as of 10:50, 1 November 2021472 × 443 (181 KB)Chen-Pan Liao (talk | contribs)Uploaded own work with UploadWizard

The following page uses this file:

File usage on other wikis

The following other wikis use this file:

Metadata