Rust &R_lang❤️sin, cos등등..그래프 그려보기-R과 코드 비교해서 - 동영상❤️
한글러스트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
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❤️) Generics & where 활용법 concrete 개념이해 -
https://economiceco.tistory.com/m/14018
R ❤️
R프로그래밍
plot()함수를 이용한 삼각함수 시각화
https://m.blog.naver.com/padosori60/220861591002
위에 글 내가 해봄❤️
R연습❤️] R - plot()함수를 이용한 삼각함수 시각화 - https://economiceco.tistory.com/m/14211
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/
R 나만의 Function만들기
https://swcarpentry.github.io/r-novice-inflammation/02-func-R/
https://csu-r.github.io/Module1/running-code-in-rstudio.html