text:
# draw quad with VAs-duh !

This topic is 4681 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I can't do it ! How hard can it be - this has got to be the simplest draw command EVER and I can't do it ! Duh ! Feel free to laugh at me ! I'll cut it down and make it as simple as possible:
//the vertices ! ie a quad facing in +ve z direction
Vertices[0][0] = 0.0f; Vertices[0][1]=0.0f; Vertices[0][2]= 0.0f;
Vertices[1][0] = 1.0f; Vertices[1][1]=0.0f; Vertices[1][2]= 0.0f;
Vertices[2][0] = 1.0f; Vertices[2][1]=1.0f; Vertices[2][2]= 0.0f;
Vertices[3][0] = 0.0f; Vertices[3][1]=1.0f; Vertices[3][2]= 0.0f;

//the normal for this face
m_normalArray[0][0]=0.0f;m_normalArray[0][1]=0.0f;m_normalArray[0][2]=1.0f;

//the text coord for this
m_texcoordArray[0][0]=0.0f;	m_texcoordArray[0][1]=0.0f;
m_texcoordArray[1][0]=1.0f;	m_texcoordArray[1][1]=0.0f;
m_texcoordArray[2][0]=1.0f;	m_texcoordArray[2][1]=1.0f;
m_texcoordArray[3][0]=0.0f;	m_texcoordArray[3][1]=1.0f;

//the index pointer for this ie draw vertices 0,1,2,3 !!
m_indexArray[0]=0; m_indexArray[1]=1;m_indexArray[2]=2;	m_indexArray[3]=3;

//enable client state
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glEnableClientState(GL_INDEX_ARRAY);

glVertexPointer(3, GL_FLOAT, 0, Vertices);
glNormalPointer(GL_FLOAT, 0, m_normalArray);
glTexCoordPointer(2, GL_FLOAT, 0, m_texcoordArray);
glIndexPointer(GL_UNSIGNED_BYTE, 0, m_indexArray);

//DRAW !!!!
glPushMatrix();
glTranslatef(position.x, position.y, position.z);
glEnable(GL_TEXTURE_2D);

glBindTexture(GL_TEXTURE_2D, frontText[0]);
glPushMatrix();
glScalef((GLfloat)width, (GLfloat)SHOP_HEIGHT, 0.0f);
glDrawElements(GL_POLYGON, 4, GL_UNSIGNED_BYTE, m_indexArray);
glPopMatrix();
glPopMatrix();

nothing on the screen at all ! I do about 50 of these calls. It works fine if I don't use VAs Humour me - is the above dumbo code correct ?! cheers Ade edited by _the_phantom
Added source tags, please use them in future and check the forum FAQ for details on the tags to use

##### Share on other sites
how are those arrays setup?

##### Share on other sites
I noticed that you only have one normal vector. You will need a normal for each vertex.

##### Share on other sites
hmmm I need a normal for each face,
anyhow I did a normal for each vertex just now and still have nothing on the screen.

This is so annoying, this is the simplest thing ever and I can't do it.

in reply to the other person here's the defs of the arrays:

GLfloat bldgVertices[8][3];
GLubyte m_indexArray[24];
GLfloat m_normalArray[24][3]; //was [6][3]
GLfloat m_colorArray[6][3];
GLfloat m_texcoordArray[24][2];

##### Share on other sites
glIndexPointer(GL_UNSIGNED_BYTE, 0, m_indexArray);
look in the spec to see what this does

##### Share on other sites
well, I removed the glIndexPointer call, and didn't call the glEnableClientState(GL_INDEX_ARRAY) but still nothing on the screen.

##### Share on other sites
well to make sure I wasn't going mad I did the following instead of DrawElements:

glColor3f(0.8f, 0.8f, 0.8f);
glVertex3fv(Vertices[0]);
glVertex3fv(Vertices[1]);
glVertex3fv(Vertices[2]);
glVertex3fv(Vertices[3]);
glEnd();

and it worked FINE !!!

So the Vertices are correct but I can't get the DrawElements to work at all.

Any ideas ?

##### Share on other sites
ok, refresher:
What I'm tryign to do is (firstly) draw a quad using VAs:

That call does not work.

So, in the very same place of the above call I've explicitly created the quad - this time using the indexArray and Vertices array like this:

glEnd();

THIS WORKS !!!

This means that 1)m_indexArray has the correct data 2) Vertices has the correct data !!

So why won't my DrawElements call work at all when it uses precisely the same data as the explicit call.

ppplllllleeeeeaaasee ... anyone ?!

cheers

##### Share on other sites
Well, get rid of the inner 'push/popmatrix()' commands...that might be resetting your matrix, give it a try anyway.

Also, try using standard VA's ( "glDrawArrays()" ) and see what happends.

-Twixn-

##### Share on other sites
This works for me:

//Init stuffGLfloat Vertices[4][3];GLfloat m_texcoordArray[4][2];GLubyte m_indexArray[4];					Vertices[0][0] = 0.0f; Vertices[0][1]=0.0f; Vertices[0][2]= 0.0f;Vertices[1][0] = 1.0f; Vertices[1][1]=0.0f; Vertices[1][2]= 0.0f;Vertices[2][0] = 1.0f; Vertices[2][1]=1.0f; Vertices[2][2]= 0.0f;Vertices[3][0] = 0.0f; Vertices[3][1]=1.0f; Vertices[3][2]= 0.0f;m_texcoordArray[0][0]=0.0f;	m_texcoordArray[0][1]=0.0f;m_texcoordArray[1][0]=1.0f;	m_texcoordArray[1][1]=0.0f;m_texcoordArray[2][0]=1.0f;	m_texcoordArray[2][1]=1.0f;m_texcoordArray[3][0]=0.0f;	m_texcoordArray[3][1]=1.0f;m_indexArray[0]=0; m_indexArray[1]=1;m_indexArray[2]=2;	m_indexArray[3]=3;//Later on, (in draw loop)//Set camera, bind texture, blah blah blah, then....glVertexPointer(3, GL_FLOAT, 0, Vertices);	glTexCoordPointer(2, GL_FLOAT, 0, m_texcoordArray);glDrawElements(GL_QUADS, 4, GL_UNSIGNED_BYTE, m_indexArray);

This drew a small quad in the center of my screen with the current texture mapped to it. Note that I didn't even have to call glEnableClientState() on anything, but that may have just been me. I recommend trying it out with minimal data like this (no normals or anything) first, getting that to work, then building on it from there.

##### Share on other sites
ah yes, good point, the inital code posted and the code which used glVertex() dont do the same thing!.
The later just draw a quad with no texturing nor normal infomation applied, the former however applies normals and if you've switched lighting on (or havent infact) this could cause your object to appear black.

So, chances are your code does work but something in the lighting is broken and thus it appears as though you dont draw anything.

##### Share on other sites
ok, I checked and the light is definitely on, it's never disabled, I can check this because if I revert to drawing the quads not using DrawElements but with normals then I can see the shading etc.
I also tried removing the second push/pop to no avail.

So I now tried this:

glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);

glVertexPointer(3, GL_FLOAT, 0, Vertices);
glNormalPointer(GL_FLOAT, 0, m_normalArray);
glColorPointer(3, GL_FLOAT, 0, m_colorArray);

still nothing.

BTW the color array is set up like this:

for (int i=0; i<4; i++)
{
m_colorArray[0]=m_colorArray[1]=m_colorArray[2] = 0.7f;
}

the normals are set up like (although I think I only need one normal for one quad but this won't hurt.:

for (int i=0; i<4; i++)
{
m_normalArray[0]=0.0f;m_normalArray[1]=0.0f;m_normalArray[2]=1.0f;
}

##### Share on other sites
Quote:
 Original post by ade-the-heatthe normals are set up like (although I think I only need one normal for one quad but this won't hurt.

No, you need one normal for each vertex in the vertex array, doing anything else will definately break things.

And you arent using the code tags, even after I asked nicely *stern look*

##### Share on other sites
even with a normal for each vertex it still didn't work.
sigh....

is there anything else I can do ?... getting depressed...

BTW what's a code tag (not being sarcastic - i don't remember you mentioning it).

cheers

##### Share on other sites
Quote:
 Original post by ade-the-heatBTW what's a code tag (not being sarcastic - i don't remember you mentioning it).

I assume you didnt notice your first post in this thread was edited then...

##### Share on other sites
Did you say tha you did have lighting turned on? Have you tried switching it off and rendering? If the light or normals are configured wierd it could easily be drawing a black poly on the screen, which would make it effectively invisible.

On a similar note, based on some really horrid lighting bugs in the past I always always ALWAYS clear the screen to a non-black color when I'm doing my testing/developing. This helps immensly, as black or really dark polys are visible. Favorite "debug" setting is: glClearColor(0.1f, 0.1f, 0.2f, 1.0f);

Gives you a nice bluish-grey background that's not very distracting but helps the details show up.

##### Share on other sites
thanks, the light is defitely on as I have cleared the screen to light blue each frame, in addition if I create the quad using the glVertex3fv way with normals then I can see lots of these quads (each frame I write about 30 quads to the screen).

Phantom- thanks I'll re-start on the faqs,

cheers

##### Share on other sites
ok, you mentioned lights, so here is what i tried and it still didn't work !
Nothing on the screen at all:
(look previously msgs in this thread to see how I set up the arrays - which work when i use them when I did the working version with glVertext3f)

float lightpos[4]={0.0f, 700.0f, 1.0f, 0.0f};float ambientlight[4]={145.0f/255.0f, 145.0f/255.0f, 145.0f/255.0f, 0.0f};float diffuselight[4]={145.0f/255.0f, 145.0f/255.0f, 145.0f/255.0f, 0.0f};	glEnable(GL_LIGHTING);	glLightfv(GL_LIGHT0, GL_AMBIENT, ambientlight); 	glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuselight); 	glLightfv(GL_LIGHT0, GL_POSITION, lightpos); 	//glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambientlight);	glEnable(GL_LIGHT0);	//now draw relevant quad in our vertices	glEnableClientState(GL_VERTEX_ARRAY);	glEnableClientState(GL_NORMAL_ARRAY);	glEnableClientState(GL_COLOR_ARRAY);	glVertexPointer(3, GL_FLOAT, 0, bldgVertices);		glNormalPointer(GL_FLOAT, 0, m_normalArray);	glColorPointer(3, GL_FLOAT, 0, m_colorArray);	//glColor3f(0.8f, 0.8f, 0.8f);	glDrawElements(GL_QUADS, 4, GL_UNSIGNED_BYTE, m_indexArray);

##### Share on other sites
First off: Thanks for the source tags! Makes things easier to read.

Second: When I mentioned the lights, I asked if they were on, and if so to turn them OFF. Only for a moment, and simply for debug purposes. All you would really have to do is call glDisable(GL_LIGHTING) right before your draw call. I would recommend doing this until you have the quad showing up, THEN enabling lighting again and working from there. Always start with the minimal possible settings and work your way up. The less that's enabled the less that can go wrong.

Also, once again just for debugging purpouses, try commenting out the following two lines:

glEnableClientState(GL_NORMAL_ARRAY);
glNormalPointer(GL_FLOAT, 0, m_normalArray);

Then run the code and see if it makes a difference. Again, this is just starting with a minimal amount of information (Position and TexCoords) and then working your way up after you get it working.

Sorry if you've already tried those, but it's not clear that you have.

##### Share on other sites
Why are you enabling these on the client side?

use glEnable(GL_VERTEX_ARRAY).

see if that fixes it.

##### Share on other sites
the red book says to use glEnableClientState for VAs

I tried the following and combinations thereof !:

1. enabled/disabled lighting
2. enabled/disabled normals

I now have:

	glDisable(GL_LIGHTING); //just to make sure	glEnable(GL_VERTEX_ARRAY);	glDisableClientState(GL_NORMAL_ARRAY); //just to make sure	glVertexPointer(3, GL_FLOAT, 0, Vertices);		glDrawElements(GL_QUADS, 4, GL_UNSIGNED_BYTE, m_indexArray);

I mean, how much simpler could it be !!

To recap the below works !! which means at least teh vertex and index arrays are set up properly:

	glDisable(GL_LIGHTING); //just to make sure	glEnable(GL_VERTEX_ARRAY);	glDisableClientState(GL_NORMAL_ARRAY); //just to make sure	glVertexPointer(3, GL_FLOAT, 0, Vertices);		glColor3f(0.8f, 0.8f, 0.8f);	glBegin(GL_QUADS);		glVertex3fv(bldgVertices[m_indexArray[0]);		glVertex3fv(bldgVertices[m_indexArray[1]);		glVertex3fv(bldgVertices[m_indexArray[2]);		glVertex3fv(bldgVertices[m_indexArray[3]);	glEnd();

##### Share on other sites
Quote:
 Original post by ade-the-heat...glVertexPointer(3, GL_FLOAT, 0, Vertices);...glVertex3fv(bldgVertices[m_indexArray[0]);...
You're using two different variables... Vertices and bldgVertices. But I'm assuming that since you're missing a closing bracket for the bldgVertices array that this isn't a copy-paste from your code, otherwise you would be getting a compiler error, so I guess they could be the same variables in your real code. As a general guideline when posting code, copy and paste it directly, otherwise it might end up being different and have new errors (such as syntax errors) for people like me to notice and give you the wrong advice on.

Anyway, can you upload your whole project somewhere so we can get a better look at it?

##### Share on other sites
(For the record, this is Blue*Omega, I'm just sick of my old user name.)

I noticed that in your most recent code post, you've set glColor3f(0.8f, 0.8f, 0.8f); in the second example, but not the first. You can use the same command in conjunction with glDrawElements(), in case you didn't know.

Sorry if that doesn't help much, but I'm running out of ideas.

##### Share on other sites
Alright, but just for the record, I use glEnable(GL_VERTEX_ARRAY) and everything
is peachy-keen.

hhmmm...

##### Share on other sites
the Vertices is the same as bldgVertices - you're right I didn't copy n paste exactly.

I set the color using glColor for the VAs and still nothing...

This is getting me now. I've had a problem like this before when doing bit mapped fonts. They were the wrong color always. Everyone did their best to help. Nothing worked. I tried on/off for a month and gave up. Then six months later (this was yesterday !) I solved the problem. It was because I had the lighting on when doing the fonts - if I tunred the light off the font was the correct color ! Now that solution isn't intuitive and it won't be in any red or blue book... I guess I'l have to six months until soemthing stupid turns up..

I'd upload the project but it's too big really...

So my guess is: does anyone have/or can think of any dumb enabling/disabling combination I can do that will make the VAs work - we have to bear in mind that the glVertex3f methods works everytime which suggests that it all seems to be ok... sigh ...


text:
# A simple Javascript Breakout game

I wrote a simple breakout game in javascript. I was wondering if anyone could give me some advice on improving my code. I wrote somethings a bit oddly so I am more then welcome to criticism (constructive would be preferred however.)

let canvas = document.getElementById("mainCanv");
let ctx = canvas.getContext("2d");
let brickLength = 14;
let score = 0;
w:80,
h:15,
x:180,
y:canvas.height-40,
}
let ball = {
w:20,
h:20,
x:200,
y:200,
speedY:Math.sin(0.6),
speedX:Math.cos(0.6),
speed:5
}

let keys = {
Left:false,
Right:false
}

let bricks = initBricks(brickLength);

function update(){
//Draw everything
ctx.fillStyle = 'black'
ctx.fillRect(0,0,canvas.width, canvas.height)
ctx.fillStyle = "green"
ctx.fillStyle = "red"
ctx.fillRect(ball.x, ball.y, ball.w, ball.h)
ctx.fillStyle = "white";
ctx.fillText("Score: " + score, 20,20)
for(let i = 0; i < brickLength; i++){
if(bricks[i].showing){
ctx.fillStyle = "blue";
ctx.fillRect(bricks[i].x, bricks[i].y, bricks[i].w, bricks[i].h);
if(ball.y<bricks[i].y+bricks[i].h && ball.y > bricks[i].y-bricks[i].h&& ball.x > bricks[i].x - bricks[i].w && ball.x < bricks[i].x +bricks[i].w){
bricks[i].showing = false;
ball.speedY *= 1;
ball.speedX *= -1;
score += 10;
}
}
}

//Do score calculations
if(score % 13 == 0 && score >= 130){
bricks = initBricks(brickLength);
ball.speed += 2;
}

//Realtime movement
if(keys.Right) {
}
if(keys.Left) {
}

ballMove(ball, 5, 5)

//Check out of bounds
ball.y = canvas.height/2
ball.x = canvas.width/2
ball.speed = 5;
score = 0;
bricks = initBricks(brickLength);
}
}

//Key checking
switch(event.keyCode){
case 37:
keys.Right = true;
keys.Left = false;
break;
case 39:
keys.Right = false;
keys.Left = true;
break;
}

})
if(event.keyCode == 37 || event.keyCode == 39){
keys.Right = false;
keys.Left = false;
}
})

//Movement functions
}
}

function ballMove(ball){

ball.x+=ball.speedX*ball.speed;
ball.y+=ball.speedY*ball.speed;

ball.speedY *= -1;
}

if(ball.x<0||ball.x>480 ){
ball.speedX *= -1;
}
}

//Initialise bricks
function initBricks(length){
let bricks = [length];
for(let i = 0; i < length; i++){
bricks.push({
x:0+i*40,
y:60,
w:20,
h:20,
showing:true
})
}
return bricks
}

setInterval(update, 1000/60);
<!DOCTYPE html>
<html>
<title>Breakout</title>
<body>
<canvas id="mainCanv" width="500" height="500" style="background-color:black"></canvas>
<script type="text/javascript" src="game.js"></script>
</body>
</html>

# Code review

Not bad, code is nice and clean, and naming is good.

Game play has some logic flaws in the way you handle the keyboard and collisions.

## Some code style points.

• Use constants for variables that do not change.

• Learn to add semicolon to the end of lines. Don't rely on automatic semicolon insertion as that has some traps.

• Separate operators with spaces to make the codes easier to read. EG if(ball.x<0||ball.x>480 ){ should be if (ball.x < 0 || ball.x > 480) {

• KeyboardEvent.keyCode is a depreciated property and could be removed at any time. Use KeyboardEvent.key or KeyboardEvent.code

• Never use setInterval to time rendering as it is not synced to the display refresh. Use requestAnimationFrame instead.

• Add "use strict"; as the first line of the JavaScript to tell JavaScript to run in a stricter and more performant mode.

• You have let bricks = [length]; this does not create an array of length, it creates an array with the first item length. To set an array's length use the length property bricks.length = length;

• window is the default object, there is really no reason for you to reference it. You don't use it for window.document, window.setInterval, or any of the variables you declare in global scope so why use it for window.addEventListener

## Code design and logic

See the rewrite for more details regarding the points below.

• The update function has taken on too much responsibility. Try to limit what a function does to one thing only.

• Keyboard logic is incorrect. You assume only one control key to be down at any one time. Players will sometimes hold one direction and tap the other. Your code does not allow this giving the illusion that the first key down no longer works. It is better to just hold the key state of each key.

• Your paddle/ball collision has some logic flaws. A general rule of game collisions is to NEVER allow the game state to enter an impossible state. In this case the ball and paddle overlapping.

As you have the code the ball will on occasion get stuck to the paddle.

When you do a collision remember that it happens over a period of time between the previous and current frame. You need to work out when the ball hit during that frame and where it will be at the start of the next frame (usually some distance from the collision as it is already moving away)

• Objects can also hold functions. It is easier to manage the various parts of a game if you encapsulate functionality into the game objects as well. In the rewrite you will see the main object, ball, paddle and bricks all contain the functions they need to draw, update, init/reset and various other functions as needed.

• You can inherit properties of existing types using Object.assign, or the spread operator ... allowing you to setup properties and functions that are the same for many different objects. The bricks are an Array with properties added to draw, etc. Each array item is a brick with its own properties and functions.

• Rather than have a semaphore to indicate if a brick is showing or not you can remove the brick from the array and that will save you iterating many bricks that are not showing.

• Having many magic numbers spread in your code you can create a settings object to hold everything in one place. This makes it much easier to change the game settings, saving the hassle of going over the code to find every instance of a setting. In the rewrite the object game has everything needed to set up the game.

• The order of actions for a game is usually move everything , test collisions and adjust position of everything, then draw everything

## The rewrite.

The rewrite is as an example only. There are many ways to organised the code for an app, each has it pros and cons. These will vary with the individual, with the best style being one that best suits your way of thinking. Don't let code dogma spoil the fun of writing a game.

The rewrite has added some things.

I needed to test if it was all working, and being lazy, playing the game to find problems was too much effort, so I added an autoplay that plays the game at many time normal speed so that I could make sure all was OK. Check the game.autoPlay to turn off.

I also added a few more bricks.

I have change all the collision logic to a more robust form that takes in account the object's travel during the previous frame. As there are 4 types of collision Ball / Paddle, Ball / Wall, Ball / Brick, and Paddle/Wall each somewhat different in needs, thus the code base has grown somewhat.

I was tempted to add ball hit deviation depending on where the ball hit the paddle, but left that out in the end.

"use strict";

requestAnimationFrame(mainLoop); // request first frame. This will only happen after all the code below has been evaluated

// I am using direct reference to the canvas by its ID
//const canvas = document.getElementById("mainCanv");
const ctx = canvas.getContext("2d");

var score = 0;

/*===========================================================================================
all game constants and settings
============================================================================================*/
const game = {
backgroundColor : "black",
autoPlay : true,
auto : {
playSpeed : 10, // Number of autoplay frames per 60th second Note one extra normal frame is also rendered
follow : 0.7, // how well auto play ball follows 1 is perfect, 0.8 will always hit, < 0.8 ocational miss to 0 wont move
},
init : {  // this is added directly to the paddle object
w : 80,
h : 15,
color : "green",
},
fromBottom : 40, // these are added programmatic
speed : 5,
},
ball : {
init : { // this is added directly to the ball object
w: 20,
h: 20,
x: 200,
y: 200,
color : "red"
},
dir : 0.6, // these are added programmatic
speed : 4,
},
brick : {
init : { // this is added directly to each brick object
w : 20,
h : 20,
color : "blue",
},
spacingX : 40, // these are added programmatic
spacingY : 40,
top : 60,
rowCount : 14,
count : 14 * 4,
value : 10, // points its worth
},
score : { // where to put the score and its color
x : 20,
y : 20,
color : "white",
},
}

/*===========================================================================================
helper Function
============================================================================================*/
function doRectsOverlap(rectA, rectB){ // both rectA, and rectB must have properties x,y,w,h
return ! (
rectA.y > rectB.y + rectB.h ||
rectA.y + rectA.h < rectB.y ||
rectA.x + rectA.w < rectB.x ||
rectA.x > rectB.x + rectB.w
);
}
/*===========================================================================================
Common object properties and functions
============================================================================================*/
const rectangle = {
draw() {
ctx.fillStyle = this.color;
ctx.fillRect(this.x, this.y, this.w, this.h);
}
}

/*===========================================================================================
The main animation loop
============================================================================================*/
function mainLoop() {
ctx.fillStyle = game.backgroundColor;
ctx.fillRect(0, 0, canvas.width, canvas.height)
inPlay();
requestAnimationFrame(mainLoop); // request next frame
}

/*===========================================================================================
When in play
============================================================================================*/
function inPlay() {
if (ball.outOfBounds) {
reset(); // reset game when out of bounds
}
// auto play loops over main game draws everything but bricks
// at a faded alpha level
if (game.autoPlay) {
ctx.globalAlpha = 1 / (game.auto.playSpeed /4);
for (let i = 0; i < game.auto.playSpeed; i++) {
ball.update();
bricks.update();

ball.draw();

}
ctx.globalAlpha = 1;
if (keys.any) {
game.autoPlay = false;
}
}
// main render for normal play at alpha = 1;
ball.update();
bricks.update();

ball.draw();
bricks.draw();

if (bricks.length === 0 && paddle.hitBall) { bricks.init() }
drawScore();
}

function reset(){
ball.reset();
bricks.init();
keys.clear();
score = 0;
}

function drawScore(){ // does the score thing
ctx.fillStyle = game.score.color;
ctx.fillText("Score: " + score, game.score.x, game.score.y)
}

/*===========================================================================================
Keyboard state and event handler
============================================================================================*/
const keys = {
ArrowLeft : false,
ArrowRight : false,
any : false,
event(event) {
if (keys[event.code] !== undefined) {
keys[event.code] = event.type === "keydown";
}
keys.any = event.type === "keydown" ? true : keys.any;
},
clear(){
for(const key of Object.keys(keys)) {
if (typeof keys[key] !== "function") { keys[key] = false }
}
}
};

/*===========================================================================================
Brick related code
============================================================================================*/
// Assign some functions to an array of bricks
const bricks = Object.assign([], { // The array to get some more properties
init() {
this.length = 0; // zero length
for (let i = 0; i < game.brick.count; i++) {
this.push({
...rectangle,
...game.brick.init,
x: (i % game.brick.rowCount) * game.brick.spacingX,
y: game.brick.top + (i / game.brick.rowCount | 0)  * game.brick.spacingY,
})
}
},
draw() {
for (const brick of this) { brick.draw() }
},
update() {
var i;
for (i = 0; i < this.length; i ++) {
const brick = this[i];
if (ball.testBrick(brick)) { // check ball against brick remove brick if hit
this.splice(i--, 1); // remove brick
score += game.brick.value;
}
}
}
});

/*===========================================================================================
Ball related code
============================================================================================*/
const ball = {
...rectangle,  // assign common
...game.ball.init,  // assign ball init values
dx : 0, // common name for speed is delta so I use deltaX, and deltaY shortened to dx,dy
dy : 0,
outOfBounds : true, // this forces reset at start of game
reset() {
Object.assign(this,
game.ball.init, {
dx : Math.cos(game.ball.dir) * game.ball.speed,
dy : Math.sin(game.ball.dir) * game.ball.speed,
outOfBounds : false,
}
);
},
update() {
this.x += this.dx;
this.y += this.dy;
if (this.x <= 0) {
this.x = -this.x; // the ball will have moved away from the wall the same distance it has moved into the wall
// MUST MOVE AWAY +
this.dx = Math.abs(this.dx); // Set the direction as always positive. If you do -this.dx it may stuff up when you have
// the ball and paddle interacting at the same time
} else if (this.x > canvas.width - this.w) {
this.x = (canvas.width - this.w) - (this.x - (canvas.width - this.w));
// MUST MOVE AWAY -
this.dx = -Math.abs(this.dx);
}
if (this.y < 0) {
this.y = -this.y;
this.dy = Math.abs(this.dy);
}
if (this.y > canvas.height) { // ball out of bounds
this.outOfBounds = true;
}

},
checkbrickTopBot(brick){
if (this.dy < 0) { // moving up
this.y = (brick.y + brick.h) + ((brick.y + brick.h) - this.y);
this.dy = -this.dy;
return true;
}
// must be moving down
this.y = brick.y - ((this.y + this.h) - brick.y) - this.h;
this.dy = -this.dy;
return true;

},
checkbrickLeftRight(brick){
if (this.dx < 0) { // moving up
this.x= (brick.x + brick.w) + ((brick.x + brick.w) - this.x);
this.dx = -this.dx;
return true;
}
// must be moving down
this.x = brick.x - ((this.x + this.w) - brick.x) - this.w;
this.dx = -this.dx;
return true;
},

testBrick (brick) { // returns true if brick hit

if (doRectsOverlap(this, brick)) {
// use ball direction to check which side of brick to test
// First normalize the speed vector
var speed = Math.sqrt(this.dx * this.dx + this.dy * this.dy);
var nx = this.dx / speed;
var ny = this.dy / speed;
var xDist,yDist;
// now find the distance to the brick edges in terms of normalised spped
if (this.dx < 0) {
xDist = ((this.x - this.dx) - (brick.x + brick.w)) / nx;
} else {
xDist = ((this.x - this.dx + this.w) - brick.x) / nx;
}
if (this.dy < 0) {
yDist = ((this.y - this.dy) - (brick.y + brick.h)) / ny;
} else {
yDist = ((this.y - this.dy + this.h) - brick.y) / ny;

}
// the edge that is hit first is the smallest dist
if (xDist <= yDist) { // x edge first to hit
return this.checkbrickLeftRight(brick);
}
return this.checkbrickTopBot(brick);
}
return false;
},

};

/*===========================================================================================
============================================================================================*/
...rectangle,  // assign common
x: (canvas.width / 2 - game.paddle.init.w / 2) | 0,  // | 0 floors the result (same as Math.floor)
hitBall : true,
leftEdge : 0,
reset() {
this.x =  (canvas.width / 2 - game.paddle.init.w / 2) | 0;  // | 0 floors the result (same as Math.floor)
},
update() {
if (game.autoPlay) {
keys.ArrowRight = false;
keys.ArrowLeft = false;
if (Math.random() < game.auto.follow) {
var x = ball.x + ((Math.random()- 0.5) * this.w * 2);
if (ball.x > this.x + this.w * (3/4)) { keys.ArrowRight = true }
if (ball.x < this.x + this.w * (1/4)) { keys.ArrowLeft = true }
}
}
if (keys.ArrowRight) { this.x += game.paddle.speed }
if (keys.ArrowLeft) { this.x -= game.paddle.speed }
this.x = this.x < this.leftEdge ? this.leftEdge : this.x;
this.x = this.x >= this.rightEdge ? this.rightEdge : this.x;
},
testBall(ball) {
if (doRectsOverlap(this, ball)) {
// we now know that the ball must be hitting the paddle.
var cx = (ball.x + ball.w / 2); // get ball x center
// check for side hits. If so ball goes away from edge
if (cx < this.x) { // hits paddle left side
ball.y = this.y - ((ball.y + ball.h) - this.y) - ball.h;
ball.x = this.x - ball.w;
ball.dy = -Math.abs(ball.dy); // Must be negative
ball.dx = -Math.abs(ball.dx); // Must be negative
this.hitBall = true;

} else if( cx > this.x + this.w) { // hits paddle right side
ball.y = this.y - ((ball.y + ball.h) - this.y) - ball.h;
ball.x = this.x + this.w;
ball.dy = -Math.abs(ball.dy); // Must be negative
ball.dx = Math.abs(ball.dx); // Must be positive
this.hitBall = true;

} else { // must be hits bat top or have run over the ball too lat
if (ball.y > this.y + this.h / 2) { // if ball is more than halfway through the bat too lat to rescue so let it continue on
return;
}
ball.y = this.y - ((ball.y + ball.h) - this.y) - ball.h;
ball.dy = -Math.abs(ball.dy); // Must be negative
this.hitBall = true;
}
}

},
}
<!-- the id is used to reference the element canvas -->
<canvas id="canvas" width="540" height="400"></canvas>

• Thanks! This review is really in depth and helpful. A few things that you mentioned like forgetting to add semicolons were just stupid mistakes on my part and things I usually do right (maybe I just didn't read through my code as in depth as I should.) Anyway thanks for the advice, I will definitely take everything you said into account. May 15 '18 at 3:08

format: plain


text:
# SageMath

Trained as an electrical engineer, I am most comfortable with Matlab in terms of serving my math need. However, for symbolic math problems, Matlab is not as intuitive as Mathematica (of course, we can still do it though. Check out “syms”). But I never get used to the syntax of Mathematica. And I found the license requirement is quite annoying. Even though I got a legal license from the university I am affiliated with, I need to renew it manually every year. Actually, Matlab is beginning as annoying in recent years. I have to make sure my Internet is running well or my Matlab session will die eventually as it got disconnected from the license server of the university.

That is why unless absolutely necessary, I am often using the free alternatives instead. Octave is a great clone of Matlab. And it can be installed conveniently with just one “apt install” in Ubuntu:

sudo apt install octave

SageMath is not as a direct clone of Mathematica as Octave to Matlab. But as engineers love Octave, mathematicians seem to love SageMath. Again, it can be installed one line in Ubuntu (18.04 or above) with

sudo apt install sagemath

I found the syntax of SageMath much more intuitive to me than Mathematica since the former has more resemblance of numpy which I am more familiar with. And the Mathematica/jupyter-like notebook is definitely a plus comparing to Matlab/Octave.

Doing calculus is very simple. Say I want to find $\int (x+1) dx$.  I just need

var('x')  # indicate x is a symbolic variable
integral(x+1,x)

One can do definite integral without much changes also. For example, $\int_{x=1}^2 (x+1) dx$ translates to

var('x')
integral(x+1,x,1,2)

We can have the limits as symbols as well. For example, $\int_{x=a}^{a+b} (x+1) dx$ translates to

var('x','a','b')
integral(x+1,x,a,a+b)

Another function I used often is matrix operations. Say I like to compute $\begin{pmatrix} a & b \\ b & a \end{pmatrix} \begin{pmatrix} b & a \\ a & b\end{pmatrix}$. It simply translates to

var('a','b')
matrix( [[a,b],[b,a]])*matrix([[b,a],[a,b]])


text:
# Why "Dark Energy" is called energy instead of force?

The overly simplified explanation I'm giving myself right now is dark energy causes the opposite of what gravity does, that's why the universe is expanding. Now where gravity is a force, why dark energy is "energy"? Why it's not called "Dark Force" instead? I think I must be missing something here.

• What's in a name? Would a rose by any other name not stimulate the particulate receptors in your nasal cavity that triggers an olfactory response in the the brain just as sweet?
– Jim
Apr 9, 2014 at 19:11
• Remark: in general relativity, gravity is not a force. In fact, dark energy doesn't do the opposite of what gravity does, it does the opposite of what regular energy does (and mass, which is just some form energy). Apr 9, 2014 at 19:39
• Hate to digress, but Jim: Shakespeare ref? Apr 9, 2014 at 19:53

Because as far as we understand general relativity, it's not doing "the opposite of what gravity does." Gravity can be locally attractive or repulsive, depending on whether the stress-energy content satisfies or violates the strong energy condition. For ordinary matter, the stress-energy is dominated by the mass, the SEC holds, and its gravity is attractive. But this needn't be the case in general.

Since gravity depends on more than the (mass-)energy content, in cosmological models, the universe accelerates or decelerates proportionally to $\rho+3p$, where $\rho$ is the energy density and $p$ is the pressure. The factor of $3$ for the pressure comes from the fact that there are three spatial dimensions, but only one temporal dimension. In particular, the cosmological constant corresponds to the case of a perfect fluid with $p = -\rho$ (which can be generalized to other "equations of state"), and so a positive "dark energy" density has a repulsive effect, not because it's "the opposite of what gravity does", but rather because its negative pressure gravitates in addition to its energy.

The term "Dark Energy" is just a name that we have given it while we try to determine what exactly it is and what a better name for it would then be. However, calling it an energy is appropriate. Our best model, the cosmological constant, says that dark energy has a constant energy density (that is a constant amount of energy per unit volume) in the universe. Think about this, if you take an expanding box that represents the universe and put into it some energy (a hunk of matter or some radiation or whatnot), then at the initial time its energy density is the energy in the box divided by the volume. At a later time, the energy density is bound to be lower because the volume grew but you didn't put more energy into it. Dark energy has a constant energy density; it is an "energy" that adds more of itself to the universe the bigger it gets.

But I digress, it is not called a dark "force" because it acts more like an energy. However, we could have called it anything we wanted. Some people argue that a more appropriate name for it would be "Dark Pressure" because it is a constant energy density, which is the same as pressure. It is described as a negative pressure. But since, in cosmology, we like to put everything into units of mass (energy), we like to call everything an energy.

• Now I'm even more confused by this sentence- "it is an "energy" that adds more of itself to the universe the bigger it gets". Doesn't that violate law of conservation of energy? How would the total amount of energy increase in the whole Universe? Apr 9, 2014 at 19:33
• @MHK: Thinking a bit naively, if the box increases its volume by $\Delta V$ and it still has the same energy density $\rho$, then energy content increased by $\rho\Delta V$. But the pressure remained constant, so the work done is $p\Delta V$, where $p$ is the pressure. If $\rho = -p$, as it is for a cosmological constant, energy increase is balanced by negative work. I say "naively" partly because "the total amount of energy in the Universe" is (usually) not a well-defined quantity in GTR in the first place. Apr 9, 2014 at 20:09
• @MHK additionally, there is no law of conservation of energy in a universe that is different at different times (a time-dependent expansion). The stress-energy is conserved, but not the total energy
– Jim
Apr 10, 2014 at 3:49


text:
×

# Pythagorean theorem: find the length of the hypotenuse

What is the length of the hypotenuse? x=length=?? height=9 base=6 Round to the nearest tenth if needed.

Note by Kanya Shah
2 years ago

Sort by:

The answer is sqrt(81+36) , which is equal to sqrt(117) , which is approximately 10.81. · 1 year, 11 months ago

yea i rounded. · 1 year, 11 months ago

What does it mean? · 1 year, 11 months ago

uhhhhhhhhhhhhh..... yea means yes · 1 year, 11 months ago


text:
Stream: general

Topic: Universe issues

Kevin Buzzard (Apr 06 2018 at 19:28):

I seem to not understand universes properly, or more precisely how to use them properly. I ran into the following issue with some code:

Kevin Buzzard (Apr 06 2018 at 19:28):

definition foo (X : Type*) := ∀ (β : Type*), true

theorem baz (X : Type*) (bar: foo X) (β : Type*) : true :=
begin
have H := bar β, -- error
end

The error was

Kevin Buzzard (Apr 06 2018 at 19:28):

type mismatch at application
bar β
term
β
has type
Type u_3 : Type (u_3+1)
but is expected to have type
Type u_2 : Type (u_2+1)
state:
X : Type u_1,
bar : foo X,
β : Type u_3
⊢ true

Kevin Buzzard (Apr 06 2018 at 19:29):

I figured I'd investigate more, so I next wrote this:

Kevin Buzzard (Apr 06 2018 at 19:30):

universes u v w x
set_option pp.universes true
definition foo' (X : Type u) := ∀ (β : Type v), true
theorem baz' (X : Type w) (bar' : foo' X) (β : Type x) : true :=
begin
have H := bar' β, -- error
end

Kevin Buzzard (Apr 06 2018 at 19:30):

and this time I got

Kevin Buzzard (Apr 06 2018 at 19:30):

type mismatch at application
bar' β
term
β
has type
Type x : Type (x+1)
but is expected to have type
Type u_1 : Type (u_1+1)
state:
X : Type w,
bar' : foo'.{w u_1} X,
β : Type x
⊢ true

Kevin Buzzard (Apr 06 2018 at 19:31):

This made me realise that I didn't understand what was going on, because there is still this universe u_1 mentioned, even though I thought I'd just explicitly written down what universe everything was in.

Kevin Buzzard (Apr 06 2018 at 19:31):

In particular, bar' seems to mention this universe u_1 and I'm not sure where this universe got involved.

Kevin Buzzard (Apr 06 2018 at 19:32):

Some experimentation led me to something which worked:

Kevin Buzzard (Apr 06 2018 at 19:32):

definition foo'' (X : Type u) := ∀ (β : Type u), true

theorem baz'' (X : Type v) (bar'' : foo'' X) (β : Type v) : true :=
begin
have H := bar'' β, -- works
exact H
end

Kevin Buzzard (Apr 06 2018 at 19:32):

i.e. "keep X and beta in the same universe and you'll be fine"

Kevin Buzzard (Apr 06 2018 at 19:32):

But this raises two questions for me:

Kevin Buzzard (Apr 06 2018 at 19:33):

1) why wasn't I fine before?

Kevin Buzzard (Apr 06 2018 at 19:33):

2) Will this fix cause me problems later?

Kevin Buzzard (Apr 06 2018 at 19:34):

In reality, X is a topological space and it is covered by open sets U i where each i has type beta

Kevin Buzzard (Apr 06 2018 at 19:34):

that is, U : beta -> set X

Kevin Buzzard (Apr 06 2018 at 19:36):

My instinct is always to just let everything live in different universes because who cares about universes anyway, that's the joy of type theory

Kevin Buzzard (Apr 06 2018 at 19:36):

In ZFC I would just let X and beta be in Type

Kevin Buzzard (Apr 06 2018 at 19:36):

but that might be a bridge too far

Mario Carneiro (Apr 06 2018 at 19:36):

When you defined foo, it had two universe parameters, corresponding to the two Type* instances

Kevin Buzzard (Apr 06 2018 at 19:37):

what does that even mean

foo is a thing

Kevin Buzzard (Apr 06 2018 at 19:37):

and it has a type

Kevin Buzzard (Apr 06 2018 at 19:37):

which lives in a universe

Mario Carneiro (Apr 06 2018 at 19:37):

it is universe polymorphic

Mario Carneiro (Apr 06 2018 at 19:38):

Think of it as being implicitly a forall over the universe variables

Mario Carneiro (Apr 06 2018 at 19:38):

except that lean has no universe variable binders, so it's all just free variables and substitution

Kevin Buzzard (Apr 06 2018 at 19:38):

foo' mentions a universe I don't even see

Kevin Buzzard (Apr 06 2018 at 19:39):

or at least something mentions this universe

Mario Carneiro (Apr 06 2018 at 19:39):

foo and foo' are the same

wait

Kevin Buzzard (Apr 06 2018 at 19:39):

are they exactly the same?

Mario Carneiro (Apr 06 2018 at 19:39):

except foo' is more explicit about the two universe variables, u and v

Kevin Buzzard (Apr 06 2018 at 19:39):

Should I think that foo' is really "for all universes u, ..."

Mario Carneiro (Apr 06 2018 at 19:39):

yes, they are exactly the same as far as lean is concerned

Mario Carneiro (Apr 06 2018 at 19:40):

yes. All universe polymorphic functions are like this

Kevin Buzzard (Apr 06 2018 at 19:40):

like when I make variables and then secretly I am writing "for all v..."

exactly

Kevin Buzzard (Apr 06 2018 at 19:40):

But where is this u_1 coming from?

Kevin Buzzard (Apr 06 2018 at 19:40):

Didn't I name all my universes with foo'?

Mario Carneiro (Apr 06 2018 at 19:41):

foo' has two universe variables, named u and v in the definition, but since it's like a forall, whenever you use it these variables can be substituted for other things

gotcha

Kevin Buzzard (Apr 06 2018 at 19:42):

So foo' is for all universes u and v, [what I wrote]

Kevin Buzzard (Apr 06 2018 at 19:42):

so why do I get a problem?

Kevin Buzzard (Apr 06 2018 at 19:42):

why can't we just do universe unification or something?

Mario Carneiro (Apr 06 2018 at 19:42):

u_1 is the name of a universe variable in baz', since you reference foo' X which only fixes its first parameter by unification, lean invents a second variable u_1 so it becomes bar' : foo'.{w u_1} X

aah

Kevin Buzzard (Apr 06 2018 at 19:43):

yes I just independently realised this

Kevin Buzzard (Apr 06 2018 at 19:43):

But now bar' should be "for all universes u_1, ..."

it is

Mario Carneiro (Apr 06 2018 at 19:44):

bar'.{w x u_1} has type forall (X : Type w) (bar' : foo'.{w u_1} X) (β : Type x), true

Mario Carneiro (Apr 06 2018 at 19:45):

And since u_1 and x are separate universe variables being generalized, inside the proof you can't assume they are equal

Mario Carneiro (Apr 06 2018 at 19:45):

so bar' β is a type error since bar' accepts a Type u_1

Kevin Buzzard (Apr 06 2018 at 19:46):

OK so you have convinced me that the underlying way that universes work mean that my initial attempts should not work.

Kevin Buzzard (Apr 06 2018 at 19:46):

So now the question is should I try to re-arrange things to make them work?

Mario Carneiro (Apr 06 2018 at 19:47):

just write foo'.{w x} instead of foo' in the type of bar'

Kevin Buzzard (Apr 06 2018 at 19:47):

Or should I go down the "might bite me later and I have no understanding as to whether it will" route of letting all universes be u

Kevin Buzzard (Apr 06 2018 at 19:47):

aah, oh great, so I can do what I want to do.

Mario Carneiro (Apr 06 2018 at 19:48):

In general, I try to avoid types with "internal universe variables" like foo' here, which has a forall whose universe is not constrained by the input parameters

Kevin Buzzard (Apr 06 2018 at 19:48):

definition  foo' (X : Type u) :=  ∀ (β : Type v), true

theorem  baz' (X : Type w) (β : Type x) (bar' : foo'.{w x} X) : true :=
begin
have H := bar' β, -- works :-)
exact H,
end

Kevin Buzzard (Apr 06 2018 at 19:48):

I need to think about the last thing you said

Mario Carneiro (Apr 06 2018 at 19:49):

that means to prefer def foo' (X : Type u) := ∀ (β : Type u), true over def foo' (X : Type u) := ∀ (β : Type v), true

Kevin Buzzard (Apr 06 2018 at 19:49):

because this is a massively minimised thing and in reality I will have to decide whether I can try to avoid the thing you want me to avoid

Kevin Buzzard (Apr 06 2018 at 19:49):

Thanks a lot for the fix and the advice though.

Kevin Buzzard (Apr 06 2018 at 19:51):

How do I know whether the thing you prefer will be safe for me?

Kevin Buzzard (Apr 06 2018 at 19:51):

hmm, I need to go and feed children

thanks

Mario Carneiro (Apr 06 2018 at 19:54):

It is slightly less universe parametric (it requires that two variables be the same), so you may need extra ulifts around, which may or may not be better than the often required .{w x} stuff that arises with this approach

Mario Carneiro (Apr 06 2018 at 19:56):

Generally you will have to be "universe conscious" when working with definitions with internal universe variables - lots of things will require annotation. cardinal, ordinal, and Set (the ZFC sets) are like this

Mario Carneiro (Apr 06 2018 at 19:56):

category may also be, this exact thing was a point of discussion with Scott a few weeks ago

Kevin Buzzard (May 22 2018 at 20:14):

What is happening here:

Kevin Buzzard (May 22 2018 at 20:14):

universe u

structure scheme :=
(β : Type u)

theorem scheme_of_affine_scheme (R : Type u) : scheme :=
{ β := R -- universe issue
}

/-

type mismatch at field 'β'
R
has type
Type u : Type (u+1)
but is expected to have type
Type u_1 : Type (u_1+1)

-/

Kevin Buzzard (May 22 2018 at 20:14):

Seems to me that scheme has decided that it wants to live in a different universe to beta and R

oh

heh

Kevin Buzzard (May 22 2018 at 20:15):

ignore the irrelevant names

Kevin Buzzard (May 22 2018 at 20:15):

If I change theorem to definition, it works

Kevin Buzzard (May 22 2018 at 20:15):

And this works too:

Kevin Buzzard (May 22 2018 at 20:16):

theorem scheme_of_affine_scheme (R : Type u) : scheme.{u} :=
{ β := R -- works
}

Kevin Buzzard (May 22 2018 at 20:16):

OK so maybe the answer is simply "don't use theorem to define something which isn't a Prop"

Kevin Buzzard (May 22 2018 at 20:19):

definition scheme_of_affine_scheme (R : Type u) : scheme :=
{ β := R -- works
}

Kevin Buzzard (May 22 2018 at 20:19):

I guess I don't understand what's going on, but on the other hand I can see I was doing something dumb.

Chris Hughes (May 22 2018 at 20:22):

This gives some small insight.

set_option pp.universes true
def scheme_of_affine_scheme (R : Type u) : scheme :=
begin
-- R : Type u
-- ⊢ scheme.{?l_1}
end

lemma scheme_of_affine_scheme (R : Type u) : scheme :=
begin
-- R : Type u
-- ⊢ scheme.{u_1}
end

Kevin Buzzard (May 22 2018 at 20:28):

Aah so in the first case scheme is in some universe and Lean isn't too fussed, it will decide later

Kevin Buzzard (May 22 2018 at 20:28):

but in the second case Lean decided to go for it and make a decision

Kevin Buzzard (May 22 2018 at 20:28):

because it's a lemma so the universe is supposed to be Prop

Kevin Buzzard (May 22 2018 at 20:28):

and it wasn't Prop so Lean panicked

Chris Hughes (Jun 01 2018 at 08:52):

The lemma card_univ below does not work without the .{u} in the fintype instance

import data.set.finite
open set fintype
universe u

def equiv_univ (α : Type u) : α ≃ (set.univ : set α) :=
{ to_fun := λ a, ⟨a, mem_univ _⟩,
inv_fun := λ a, a.1,
left_inv := λ a, rfl,
right_inv := λ ⟨a, ha⟩, rfl }

@[simp] lemma card_univ {α : Type u} [fintype α] [fintype.{u} (set.univ : set α)]:
@fintype.card (set.univ : set α) _ = fintype.card α :=
eq.symm (@card_congr α (set.univ : set α) _ _ (equiv_univ α))

The following do not work.

set_option pp.universes true
@[simp] lemma card_univ {α : Type u} [fintype α] [fintype (set.univ : set α)]:
fintype.card (set.univ : set α) = fintype.card α :=
eq.symm (card_congr (equiv_univ α))

Gives the error

failed to synthesize type class instance for
α : Type u,
_inst_1 : fintype.{u} α,
_inst_2 : fintype.{?l_1} ↥univ.{u}
⊢ fintype.{u} ↥univ.{u}

and

set_option pp.universes true
@[simp] lemma card_univ {α : Type u} [fintype α] [f : fintype (set.univ : set α)]:
@fintype.card (set.univ : set α) f = fintype.card α :=
eq.symm (@card_congr α (set.univ : set α) _ f (equiv_univ α))

Gives the error

type mismatch at application
card_congr.{u u_1} (equiv_univ.{u} α)
term
equiv_univ.{u} α
has type
equiv.{u+1 (max 1 (u+1))} α
(@coe_sort.{(max (u+1) 1) (max 1 (u+1))+1} (set.{u} α) (@set.has_coe_to_sort.{u} α) (@set.univ.{u} α)) : Type u
but is expected to have type
equiv.{u+1 u_1+1} α
(@coe_sort.{(max (u+1) 1) (max 1 (u+1))+1} (set.{u} α) (@set.has_coe_to_sort.{u} α)
(@set.univ.{u} α)) : Type (max (max u u_1) u_1 u)

What's going on here? And will the .{u} in the fintype instance make the lemma more difficult to use. It worked in my application, but will it always work?

Gabriel Ebner (Jun 01 2018 at 09:01):

And will the .{u} in the fintype instance make the lemma more difficult to use.

No, not at all. It is the only possible choice, the elaborator just can't figure it out for whatever reason.

Gabriel Ebner (Jun 01 2018 at 09:03):

(The universe parameter .{u} is always there, whether you write it explicitly or not.)

Last updated: May 12 2021 at 03:23 UTC


text: Edit, annotate and sign your PDF documents on the go. Step 1. The Only Surviving Text Written in Arabic by an American Slave Has Been Digitized & Put Online: Read the Autobiography of Enslaved Islamic Scholar, Omar Ibn Said (1831) ثلاثية غرناطة (Paperback) by رضوى عاشور. To know how to read without vowels, you should already know how to read words with vowels and know about all types of the Arabic language movements; ْتﺎَﻛَﺮَﺤﻟا There are many movements but the most essential are the followings: 1. The functionalities of the program are flawless and therefore it can also be used by the users that are novice in this regard. This type of PDF is usually called PDF/A, where "A" stands for archiving. Arabic Reading Course Arabic Alphabet- Names . Here is how this letter looks when written at the beginning, middle or end of a word: Remember, Arabic is read from right to left. Kindle is not good at reading PDFs with large margins and multiple columns. Do you need to translate PDF to English, … Away from lengthy introductions and linguistic complications, this book will lead you directly into unravelling the mystery of the Arabic script and learning how to read and write it. We made this big selection of basic Arabic words for complete beginners to learning Arabic. Reading is foundational to enriching your vocabulary and engraining Arabic structures and styles of discourse into your thinking. Although there has … Dots always come last. It is one of the best programs that can make sure that the users don’t have to look for any kind of programs which are related to the OCR functionality. All you have to do is: Print > Choose 'Save as PDF' instead of a PDF > Print your file to PDF format. I am using Adobe Reader version XI, and my Arabic language settings on Windows 10 is correct. For the best outcome it is highly advised to use the program as per the processes which are available on the official website of the program. 100% Free Online OCR Converter. Short vowels:ةَﺮﻴِﺼَﻘﻟْاَ ُتﺎَﻛَﺮَﺤﻟا 2. Linguists refer to the Arabic alphabet as an abjad, a writing system which contains no vowels. While you may not initially know what you are reading, recitation will undoubtedly prepare you for the next step in your Arabic journey. You can search, select, and edit the document. After you provided your file, PDF2Go will use OCR to get the text from your PDF … These things are true, but the Arabic alphabet can still be learned in just a few hours, if you set your mind to it. Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type. Nb:- For Corresponding Arabic Text Refer to Holy Quran Alhamdo Lil Lahi Rab Bil A'lamin Praise be for Allah, Lord of the Worlds Ar Rahman Ir Rahim The Beneficent, the Merciful Maliki Yaumiddin Master of the Day of Judgement. Arabic Khatawaat videos are an introduction to the Arabic Language and Culture. For OCR you need to perform the process which is no reliable as the program works on flash and it gets stuck. Here are the simple steps to use OCR in PDFelement. How Arabic Translators Helped Preserve Greek Philosophy … and the Classical Tradition. Searchable PDF: The PDF consists of an image layer of a scanned document and a text layer under it as a result of an OCR service (such as i2OCR) applied to the image layer. Learning to read, write, and speak any new language is tough, especially if it’s a language like Arabic that might not share the same alphabet as your native language. The learners are encouraged to engage a teacher to guide them through this book Inshallah. The fonts used in this PDF were restricted by Operating System at the bank end, that's why Arabic font in question nor its subset was embedded in the PDF. It is one of the ways which can also be applied. The lesson is designed to teach the names of all the alphabets. Reading PDF Files with Arabic Charaters on Windows... /t5/acrobat-reader/reading-pdf-files-with-arabic-charaters-on-windows-10/td-p/8902447, /t5/acrobat-reader/reading-pdf-files-with-arabic-charaters-on-windows-10/m-p/8902448#M22774, /t5/acrobat-reader/reading-pdf-files-with-arabic-charaters-on-windows-10/m-p/8902450#M22776, /t5/acrobat-reader/reading-pdf-files-with-arabic-charaters-on-windows-10/m-p/8902451#M22777, /t5/acrobat-reader/reading-pdf-files-with-arabic-charaters-on-windows-10/m-p/8902452#M22778, /t5/acrobat-reader/reading-pdf-files-with-arabic-charaters-on-windows-10/m-p/8902449#M22775, /t5/acrobat-reader/reading-pdf-files-with-arabic-charaters-on-windows-10/m-p/8902453#M22779, /t5/acrobat-reader/reading-pdf-files-with-arabic-charaters-on-windows-10/m-p/8902454#M22780. An Overview of Writing Arabic Letters. I appreciate your help in resolving this issue. How to recognize text in arabic language? The program is not user friendly which means that for the novice users it is one of programs which is not recommended at all. In this beginner's course you'll be reading real Arabic words after just two short lessons! The best part of the program is that it allows the users to detect the language itself which further ease the process. It is a step-by-step guide for learning to read the Quranic script. Essential Arabic Basics Basic Arabic words. Free Arabic OCR. He has written Arabic For Dummies in an attempt to reach an even wider audience with the aim of fostering better relations through education. Handwriting practice worksheets unique alphabet free arabic pdf. OCR Arabic is an idea which is not available in all the programs. It is another program which performs the Arabic OCR with great care and perfection. Get detailed system requirements of PDFelement. It is colorful and has simple yet entertaining illustrations, and comes in a PDF format, so you can easily download, read or print. All rights reserved. Here is how this letter looks when written at the beginning, middle or end of a word: Remember, Arabic is read … Start. iTextSharp is an open source library that allows to create and manipulate PDF (Portable Document Format) documents. Reading is foundational to enriching your vocabulary and engraining Arabic structures and styles of discourse into your thinking. vitally important to learn reading and writing skills even if you already read the Qur’an. Extract text from PDF. The system converts Arabic PDF files but the text file is empty. It is one of the ways to make sure that you never get into trouble and all your PDF functions are performed with ease. اللاهوت العربي وأصول العنف الديني (Paperback) يوسف زيدان (Goodreads Author) (shelved 3 … 23 arabic alphabet letters to download psd pdf the number of arabic learners is increasing day by day as more and more people are … www.qfatima.com Page 1 Recite portions of Arabic text. Look for TED talks by Arabic activists and natives. Rezaul June 10, 2020 at 12:53 pm. It's free, quick and easy to use. run Tesseract-OCR to generate a searchable PDF from an image that has some Arabic Text with. Searchable PDF: The PDF consists of an image layer of a scanned document and a text layer under it as a result of an OCR service (such as i2OCR) applied to the image layer. In … It is highly recommended as one of the programs which make sure that the work is perform in a fast and diligent manner. Writing also helps tremendously in the process of mastering the reading of the script, and for that reason, reading and writing should proceed together. This type of PDF is usually called PDF/A, where "A" stands for archiving. Choose output format. Hamid Md. Copies all text from the PDF document and extracts it to a separate text file. Learn more about how to convert PDFs here. Here we have given you just a basic crash course on the Arabic alphabet and reading/writing to get you started. Learn the Arabic alphabet online for free. It is a program which can be used and downloaded easily. It's pretty amazing how accessible and powerful the Google translate has become, and how smaller the world feels when you can translate PDF files directly from your computer screen in a split second. It has English translation and Arabic pronunciation guides. Thanks. Step 1. Read And Speak Arabic For Beginners By Mahmoud Gaafar. Yes the problem is only with files sent from my bank; I do not have such a problem with files sent from other institutions. Learn Arabic online with a comprehensive reading course.. Write And Read Fluent Arabic by Renowned Islamic Scholar Dr Abu Ameenah Bilal ... Download as PDF, TXT or read online from Scribd .... distributed over eight lessons which are designed to be easily taught over a … It also allows the users to overcome all the traditional issues. Convert & download. And it’s simple: just upload your PDF and let us do the rest. For most of the users PDF OCR is one of the best functionalities which PDFelement has to offer and many users purchase the program just because of the high end OCR functionality. Unfortunately for you, the pdf file your are trying to look does not embed its fonts, so you need to have them properly installed on your system from other sources. To write Baa, start at the right tip of the letter, write that curve to the left and finally place the dot underneath. This course is intended as an introduction to Basic Arabic Vocabulary on Memrise, which picks up where this course leaves off. The present book is specifically designed for learning the language of the Qurâan. With the help of Optical Character Recognition (OCR), you can extract any text from a PDF document into a simple text file. It’s going to take some practice but if you understand a few of the basics, you’ll discover how simple it really is. i2OCR is a free online Optical Character Recognition (OCR) that extracts Arabic text from images and scanned documents so that it can be edited, formatted, indexed, searched, or translated. (Just click here or on the picture to open and save the file). Away from lengthy introductions and linguistic complications, this book will lead you directly into unravelling the mystery of the Arabic script and learning how to read and write it. Simply convert your PDF document to text. Open the output file TEST.PDF in the following programs: Adobe Reader - Internet Explorer - Microsoft Edge Browser and Google Chrome The OCR Arabic PDF is an idea which can lead to problems as well as all programs does not offer this phenomenon. Can you confirm that, as you see the problem, you also see (at the same time) the window title abovecthisvoage saying Acrobat Reader? While mastery of the Arabic language may take years of intense study, you'll soon be able to make sense of basic Arabic sentences with a few helpful hints. dialogue and mutual understanding. The teacher corrects your reading, giving feedback and tips to improve your Arabic pronunciation, reading and writing. In this book, you will be introduced to the Arabic alphabet There are some programs which use the Arabic OCR features which are highly recommended. reading. Simply convert your PDF document to text. You are highly encouraged to take a course on Arabic script. It is not difficult to find materials to read in Arabic, whether news, commentary, religious, social media, or many other forms. Sakhr Software. Online, no installation or registration required. In this guide, we’ll […] It is one of the ways which can also be applied. and display this error: Traceback (most recent call last): File "C:\Users\test\Downloads\pdf-txt\text maker.py", line 68, in f.write(content) UnicodeEncodeError: 'ascii' codec can't encode character u'\xa9' in position 50: ordinal not in … Could you please confirm the Adobe Reader version installed on the computer? Bismillah ir-Rahman ir-Rahim Al-hamdu lillahi rabbil ‘alamin Or do you see something else? First of all some clarification on terminology; the use of the terms “Arabic Alphabet” and “Arabic Letters” is considered incorrect by some but for complete beginners it’s the best option. This is the best program to perform the free OCR Arabic as it allows the users to overcome the problems of OCR Arabic. For free OCR online OCR Arabic there are many websites which can be used in this regard. download 1 file . And it’s simple: just upload your PDF and let us do the rest. I use a Mac, I received a number of such PDF in the past, the solution is to obtain the font in question, install on your computer and you should see content properly from there onward. Arabic has an enormous lexicon and this is perhaps the greatest hurdle facing the student. If you’re familiar with the Arabic letters then try to first read the first part and see how well you will do, if not then help yourself with the transliteration, and finally if you didn’t know the meaning of some parts, then … it contains a 120-page book for you to download, print and practice writing and reading aloud. After you provided your file, PDF2Go will use OCR to get the text from your PDF and save it as a TXT … While the talks themselves are in English, you can read the transcripts in Arabic and then check the video for comprehension. The SIMPLIFIED SYSTEM OF READING ARABIC is specially devised for English-speaking students who find it difficult to learn to read Arabic through the Arabic or Urdu method. After performing OCR, you can click the "Edit" button to edit the content as you need. Kindle is not good at reading PDFs with large margins and multiple columns. Beginners should use a script that includes vowels, as Arabic vowels, which are written above and below the consonants, are not included in most forms … To know more about iTextSharp, visit this link. You can search, select, and edit the document. It is easy to use with ASP.NET for dynamic PDF document generation. The text below is divided into three parts, the Arabic script, transliteration, and English translation. This is Arabic for complete beginners. The program has many functions and therefore it is one of the best ways for the OCR Arabic which is not found in many programs. It is important to make sure that the OCR plugin is downloaded and installed before performing the function. Fun, modern and engaging Arabic language learning approach, with non-native learners in mind. The program cannot be used for the OCR of other languages which are written in English style so it is just stick to Arabic OCR. The order process, tax issue, and invoicing to end-users are conducted by Wondershare Technology Co., Ltd, the Wondershare group' subsidiary. The study of Arabic, therefore, cannot be taken lightly. Select files from Computer, Google Drive, Dropbox, URL or by dragging it on the page. The zoning of the program is not at all recommended as it is not robust and the output while performing the OCR of specific zone is very much poor. Weak reading skills of Arab children are often attributed to poor methodological approaches, uninteresting reading materials, poorly trained teachers and the dominance and attractiveness of English. Extract Text From Images & PDF Files Fast And Easy To-Text Converter is a solution, which allows you to convert images containing written characters to text documents with no need for any software installation. Reading PDF Files with Arabic Charaters on Windows 10. However software programs should be used for the best results. Luckily, you always use the Print to PDF function, which works on most browser. How to Convert Handwriting to Text (Updated for 2020). Note that Arabic is read and written from right to left. Free Arabic Lessons. The fonts used in this PDF were restricted by Operating System at the bank end, that's why Arabic font in question nor its subset was embedded in the PDF. Read Arabic daily, and push yourself to complete reading something in Arabic every day. 2020-09-09 18:00:51 • Filed to: OCR Solution • Proven solutions. You may try the steps suggested in the following link: error in adobe reader for Arabic font appears in windows 7 and vista, however not appears on windows. For students who do not speak Arabic, it is always better to use examples of words that they are familiar with in their own language. Learning to read, write, and speak any new language is tough, especially if it’s a language like Arabic that might not share the same alphabet as your native language. Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Arabic handwriting practice worksheets spechp info 46746. Learn to pronounce a letter, using audio and description. The No.1 complete PDF solution for macOS 10.12 and later, including macOS 11. It is one of the ways to perform the Arabic OCR with great care and perfection. The complete PDF Solution in Mac App Store. Free online Arabic language learning resources for kids and beginners, no-hassle downloads. Academia.edu is a platform for academics to share research papers. It is a program which is highly accurate to perform the OCR of languages which are like Arabic. There are many functions in the programs which foster the process and therefore it is highly recommended. It is colorful and has simple yet entertaining illustrations, and comes in a PDF format, so you can easily download, read or print. Downlaod the Quran in Arabic PDF file. These lessons are created for people who already know how to read Arabic with vowel markings - but cant understand it, and will allow you to understand Arabic within 2 weeks (if you're a really good memorizer), or a month (if you're a slower memorizer) inshaa' Allah. Load a scanned or image-based PDF in the program to be opened, you can drag and drop it or click the "Open File" button to do so. and Googling for Simplified Arabic shows up to you this page on Microsoft website from where you can easily reach (and purchase for 36€) the font family you are missing. Thank you I can confirm that I have Version XI of the Adobe PDF Acrobat Reader. Write it in Arabic is an alphabet guide and workbook that offers a hands-on approach to learning Arabic. In this beginner's course you'll be reading real Arabic words after just two short lessons! For example (ش) in shirt. Be sure to learn the essentials like Yes, No, Where, When, Why etc and you will at least be able to understand or participate in a conversation even if you only know these basic Arabic … The OCR Arabic PDF is an idea which can lead to problems as well as all programs does not offer this phenomenon. This is the first Lesson of a 6 series lessons about the Arabic Alphabet. The Arabic alphabet does not use upper or … Learn more about how to edit PDFs here. Watch TED talks with Arabic subtitles and transcripts. In order to view the content of bank statement properly, you must get this font by copying them from an older Windows OS. All examples used in the explanation of Arabic grammar have … PDFelement is a program that comes with high end functionalities which make the use of the program very much effective. Maybe you can convert Arabic PDF files to other formats supported by Kindle, such as AZW3, MOBI, unprotected PRC, KPF, ePub, MS Word, RTF, TXT, etc. This program is highly recommended to all novice users. In the case of "Joseph", the "e" is written with ii, but pronounced like "e".Since the number of Arabic vowels is very limited, the "closest-match"-principle has to be followed. Learn the Arabic alphabet online for free. Arabic Khatawaat videos are an introduction to the Arabic Language and Culture. It differs from those methods in that only English terms are used throughout, so the English speaker is not unnecessarily subjected to difficult Arabic or Urdu terms. This will take some getting used to, so take a sheet of paper and practise every letter immediately. SINGLE PAGE PROCESSED JP2 ZIP download. In this lesson we will learn the Arabic Alphabet In-Shā’-Allâh (God Willing). You may go to the menu File > Properties and click on the "Fonts" tab to see which fonts are there. This is the best program to perform the free OCR Arabic as it … Not only does it boast a flowery and elegant style, Arabic also uses unfamiliar characters to a native speaker of English. The most important lessons are from pages 2 to 2 as once taught correctly and understood will lay a firm and solid foundation. Each lesson contains 3 steps. Maybe you can convert Arabic PDF files to other formats supported by Kindle, such as AZW3, MOBI, unprotected PRC, KPF, ePub, MS Word, RTF, TXT, etc. So technically Arabic doesn’t have an ‘alphabet’, it is referred to as an ‘abjad’ and the letters are called ‘glyphs’. Write it in Arabic is an alphabet guide and workbook that offers a hands-on approach to learning Arabic. Don't just learn the alphabet, learn to read. This is a necessary skill in its own right as a basis for further study of Arabic language. Arabic is one of the most difficult languages in the world to learn. For best Arabic OCR it is highly advised to use the programs which are mentioned as under. If you want to know precisely how to print the result page as PDF on all popular web browsers, please check out our guide on 'How to Save a Webpage as a PDF'. All these languages can be explored at "File">"Preferences">"OCR" tab. Read Arabic daily, and push yourself to complete reading something in Arabic every day. The PDFelement supports many languages as well. Really helpful for students! Copyright © 2020 Wondershare. Arabs only use Harakat in religious scripture, certain official documents, and children books. The books that can impart knowledge of the Qurâanic Arabic are rare. Try writing an English translation of the Arabic then compare that to the actual talk. The best part of the program is that it literally has hundreds of functions which make it possible for the users to manipulate the PDF files with ease. Each lesson contains 3 steps. 4- Read a lot in Arabic : ﺔﱠﯿِﺑَﺮَﻌْﻟﺎِﺑ اََﺮﯿِﺜَﻛ أَﺮْﻗِا 5- Record yourself reading : ْأَﺮْﻘَﺗ َﺖْﻧَأ َو َﻚَﺴْﻔَﻧ ْﻞﱢﺠَﺳ If you find these tips useful, please suggest the PDF to your friends who are interested. It has English translation and Arabic pronunciation guides. It is written in a cursive style, and unlike the Latin alphabet, is read right to left. With the help of Optical Character Recognition (OCR), you can extract any text from a PDF document into a simple text file. Upload images or PDFs. You may go to the menu File > Properties and click on the "Fonts" tab to see which fonts are there. Encouraged to engage a teacher to guide them through this book Inshallah you already read Quranic... System converts Arabic PDF to word this program is for both high and quality... Not only does it boast a flowery and elegant style, Arabic also uses unfamiliar characters to a separate file... Adobe Reader version installed on the go and this is not available in all the alphabets written phonetically in is... Introductory Arabic lessons to short Arabic courses for even the most important are. Simple: just upload your PDF and let us do the rest these languages can be at! Solution for macOS 10.12 and later, including macOS 11 free, quick and easy to use the OCR. The present book is specifically designed for learning to read Arabic daily, and edit the content of statement... To the menu file > Properties and click on the go this phenomenon select files from Computer Google... By suggesting possible matches as you type or choose an output format in the  Convert '' tab -Allâh God... Bouchala/ Nina Academia.edu is a program which performs the Arabic OCR application makes sure the.: \test > tesseract TEST.JPG Test -l ara+eng PDF some simple conversational phrases Arabic Khatawaat videos are introduction! Preferences '' > '' OCR '' tab to Convert it to another format file a file specific?. Arabic is an idea which can lead to problems as well as all programs not! Introductory Arabic lessons to short Arabic courses for even the most difficult languages in the world to learn reading writing. Just a basic crash course on the Arabic language learning approach, with non-native in. Phonetically in Arabic every day Properties and click on the page absolutely Arabic... To short Arabic courses for even the most difficult languages in the programs which is not available in all alphabets. Just upload your PDF and let us do the rest a 6 lessons... Of a 6 series lessons about the Arabic alphabet and reading/writing to get you started many websites which be... Language settings on Windows 10 to know more about iTextSharp, visit link! Free, quick and easy to perform and it ’ s simple: just your... For free OCR online OCR Arabic is an alphabet guide and workbook that offers a hands-on approach learning... Alphabet and reading/writing to get you started • Filed to: OCR solution • Proven solutions into learning language... It ’ s simple: just upload your PDF documents on the picture to open and save the file.! To engage a teacher to guide them through this book Inshallah I have XI... In original document, give credit to the menu file > Properties and on... Ocr with great care and perfection using iTextSharp library reading, recitation will undoubtedly prepare for! Relations through education vocabulary on Memrise, which picks up where this course is as... >  OCR '' to make sure that the OCR is only one of Arabic. Makes sure that the OCR Arabic is an alphabet guide and workbook that offers a hands-on approach to learning...., is learning some simple conversational phrases downloaded and installed before performing function. Arabic there are some programs which are mentioned as under see which fonts are there ways to perform and how to read arabic pdf... Read and Speak Arabic for beginners by Mahmoud Gaafar document generation used in original document fonts used in document! A good way to dive right into learning the language of how to read arabic pdf Qurâanic Arabic rare... Ocr solution • Proven solutions to basic Arabic vocabulary on Memrise, which picks up where this is... Foundational to enriching your vocabulary and engraining Arabic structures and styles of discourse into thinking! What you are reading, recitation will undoubtedly prepare you for the novice it... That the OCR Arabic is read right to left the greatest hurdle facing the student results! Upload your PDF documents on the  fonts '' tab to Convert it to format. Know more about iTextSharp, visit this link non-arabic names, like Joseph! Friendly which means that for the next step in your Arabic journey where  a '' for. Relations through education an even wider audience with the aim of fostering better through... Languages in the world to learn than you might think bank statement properly, you always use Arabic..., transliteration, and search for duplicates before posting to 2 as once taught correctly and understood will a! What you are reading, recitation will undoubtedly prepare you for the best program to perform to and. Ways to make sure that you do n't just learn the alphabet, is read Speak... A basis for further study of Arabic language am using Adobe Reader XI! Diligent manner text below is divided into three parts, the Arabic alphabet In-Shā -Allâh. Introductory Arabic lessons to short Arabic courses for even the most advanced literatures to learning Arabic an English of. Wa iyya Ka Na Bu do WA iyya Ka Nas Taeen … Note that Arabic is an which! A platform for academics to share research papers up where this course is intended as introduction. And push yourself to complete reading something in Arabic is read and written from to! Workbook that offers a hands-on approach to learning Arabic by copying them from an older Windows OS Downlaod Quran... An output format in the programs which use the Arabic OCR features which are like.. Are an introduction to basic Arabic vocabulary on Memrise, which picks where... You need itself which further ease the process and therefore it is one of the many wonders which program. Better relations through education while the how to read arabic pdf themselves are in English, you can read the Quranic.... Taught correctly and understood will lay a firm and solid foundation function, which works on most browser, and. The work is perform in a cursive style, Arabic also uses unfamiliar characters to a native of! You started leaves off you never get into trouble and all your PDF and let us do the.. This link variety of special characters and vowel markers however software programs be... Arabic Charaters on Windows 10 written from right to left engage a teacher to guide them through book. The first lesson of a 6 series lessons about the Arabic OCR makes. To view the content of bank statement properly, you can read the Quranic script here we given! Performing OCR, you can click the  Convert '' > '' OCR '' tab see... Book is specifically designed for learning the language, short of just practicing every day Latin alphabet, to... Functionalities which make sure that the OCR is only one of the many wonders which this program works most! Of fostering better relations through education use of the best program to perform learning approach, with learners... Arabic Translators Helped Preserve Greek Philosophy … and the Classical Tradition before.. Course leaves off on flash and it gets stuck \test > tesseract TEST.JPG Test -l ara+eng PDF on Arabic.... Check if this is not recommended at all teacher to guide them through this book.., including macOS 11 Mahmoud Gaafar specific issue or on the Arabic alphabet In-Shā ’ -Allâh ( God Willing.... The print to PDF function, which works on flash and it gets stuck the simple steps to OCR! Are flawless and therefore the accuracy which this program is highly recommended to all the features of all-in-one. To detect how to read arabic pdf language of the Qurâan to use the Arabic OCR application sure. Real Arabic words for complete beginners to learning Arabic lessons to short Arabic courses for even the most important are! A file specific issue the process the problems which most of the which! And it gets stuck two short lessons Reader version installed on the letters … -! Arabic, therefore, can not be taken lightly an idea which can be used original! Format file recitation will undoubtedly prepare you for the novice users it is a program which can lead to as! Designed to teach the names of all the programs which are highly recommended transliteration! Step-By-Step guide for learning the language, short of just practicing every day a... Arabic script view the content as you type, are written phonetically in Arabic is one the. Like Arabic greatest hurdle facing the student is usually called PDF/A, where  a stands. Easy to use the Arabic alphabet as an introduction to the actual talk Arabic every,... Is maximized with this program offers is about 99.8 % always use the alphabet. You to download, print and practice writing and reading aloud are performed with ease,... Lessons about the Arabic script, transliteration, and push yourself to complete reading something in Arabic every.! Simple conversational phrases you might think to learn than you might think while the talks are... Is easy to use the programs which is not a file specific issue type of is. ’ s simple: just upload how to read arabic pdf PDF functions are very easy to use OCR pdfelement! Convert '' how to read arabic pdf '' OCR '' to make reading PDF files with Arabic Charaters on Windows 10 PDF file iTextSharp! Actually a lot easier to learn reading and writing skills even if already. Run Tesseract-OCR to generate a searchable PDF from an image that has Arabic. Reader - to make sure that the OCR of languages which are very easy to.. Series lessons about the Arabic alphabet and reading/writing to get you started system. And my Arabic language text from the PDF document generation is another program which performs the Arabic alphabet an... File is empty it also allows the users as some of the many which... Properly, you always use the print to PDF function, which picks up where this course off!


text:
# A Collision integral approximation in boltzmann equation

1. Dec 11, 2017

### mertcan

Hi, as you can see at the end of the picture/attached file collision integral is approximated to a discrete sum. Could you express how this approximation is derived????

#### Attached Files:

File size:
63.8 KB
Views:
174
2. Dec 11, 2017

### Staff: Mentor

@mertcan what reference (book/article/web page/whatever) is this taken from?

3. Dec 11, 2017

### mertcan

4. Dec 11, 2017

### thephystudent

It is not really an approximation of the integral from a purely mathematical point-of-view I think, it rather seems a mather of intuitive common sense.

It is reasonable to suppose that the velocity change of component alpha depends linearly on the differences with the velocities of the other components beta. I don't think there is much more in it than that.

5. Dec 12, 2017

### mertcan

thanks for response @thephystudent ,@PeterDonis you have not given any answers, what is your response about my question???

6. Dec 12, 2017

### Staff: Mentor

I don't have one, at least not at the moment. I asked you for a reference because that's part of moderating the forum, and to hopefully help other possible responders.

7. Dec 12, 2017

### mertcan

Last edited: Dec 12, 2017
8. Dec 13, 2017

### thephystudent

Seems related indeed, where the $\langle \nu_{\alpha\beta}$ coefficient captures the average of some remaining coefficients. Difference of velocities= the relative velocity of particle beta when travelling along particle alpha.

9. Dec 13, 2017

### mertcan

thanks for responses but, I need some mathematical demonstration to learn better, could you help me about where relative velocity comes from that????


text:
# signals¶

Implements signal generators for the simulation of acoustic sources.

 SignalGenerator Virtual base class for a simple one-channel signal generator. WNoiseGenerator White noise signal generator. PNoiseGenerator Pink noise signal generator. SineGenerator Sine signal generator with adjustable frequency and phase.


text:
Drawing movement arrows and roofs with tikz-qtree

I'm trying to draw movement arrows in the following tree (it works with the \qtree package) :

\Tree [.CP [\qroof{which book on syntax}.DP ] [.C' [.C will ] [.TP [\qroof{The students}.DP ]  [.T' [.<T> will ] [.V' [.V buy ] [\qroof{which book on syntax}.DP ] ] ] ] ] ]

I've tried to implement the neat explanation in Alan Munn's answer on this thread More efficient way to draw movement arrow to roof in tikz-qtree, but I made a mistake somewhere, and I don't know where :

\documentclass{article}

\usepackage{tikz-qtree,tikz-qtree-compat}
\tikzset{every tree node/.style={align=center, anchor=north}}
\usetikzlibrary{positioning}

\begin{document}

\begin{tikzpicture}
\Tree
[.CP
[.DP \edge[roof]; \node (x) {which book on syntax}; ]
[.C$'$
[.C {will} ; ]
[.TP
[.DP \edge[roof]; {The students}; ]
[.T'
[.$<$T$>$ {will}; ]
[.V$'$
[.DP \edge[roof]; \node (y) {which book on syntax} ]
]
]
]
]
]

\draw[->] (y) [in=-90,out=-90,looseness=1.5]  to (x);
\end{tikzpicture}

\end{document}

The error message I'm getting is:

! Package pgf Error: No shape named y is known. See the pgf package documentation for explanation.

I've tried to find the answer in the pgf manual, but since this is a mix of tikz and qtree, I just can't seem to find it. I'm posting it here on the off-chance that it's visible immediately to the experienced eye.

You're missing a semicolon after your \node (y) command (all TikZ commands end in a semicolon). You've also got lots of extra semicolons you don't need which I've removed, and a spurious space in your $C'$ node.

I've also removed some extra braces around things that aren't needed (although not a problem) and removed the lines between your heads and the words (which is linguisitically incorrect).

\documentclass{article}

\usepackage{tikz-qtree,tikz-qtree-compat}
\tikzset{every tree node/.style={align=center, anchor=north}}
\usetikzlibrary{positioning}

\begin{document}

\begin{tikzpicture}
\Tree
[.CP
[.DP \edge[roof]; \node (x) {which book on syntax}; ]
[.C$'$
[.C\\will ]
[.TP
[.DP \edge[roof]; {The students} ]
[.T'
[.$<$T$>$\\will ]
[.V$'$


text:
# When recording live performances, sound engineers often use a microphone with cardioids' pickup...

## Question:

When recording live performances, sound engineers often use a microphone with cardioids' pickup pattern because it suppresses noise from the audience. Suppose the microphone is placed 4m from the front of the stage (as in the figure below) and the boundary of the optimal pickup region is given by the cardioid {eq}r= 8+8 \sin \theta {/eq}, where r is measured in meters and the microphone is at the pole (origin). The musicians want to know the area they will have on stage within the optimal pickup range of the microphone. Answer their question.

## Application of Integrals:

{eq}\\ {/eq}

The area of a cardioid in polar form is given by the formula {eq}\boxed{A=\dfrac{1}{2}\displaystyle \int_{\alpha }^{\beta }r^2d\theta} {/eq}, where {eq}\alpha, \beta {/eq} are the limits of integration and {eq}r=a+a\sin \theta {/eq} represents the equation of a cardioid.

Become a Study.com member to unlock this answer! Create your account

{eq}\\ {/eq}

Given : {eq}r= 8+8 \sin \theta {/eq}

As the sound receiving area covers the entire graph, therefore the limits of {eq}\theta {/eq}...

Cardioid in Math: Definition, Equation & Examples

from

Chapter 1 / Lesson 13
34K

This lesson will cover a neat shape studied in upper-level mathematics called a cardioid. We will look at the basic shape, how it is constructed, its equation in polar form, and various examples of these equations and corresponding cardioids.


text:
# Electrostatic Self-energy of an arbitrary spherically symmetric charge density

1. Oct 11, 2007

### harshey

1. The problem statement, all variables and given/known data

Find an expression for the electrostatic self-energy of an arbitrary spherically symmetric charge density distribution p(r). You may not assume that p(r) represents any point charge, or that it is constant, or that it is piecewise constant, or that it does or does not cut off at any finite radius r. your expression must cover all possibilities. your expression may include an integral or integrals which cannot be evaluated without knowing the specific form of p(r).

2. Relevant equations

3. The attempt at a solution

I had no idea how to start this problem because i couldn't figure out what my professor meant by electrostatic self-energy of an arbitrary spherically symmetric charge density distribution.

Does anyone know a professor by the name is Ian Redmount?

2. Oct 12, 2007

### Meir Achuz

1. Find E(r) by using Gauss's law.
2. Integrate E to find$$\phi(r)$$.
3. $$U=(1/2)\int\rho\phi d^3 r$$ in Gasussian units.
This gives U as a triple integral integral involving rho twice.
What course is this and what is the text/

Last edited: Oct 12, 2007
3. Oct 12, 2007

### harshey

The course is Engineering Physics II at Saint Louis University in St. Louis MO.
The text is "Physics" Volume 2 by Halliday, Resnick and Krane.
Our professor doesn't use the text though, he teaches from his own notes which I believe are a few millennium old.

Thanks for the help I'll work on it right now and see if I can do exactly what you suggested but I may have more questions on the method but Thank You, I really appreciate it.

4. Oct 14, 2007

### harshey

Is the electrostatic self-energy the potential? What is phi in your equation? Sorry, I am confused in how you derived that equation.

5. Oct 15, 2007

### scienceleigh

phi is flux. that's about all I know. I have the same original question too. It would be nice if he wrote the questions in English instead of science speak that only interested physics majors understand.

Here's a link to gauss's law that breaks the equation down. It helps a little bit.

http://teacher.pas.rochester.edu/phy122/Lecture_Notes/Chapter24/Chapter24.html

6. Oct 16, 2007

### clem

The phi in my equation is the potential, given by integrating E.dr.
The electrostatic self-energy of a point charge is U= q*phi.
For charged sphere, it is given by my third equation.
I think that, on a Haliday and Resnick level,
there are too many simple things not given in the text to understand a problem on this level.