코딩Coding/한글Rust강의★내가★공부하려고만듬

Rust &R_lang❤️sin, cos등등..그래프 그려보기-R과 코드 비교해서 - 동영상❤️

내인생PLUS 2022. 6. 22. 11:07
728x90


한글러스트Rust강의_027_Rust vs R 기초part1_sin cos 그래프 그리기 #sin #cos #rustlang #maths
https://youtu.be/GMD-6NU7zUA










❤️Rust Code

https://m.blog.naver.com/PostView.naver?blogId=phy2sci&logNo=222720163039&isFromSearchAddView=true

10. 러스트로 윈도우(즈)에 그래프 그려보기

러스트의 기본 사용법을 안다면 Cargo.toml 파일에서 외부 패키지를 불러서 그 외부 패키지가 제공하는 ex...

blog.naver.com



test code

fn y_xxx(x: i32) -> i32 {
    x * x * x
}

fn main() {
    
    let my_vec = ((-10..=10).map(|x| (x, y_xxx(x)))).collect::<Vec<_>>();
 
    println!("{my_vec:?}");
}


result

Compiling playground v0.0.1 (/playground)
    Finished dev [unoptimized + debuginfo] target(s) in 3.19s
     Running `target/debug/playground`
Standard Output
[(-10, -1000), (-9, -729), (-8, -512), (-7, -343), (-6, -216), (-5, -125), (-4, -64), (-3, -27), (-2, -8), (-1, -1), (0, 0), (1, 1), (2, 8), (3, 27), (4, 64), (5, 125), (6, 216), (7, 343), (8, 512), (9, 729), (10, 1000)]


Generics

fn y_xxx<T: std::ops::Mul<Output = T> + Copy>(x: T) -> T {
    x * x * x
}

fn main() {
    
    let my_vec = (-10..10).map(|x| (x, y_xxx(x))).into_iter().collect::<Vec<_>>();
 
    println!("{my_vec:?}");
}


Generics 코드 보기 좋게 where활용

use std::ops::Mul;


fn y_xxx<T>(x: T) -> T
where T : Mul<Output = T> + Copy
{
    x * x * x
}

fn main() {
    
    let my_vec = (-10..10).map(|x| (x, y_xxx(x))).into_iter().collect::<Vec<_>>();
 
    println!("{my_vec:?}");
}




Rust❤️ collect활용법
Rust❤️take & collect methods 사용법 1분 53초에 나옴 & skip(3분30초 -
https://economiceco.tistory.com/m/14121

Rust❤️take & collect methods 사용법 1분 53초에 나옴 & skip(3분30초

1분53초 https://youtu.be/LNfhXppiiW8 Fold method again https://youtu.be/lG651CzNFmM

economiceco.tistory.com



Rust❤️) Generics & where 활용법 concrete 개념이해 -
https://economiceco.tistory.com/m/14018

Rust❤️) Generics & where 활용법 concrete 개념이해

where나옴 5분19초~ https://youtu.be/yqJowwt2JIU concrete 개념이해 https://youtu.be/o4Hqyfjxtco

economiceco.tistory.com




R ❤️


R프로그래밍
plot()함수를 이용한 삼각함수 시각화

https://m.blog.naver.com/padosori60/220861591002

R - plot( )함수를 이용한 삼각함수 시각화

> x <- seq(-10, 10, 0.1) > plot(x, sin(x), type = "l", col = "orange", main = "Sine Funct...

blog.naver.com

위에 글 내가 해봄❤️
R연습❤️] R - plot()함수를 이용한 삼각함수 시각화 - https://economiceco.tistory.com/m/14211

R연습❤️] R - plot()함수를 이용한 삼각함수 시각화

R - plot( )함수를 이용한 삼각함수 시각화 r_hello.R x 터미널 창에서 Rscript r_hello.R 실행하면 r_hello.pdf 만들어짐. 그거 실행한거 결과 보면 됨. 실행됨. or VSCode 에서 Shift + command + Enter 누르면..

economiceco.tistory.com





R 실행하는 방법 간단하네
Rscript 하고 뒤에 abc.R
r_hello.R 파일

print("hello world")

Rscript r_hello.R
[1] "hello world"

https://www.geeksforgeeks.org/hello-world-in-r-programming/

Hello World in R Programming - GeeksforGeeks

A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.

www.geeksforgeeks.org


R 나만의 Function만들기
https://swcarpentry.github.io/r-novice-inflammation/02-func-R/

Creating Functions – Programming with R

If we only had one data set to analyze, it would probably be faster to load the file into a spreadsheet and use that to plot some simple statistics. But we have twelve files to check, and may have more in the future. In this lesson, we’ll learn how to wr

swcarpentry.github.io







https://csu-r.github.io/Module1/running-code-in-rstudio.html

3.4 Running Code in RStudio | R Module 1

This is the book for the R Intro Course at CSU.

csu-r.github.io


반응형