Skip to main content

Resolving "The procedure entry point ... library vulkan-1.dll" error when launching Hyper Scape

Hi. As the title says, I resolved the following error. What I tried There were two. When you try these, you will need to take full responsibility for your action. Backup is important. The first one is a GPU driver update. Valkan will be installed along with the driver update, so I tried this method first. However, changing the driver sometimes causes instability, so I recommend checking the current version from the device manager. The second one is installing the latest version of Valkan Runtime. I referred to this nice Japanese article. https://emulog.net/ps3-emulator-rpcs3-cant-run-missing-vulkan-1-dll/ In my environment, the problem was resolved.  However, my GPU was too old to play :(  I hope these information helps you. Bye.

Easy programming at home - Part 4 Let’s draw the graph of “y = x²”

Hi, Good morning / afternoon / evening. I’m ponpokorin (@ponpokorin_24).

This is Part 4 of “Easy programming at home”. You can jump to Part 1 to 3 from the links below.

Part 1 What is programming in the first place
Part 2 Let's use R
Part 3 Let's use R 2

I'm going to use R this time too, so if you haven't seen Part 1, look it first.

Alright.

This time I'm going to write a program that can be used for studying math. Specifically, the goal is to "output a graph of function." You may think that it seems difficult... but if you get used to it, you'll be able to use easily.

The flow goes like this.

Table of Contents

  • Commands for drawing graphs
  • What you can customize when drawing a graph
  • Try to draw graph using “for” and “if” statements without plot command
  • Afterword

Let’s go!

Commands for drawing graphs

Let's search for a command that graphs the function.
I used the site called “R source” (http://cse.naro.affrc.go.jp/takezawa/r-tips/r.html) because my native language is Japanese. I recommend you should look for pages in your native language about R.

In R source, you can see “とりあえずplot()” at section “グラフィックス編”. I told you usage of plot based on this page.

It seems to draw a graph if you give a function as an argument. Let's try it with R Console first.

func1 <- function(x) x     # y = x
func2 <- function(x) x^2   # y = x^2
plot(func1)
plot(func2)

Could you draw a graph, right? I think you wonder at this statement function(x) x. This intuition is the correct. This is an abbreviated way of writing. If you write long,

func1 <- function(x){
    x
}

It is like this. In the second line, for clarity, I create a space on the left by using Tab key.
Also,

func1 <- function(x){
    x }

It is same meaning.

However, if you have only one process, it feels exaggerated. Therefore, this shortcut way is provided. If the processing inside {} can be done on one line, just omit the {} and write the command to the right of function(x), and it's OK.

Now, you know the commands to draw the graph, next, you can make the graph look a little better.

What you can customize when drawing a graph

First, let’s pick up something that can be customized roughly.

  • Color
  • Limit to display
  • Axis name etc.

Practice makes perfect, let’s write more and more! Let's use func2 from earlier.

plot(func2, col="red", xlim=c(-10, 10), ylim=c(-1, 10), xlab="x", ylab="x^2")


Compared to plot (func2), it is much longer and somewhat confusing, but the graph become a little easier to understand. Here is an explanation of the added commands.

col

Command to specify color. It can be specified as col="red" as above, or as number. For example, you can specify red even with col = 2.

xlim/ylim

This is the limit specification for each of the x-axis and y-axis. Let's specify so that it is easy to see. Note that after the =, it is written in the form c (lower limit, upper limit).

xlab/ylab

This is the specification of the label of each x-axis and y-axis. We put the character into "" after =.

To make the graph more understandable, you can do something like this.

plot(func2, col="red", xlim=c(-10, 10), ylim=c(-1, 10), xlab="x", ylab="x^2")
abline(v=0)
abline(h=0)


The axis of x = 0 and y = 0 can be drawn by abline. There is also other command like this.

plot(func2, col="red", xlim=c(-10, 10), ylim=c(-1, 10), xlab="x", ylab="x^2", tck=1)

This has a grid

That's all for customization. However, you can also customize the legend when drawing multiple graphs and the shape of the dot when creating a line graph. Check it out if you are interested.

Try to draw graph using “for” and “if” statements without plot command

To be honest, the initial goal of “output a graph of function” has been sufficiently achieved using only the commands introduced above, but I felt that the content was a little less as it was.

So, let's do this!

Simply speaking, a “for” statement is for iterative processing, and an “if” statement is for different processing depending on conditions. Let's try this first. I recommend that you write it in the editor first.

# for statement
x <- 0
for(i in 1:3){
    x<- x + i
}
x  # This x is 6

# if statement
x <- 2
if(x==2){
    x <- x+2
    print(x)
}else{
    x <- x-1
    print(x)
}

How about that? Did you know what kind of processing was done? I will explain!

“for” statement

I will explain the flow.

  1. At first, x is 0, but i is set to 1 first, and x <-x + i is executed. Then x is updated to 1.
  2. Next, i is replaced by 2, and x <-x + i is executed again. Then x is updated to 3.
  3. Finally i is replaced by 3 and once again x <-x + i is executed. x is updated to 6 and the for statement ends.
i in 1: 3 means that integers from 1 to 3 are assigned to i in order. Because of such processing, the for statement is sometimes called a for loop.


“if” statement

I will explain the flow too. I think “if” is easier to understand.

The inside of {} under if (x == 2) means that if x == 2, then do x <- x+2 and print (x). Inside the {} under else means that or else do x <- x-1 and print (x). To check the behavior of else, try changing x to 3, 4 or any number you like.

print is a command to display.

If you use the “for” statement, you can draw y = x² as a graph without plot. The following command is an example.

x <- seq(-100,100)
y <- c()

for(i in -100:100){
    y[i+101] <- i^2 
}

plot(x, y, col=2)

At this point the shape is well understood, but you can also draw this point as a smooth line.

plot(x, y, col=2, type="l") # It’s small L. Not large i

Perfect!

The commands used here are only the ones introduced so far. Take a break, and then remember how to use each command, so that you’ll be able to use them by yourself. Surely such experience should help you in the future.

Afterword

How was this Part? It may not have been very interesting, but it can be useful for math homework (of course to check the answer, right?). Also, the last sentence is surprisingly important. In many programming languages as well as R, various commands are created by combining basic commands with “for” and “if” statements.

When there is something else you want to do, if you don't have a suitable command or you can't find one, you may create original command using “for” and “if” statements (I'll do that in Part 5). So be sure to become familiar with the “for” and “if” statements along with the other basic commands!

If you find this article useful, please share on social media or school. Then the author will be glad!

Thank you for your reading! See you again!


Bonus section

Here is useful site for you who have read this far!

As We drew the graph above, a site called "wolframalpha" will do various mathematical calculations and drawings on a computer. It's a bit slow to load, but you can use it to check your own graphs or to check the solution of an equation. Look at it once.

Comments

Popular posts from this blog

NICEHCK NX7 pro review 2

Hi. Good morning / afternoon / evening. I’m ponpokorin ( @ponpokorin_24 ). This article is part2 of NX7 pro(my favorite)'s review. Part1 is  here Today's a table of contents How the impression changes after using more than one month.  (Article's date is close to part1 because I translate Japanese article to English.) Review about filters. Comparison with monitor headphone (ATH-M70x) , using my favorite songs & music. Also, I have two changes. ear tips ; I ended up using ML size of Spiral Dot (JVC). DAP ; I used SONY ZX300 more than 200 hours with balanced NX7 pro. Let's start a review! AliExpress.com Product - NICEHCK NX7 Pro 7 Driver Units HIFI Earphone 4BA+Dual CNT Dynamic+Piezoelectric Ceramics Hybrid Replaceable Filter Facepanel IEM How the impression changes Before comparison with monitor, I write impression lightly with RHA CL750(my favorite too). CL750's sound is more sharp, in other words, NX7 pro's sound is m...

NICEHCK NX7 pro review

Hi. Good morning / afternoon / evening. I’m ponpokorin ( @ponpokorin_24 ). l have enjoyed audio and spent money on some audio goods for resent 3 years with several good and bad buying. In this article, I’ll introduce first impressions about my favorite chinese in-ear headphone “ NX7 pro. ” And also, I will write about detailed review at another article. If you are interested in this in-ear headphone, check this article later!   →  I wrote part2  here ! Let check it out! (I bought this ↓ 4.4mm ver.) AliExpress.com Product - NICEHCK NX7 Pro 7 Driver Units HIFI Earphone 4BA+Dual CNT Dynamic+Piezoelectric Ceramics Hybrid Replaceable Filter Facepanel IEM A table of contents Opening package First impression At the end... Opening package First, front side. and back side. When we break vinyl and open... These items are all contents. First impression ear tips “I want to listen asap! “ but I needed to choose best ear tips be...

Japanese rare gadget “Earspeaker”

Hi, Good morning / afternoon / evening. I’m ponpokorin ( @ponpokorin_24 ). This time, I would like to introduce rare headphone… no, no, earspeaker “STAX SR-L series” to you from Japan. It is possible to talk like listening to music through speakers, and it does not give a feeling of pressure to the ears, so it is called “earspeaker”. The price is high, but please check out this earspeaker series because it has a variety of unique features. In addition, since the voltage etc. differs depending on the country, if you want to buy it, please buy it from your local distributor or contact STAX. Table of Contents Where can we try it? Appearance check Light review Afterword Where can we try it? Before introducing the unique features, I would like you to try it when you come to Japan, so I would like to introduce places where you can try it in Japan. It is the best to check official web site (Japanese) https://stax.co.jp/support/dealer/ , but among them, my recommendation is...