파일:Comparison of simple power law curves in original and log-log scale.png

testwiki
둘러보기로 이동 검색으로 이동
    원본 파일 (1,200 × 1,560 픽셀, 파일 크기: 110 KB, MIME 종류: image/png)

    이 파일은 위키미디어 공용에 있으며, 다른 프로젝트에서 사용하고 있을 가능성이 있습니다. 해당 파일에 대한 설명이 아래에 나와 있습니다.

    파일 설명

    설명
    English: R code to reproduce the image:

    ``` options(

     repr.plot.width  = 10,   # in inches (default = 7)
     repr.plot.height = 13    # in inches (default = 7)
    

    )

    library(ggplot2) library(gridExtra)

    1. Define the functions

    linear_function <- function(x) x concave_function <- function(x) sqrt(x) convex_function <- function(x) x^2 identity_line <- function(x) x

    1. Generate data

    x_values <- seq(0.001, 10, length.out = 1000) data_linear <- data.frame(x = x_values, y = linear_function(x_values)) data_concave <- data.frame(x = x_values, y = concave_function(x_values)) data_convex <- data.frame(x = x_values, y = convex_function(x_values))

    1. Create plots

    plot_linear <- ggplot(data_linear, aes(x, y)) +

     geom_line() +
     geom_abline(intercept = 0, slope = 1, linetype = "dashed", color = "red") +
     ggtitle("Linear: y = x") + ylim(0,10) + xlim(0,10)
    

    plot_concave <- ggplot(data_concave, aes(x, y)) +

     geom_line() +
     geom_abline(intercept = 0, slope = 1, linetype = "dashed", color = "red") +
     ggtitle("Concave: y = x^(1/2)") + ylim(0,10) + xlim(0,10)
    

    plot_convex <- ggplot(data_convex, aes(x, y)) +

     geom_line() +
     geom_abline(intercept = 0, slope = 1, linetype = "dashed", color = "red") +
     ggtitle("Convex: y = x^2") + ylim(0,10) + xlim(0,10)
    
    1. Log10 transformation

    data_linear_log <- data.frame(x = log10(x_values), y = log10(linear_function(x_values))) data_concave_log <- data.frame(x = log10(x_values), y = log10(concave_function(x_values))) data_convex_log <- data.frame(x = log10(x_values), y = log10(convex_function(x_values)))

    plot_linear_log <- ggplot(data_linear_log, aes(x, y)) +

     geom_line() +
     geom_abline(intercept = 0, slope = 1, linetype = "dashed", color = "red") +
     ggtitle("Linear (Log10-Log10): y = x") + ylim(0,1) + xlim(0,1)
    

    plot_concave_log <- ggplot(data_concave_log, aes(x, y)) +

     geom_line() +
     geom_abline(intercept = 0, slope = 1, linetype = "dashed", color = "red") +
     ggtitle("Concave (Log10-Log10): y = x^(1/2)") + ylim(0,1) + xlim(0,1)
    

    plot_convex_log <- ggplot(data_convex_log, aes(x, y)) +

     geom_line() +
     geom_abline(intercept = 0, slope = 1, linetype = "dashed", color = "red") +
     ggtitle("Convex (Log10-Log10): y = x^2") + ylim(0,1) + xlim(0,1)
    
    1. Arrange the plots in a grid

    grid.arrange(plot_linear, plot_linear_log,

                plot_concave, plot_concave_log, 
                plot_convex, plot_convex_log, 
                ncol = 2, top = "Comparison of Linear, Concave, and Convex Functions\nIn original (left) and log10 (right) scales")
    

    ```

    The R code provided above generates a grid of six plots, arranged in two columns and three rows, showcasing different mathematical functions both in their original scale and in a log10-log10 scale. The functions displayed include a linear function (y = x), a concave function (y = sqrt(x)), and a convex function (y = x^2). Each of these functions is depicted in two plots: one showing the relationship in its original scale and the other showing the relationship in a log10-log10 scale.

    In each plot: - The data is represented by a black line. - A dashed red line is included in each plot, representing a line with a 0 intercept and a slope of 1, for reference. - The x-axis and y-axis are labeled appropriately, with the axes in the log10-log10 plots labeled as log10(x) and log10(y). - Each plot has a title describing the function and indicating whether it is in the original scale or in the log10-log10 scale.

    This visualization serves to demonstrate how different types of mathematical relationships are represented both in their normal scale and when transformed into a logarithmic scale.
    날짜
    출처 자작
    저자 Talgalili

    라이선스

    나는 아래 작품의 저작권자로서, 이 저작물을 다음과 같은 라이선스로 배포합니다:
    w:ko:크리에이티브 커먼즈
    저작자표시 동일조건변경허락
    이용자는 다음의 권리를 갖습니다:
    • 공유 및 이용 – 저작물의 복제, 배포, 전시, 공연 및 공중송신
    • 개작 – 저작물의 개작, 수정, 2차적저작물 창작
    다음과 같은 조건을 따라야 합니다:
    • 저작자표시 – 적절한 저작자 표시를 제공하고, 라이선스에 대한 링크를 제공하고, 변경사항이 있는지를 표시해야 합니다. 당신은 합리적인 방식으로 표시할 수 있지만, 어떤 방식으로든 사용권 허가자가 당신 또는 당신의 사용을 지지하는 방식으로 표시할 수 없습니다.
    • 동일조건변경허락 – 만약 당신이 이 저작물을 개작 또는 변형하거나 이 저작물을 기반으로 제작하는 경우, 당신은 당신의 기여물을 원저작물과 동일하거나 호환 가능한 라이선스에 따라 배포하여야 합니다.

    설명

    이 파일이 나타내는 바에 대한 한 줄 설명을 추가합니다
    Comparison of Linear, Concave, and Convex Functions\nIn original (left) and log10 (right) scales

    이 파일에 묘사된 항목

    다음을 묘사함

    be57b9cc41a4b2544bb467d16a7021e2409d71f8

    113,036 바이트

    1,560 화소

    1,200 화소

    파일 역사

    날짜/시간 링크를 클릭하면 해당 시간의 파일을 볼 수 있습니다.

    날짜/시간섬네일크기사용자설명
    현재2024년 3월 4일 (월) 14:212024년 3월 4일 (월) 14:21 판의 섬네일1,200 × 1,560 (110 KB)wikimediacommons>TalgaliliUploaded own work with UploadWizard

    이 파일을 사용하는 문서가 없습니다.