text:
Public Group

# noobish attempt at text-based adventure...

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

## Recommended Posts

I've been coding this text-based game in C++ for the past hour and a half. So far, it goes like this: -There are four rooms... ******4 ******| *3--2--1 -Rooms 3 and 4 can be inspected -You can exit only from room 1 The code:
#include <iostream>
using namespace std;

#define PRINT(x)	cout << (x) << endl;

int main()
{
short choice=0;
short number=1;
short room3insp=0;
short room4insp=0;
char text[]="Welcome!";
char one[]="Room one.  1 for west, 2 for north, 3 to exit.";
char two[]="Room two.  1 for west, 2 for east.";
char three[]="Room three.  1 for east, 2 to inspect.";
char four[]="Room four.  1 for south, 2 to inspect.";
char exit[]="Exiting...";
char inspected[]="This room has been inspected.";
char uninspect[]="This room is uninspected.";
char invalid[]="Invalid choice.  Try again.";

PRINT(text);
while(number>0 || number<6)
{
if(number==1)
{
while(choice>0 || choice<4)
{
PRINT(one);
cin>>choice;
if(choice==1)
{
number=2;
break;
}
if(choice==2)
{
number=4;
break;
}
if(choice==3)
{
number=5;
break;
}
else PRINT(invalid);
}
}
if(number==2)
{
while(choice>0 || choice<3)
{
PRINT(two);
cin>>choice;
if(choice==1)
{
number=3;
break;
}
if(choice==2)
{
number=1;
break;
}
else PRINT(invalid);
}
}
if(number==3)
{
while(choice>0 || choice<3)
{
PRINT(three);
if(room3insp==0)
PRINT(uninspect);
if(room3insp!=0)
PRINT(inspected);
cin>>choice;
if(choice==1)
{
number=2;
break;
}
if(choice==2)
{
room3insp=1;
break;
}
else PRINT(invalid);
}
}
if(number==4)
{
while(choice>0 || choice<3)
{
PRINT(four);
if(room4insp==0)
PRINT(uninspect);
if(room4insp!=0)
PRINT(inspected);
cin>>choice;
if(choice==1)
{
number=1;
break;
}
if(choice==2)
{
room4insp=1;
break;
}
else PRINT(invalid);
}
}
if(number==5)
{
PRINT(exit);
break;
}

}
return 0;
}

I plan to add a feature to tell how many moves have been made between rooms and a simple puzzle next. I tried using switch statements and functions, but I forgot some syntax (thanks in part to a hard semester of Motorola 68000 Assembly class). My questions for now are: 1. What can I do to compact the code? 2. When entering either +32768 or higher, or -32768 or lower, the loop goes on endlessly. Why does this happen? 3. Seeing as that I may experiment more with C# soon, would this code be easier to implement there than in C++?

##### Share on other sites
A quick question in return : are you purposefully planning in C, or are you happy to use C++?

Although I've just seen the headers you're using, and the 'using' statement - seems to indicate C++.

You're using char arrays a lot - have a look into std::string from the STL library - it may help to avoid possible problems in the future.

Quote:
 1. What can I do to compact the code?

Well, I'd say you need to compartmentalise your code at some point - either using functions or classes. A simple class to add might be a room class. A quick glance suggests that a room has the following properties:

A description.
A list of possible options, each with an integer key for input.
Which room each input key would take you to.
A bool flag for whether the room can be inspected.

Building this into a class would allow you to learn about classes (doh) and possibly std::map or std::vector (thinking of implementations off the top of my head).

This should allow easier addition of rooms to your program (including when you get into loading them from a file), and help remove that monster if/else clause you have. Have a think about how to do it, and if you have more questions then come back with some implementation questions.

Quote:
 When entering either +32768 or higher, or -32768 or lower, the loop goes on endlessly. Why does this happen?

Sorry - haven't had time to answer this, and my wife is just dishing up some chilli - will have a look after tea and see if anyone else has answered it.

Quote:
 Seeing as that I may experiment more with C# soon, would this code be easier to implement there than in C++?

Given where I suspect you are in your development (based upon this question), I would say stick with one language for the moment and learn the basics of programming. One language means that you have less to think about, and when you've learnt one, transfer to another is a lot easier.

HTH,
Jim.

##### Share on other sites
When entering either +32768 or higher, or -32768 or lower, the loop goes on endlessly. Why does this happen?

Overflow.

signed integers have 15 bits (16th is the sign bit, that makes it a + or a - number).

2^15 = 32768

When you try to shove a bigger number in there, it can't hold it. You end up with overflow. It basically only holds the last 16 bits of the number in that memory location,

If choise > 0 || choise < 4
you should have an && here. the or lets you get away with any number (negitive numbers are less then 4, and a couple of trillion is greater then 0)

Now because the number is not 1,2,3,4, and 5, it just keeps looping. The value doesn't change, so it loops forever.

From,
Nice coder

##### Share on other sites
You should check out Inform, by Graham Nelson, and read up on the Z-Machine, as developed by Infocom. The former is an Object Oriented language that compiles to bytecode for the latter, an interpreter that runs text adventures on any platform.

It's great stuff, and you can learn a lot about development in general by working in Inform.

##### Share on other sites
Quote:
 Original post by obi-wan shinobiI plan to add a feature to tell how many moves have been made between rooms and a simple puzzle next. I tried using switch statements and functions, but I forgot some syntax (thanks in part to a hard semester of Motorola 68000 Assembly class).

Judging from what I see, you should really look in to steering your education towards higher-level programming. I don't doubt you have a solid grasp of how the machine works, but you won't learn about data structures and algorithms that way (because it takes too long to hand-code them in assembly even if you do know what you're doing).

Quote:
 My questions for now are:1. What can I do to compact the code?

Develop some data structures in order to exploit the parallel behaviour. In C++ you get access to this wonderful thing called a "class", which allows you to associate code behaviour with a piece of data. Conceptually you so far have one real abstraction, "room". A room has a description, and some number of links to other rooms. Also, it may be inspected or uninspected. (I assume you really want all the rooms to be inspectable. If not, you could add extra state to represent that.)

Room text can be represented easily with arrays of characters, as you are well aware. But this is really a hack; characters are really numeric types, your "strings" are null-terminated (some operations are actually inefficient because you don't have direct access to a length count; plus you can't have 0 in the middle of your data), and they're prone to all kinds of coding errors that ultimately result in segmentation faults. Enter std::string.

Links can be represented easily by pointers - a familiar concept for you I'm sure. We don't have the same number of links for each room, but there are simple ways around that. The bare-bones way would be to just have a pointer to the list of pointers, and treat it like a C-style string. Of course, after a semester of 68k assembly you should appreciate the value of not doing things the hard way :) Thus we introduce your friend and mine, std::vector. We get:

class Room {  private:  string name;  bool inspected;  vector<Room *> neighbours;}

OK, so that's what the room data looks like. Notice that vectors are templated; for container types like vectors, we can read the angle brackets as "of" - so this is a "vector of pointers to Room".

Now we need to specify some behaviour for Rooms. There are at least four things we need to be able to do:

- Create a new Room. It will be uninspected, and a name will be provided by the client code. It will start out with no links...

- Tell the main game loop what its description is, and whether the room has been inspected.

- Handle input from the user and determine the user's current (new) Room.

So now we go back to the class definition, and add appropriate signatures for those methods... I'll wait for your questions before I try to explain them further ;)

class Room {  private:  std::string name;  bool inspected;  std::vector<Room *> neighbours;  public:  Room(std::string name) : name(name), inspected(false), neighbours(std::vector<Room *>>()) {}  void linkTo(const Room& other);  std::string description();  Room* processInput(int usersChoice);}

and then for organization's sake, we put this into a header file, "room.h". In the corresponding implementation file "room.cpp", we implement those methods:

#include "Room.h"using namespace std;// The "constructor" was already implemented; there is no initialization we// have to do except just setting the field values.void Room::linkTo(const Room& other) {  // Add a Room* to the vector which points at the input room.  neighbours.push_back(&other);  // The "neighbours" here is that belonging to the 'current object'.  // Member function calls always have an object associated with them, like  // I was talking about. Actually, you've been using this all along...  // e.g. 'cout << "hi"' is really cout.operator<<("hi"), which is calling the  // iostream method operator<< on the input "hi" with associated object cout.  // Since neighbours is a vector, it will automatically resize itself to hold  // anything you might push_back() on the end.}std::string description() {  // Create a string from the room description and inspection state.  string result = name + "\n";  if (inspected) result += "This room has been inspected.";  else result += "This room is uninspected.";  return result;  // See how beautifully it reads? No messing around with strcat() here...  // Left as an exercise: Modify this so that it will look at the "neighbours"  // vector and add information about what directions are valid.  // You may find you want to associate a name with each "direction". Of course,  // you can't just add a "direction" string to each Room, because you could  // enter a room in several ways. The name needs to be associated with the  // link itself.  // Fortunately the standard library provides a cheap hack for handling simple  // pairings like this: look up std::pair. You would end up with a  // std::vector<std::pair<std::string, Room*> >. :)  // (That space is important - trust me.)}Room* processInput(int usersChoice) {  // Given an input choice, possibly adjust the value of 'inspected',  // and return the Room* which points to the user's new room.  // Left as an exercise ;) But here are some hints:  // 1) "this" is a pointer to the current Room (which you can use if the action  // doesn't result in the player moving).  // 2) You can access elements in the "neighbours" vector as if it were an  // array (except that arrays don't automatically resize).  // 3) You are strongly recommended to always use the same numeric value for  // "inspect", to simplify the logic. All Rooms should behave in the same  // fundamental way; that's part of the abstraction.  // 4) Try to do some arithmetic on the choice in order to get an array index.  // 5) Return NULL to indicate that the user has exited and is in "no room".}

Now we have a properly organized pair of source files to represent the Room class. You might think of them together as the "Room module". Now we can use it from the main program:

#include "Room.h"// We need that in order to let the main program know what Rooms are. Note we// *do not* include the Room.cpp! Roughly, .h files are for interface// description (except really simple things, and no actual variable storage)// and .cpp files are for implementation.#include <iostream>using namespace std;// We don't need to use the preprocessor for things like this any more in C++:template<typename T>inline void print(const T& x) {  cout << x << endl;}int getInput(const string& prompt) {  // Left as an exercise; see my answer to your other questions.}int main() {  // Create the rooms. We invoke that special "constructor" method, and  // initialize rooms with given names.  // The string literals are implicitly converted to std::strings. AFAIK...  // (If it doesn't work, it's easy to fix; just make use of the std::string  // constructor that accepts a char* :)  Room a("Room one."),       b("Room two."),       c("Room three."),       d("Room four.");  // Make the links between rooms.  a.linkTo(b); // 1->2  a.linkTo(d); // 1->4  // etc. for the other links. Looks nice and readable yes?  // And now we can add the rest of the variables we need...  Room* current = a; // the player starts in room 1.  // Oh, that's all we need. Heh. :)  // Now we do our main game loop.  print("Welcome!");  while(current) {     // We will indicate that the user has exited by returning a NULL pointer.    // Inform the user of current location, inspection status, and options    print(current->description()); // note the -> because we have a pointer    // Get input, and let the current Room update itself and tell us where    // the user ends up.    current = current->processInput(getInput("Your command?"));    // For example.     // Alternatively, you could make getInput into a Room method, or build it    // into processInput... however, it's usually best to keep IO stuff    // separated out from your objects as best you can.    // The problem is that the main game loop doesn't know how many exits are    // in the current room, so it can't validate the input very well. There are    // a few ways around that; I'll let you think about it. :)  }  print("Exiting...");}

Quote:
 2. When entering either +32768 or higher, or -32768 or lower, the loop goes on endlessly. Why does this happen?

The previous post citing overflow was on the right track, but missed the point.

When you attempt to read a number from cin with the >> operator, the beginning of the stream has to have some decimal digits, representing a number that will fit within that data type. If the input isn't valid (either the number is too big, or it's not actually a number - go on, try your program with input "hi"), then:
- A "failed" flag is set within the cin object; this must be reset before you can read any more.
- The invalid input is not consumed; it remains there at the beginning of the stream.

Thus, to recover from this (in a command-line environment), you need to:
- "reset" the fail flag with cin.clear().
- Ignore the current line of input (so that the user will have to input a new line of input): cin.ignore(numeric_limits<streamsize>::max(),'\n');

The .ignore() method requests a maximum number of characters to ignore (here we set it as big as possible. You could also set it in terms of the currently available amount of data: 'cin.rdbuf->in_avail()' - I probably got that a bit wrong though), and the character to ignore up until (a new line).

And then you can loop to try again.

See more here.

Quote:
 3. Seeing as that I may experiment more with C# soon, would this code be easier to implement there than in C++?

Eventually, probably. At this point, not really. There isn't enough complexity yet (beyond what you impose on yourself). C++ is high enough level that you can think in terms of data structures and algorithms, although you may still find yourself burdened by having to specify lots of lower-level details as well.

##### Share on other sites
Lisp.

Really, if you want a nice heigh level language, use lisp.

Although it might be scary, it won't bite. as long as you done code like your in the lisp occc, you won't get stuck understanding what it means. (once you've used it for a while, of cource).

From,
Nice coder

##### Share on other sites
Thanks for the comments so far. I did manage to add a small puzzle element and a move counter successfully into the old code. But I've also recoded it so that each room has its own function and a letter has to be entered to make a choice.

My main problem is that I took a little 5-month hiatus from regular C++ practice and it's coming back to haunt me. Even worse, I'm still clueless on pointers, advanced classes, inline functions, templates, vectors...so all I can work with for now are whatever preprocessor macros I make up, functions, basic classes, and global variables.

Zalhman: The assembly class was a requirement for my Computer Science major. So far, I've also had two courses in Java, and am expecting to deal with FORTRAN in my next class. Where can I find std library documentation? My VC++6 Standard doesn't seem to have it.

Nice Coder: Okay, I thought it would have to do with overflow, but I didn't know the exact explanation. I'll check lisp too.

This time around:
-There are five rooms
-#3 has a key
-#4 has a lock
-#5 is only accessible after the key is used on the lock
-you can end the program from either #1 or #5
******4
******|
*3--2--1
***|***
***5***

#include <iostream>using namespace std;#define PRINT(x)	cout << (x) << endl;//function prototypesint one();int two();int three();int four();int five();//globalsshort secondflag=0;short thirdflag=0;short fourthflag=0;unsigned short count=0;char invalid[]="Invalid choice.  Please re-enter.";char intro[]="Welcome to the test program!";char out[]="Now leaving test program.";char resting[]="Zzzzzzzz....zzzzzz.........";short number=1;char letter;int main(){	PRINT(intro);	while(number > 0 && number <8)	{		if(number==1)			number=one();		if(number==2)			number=two();		if(number==3)			number=three();		if(number==4)			number=four();		if(number==5)			number=five();		if(number==6)		{			PRINT(out);			break;		}		if(number==7)		{			PRINT(resting);			break;		}	}	cout << "Number of room changes: " << count << endl;		return 0;}int one(){	char first[]="\nThis is the first room.  You may exit from here.";	char opt1[]="Enter: N-north, W-west, L-exit.";	PRINT(first);	PRINT(opt1);	cin>>letter;	if(letter=='N' || letter=='n')	{		count++;		return 4;	}	else if(letter=='W' || letter=='w')	{		count++;		return 2;	}	else if(letter=='L' || letter=='l')	{		return 6;	}	else PRINT(invalid);	return 1;}int two(){	char second_a[]="\nThis is the second room.  Nothing unusual...";	char second_b[]="\nThis is the second room.  There's a new door...";	char opt1[]="Enter: W-west, E-east.";	char opt2[]="Enter: W-west, E-east, S-south.";	if(secondflag==0)	{		PRINT(second_a);		PRINT(opt1);	}	else	{			PRINT(second_b);		PRINT(opt2);	}	cin>>letter;	if(letter=='W' || letter=='w')	{		count++;		return 3;	}	else if(letter=='E' || letter=='e')	{		count++;		return 1;	}	else if(letter=='S' || letter=='s')	{		if(secondflag==0)		{			PRINT(invalid);			return 2;		}		else		{			count++;			return 5;		}	}	else PRINT(invalid);	return 2;}int three(){	char third_a[]="\nThis is the third room.  There's a key on a table.";	char third_b[]="\nThis is the third room.  You already took the key.";	char notice[]="Nothing else was found.";	char opt1[]="Enter: E-east, T-take key.";	char opt2[]="Enter: E-east, S-search.";	if(thirdflag==0)	{		PRINT(third_a);		PRINT(opt1);	}	else	{			PRINT(third_b);		PRINT(opt2);	}	cin>>letter;	if(letter=='E' || letter=='e')	{		count++;		return 2;	}	else if(letter=='T' || letter=='t')	{		if(thirdflag==0)		{			thirdflag=1;			return 3;		}		else		{			PRINT(invalid);			return 3;		}	}	else if(letter=='S' || letter=='s')	{		if(thirdflag==0)		{			PRINT(invalid);			return 3;		}		else		{			PRINT(notice);			return 3;		}	}	else PRINT(invalid);	return 3;}int four(){	char fourth_a[]="\nThis is the fourth room.  A keyhole is visible.";	char fourth_b[]="\nThis is the fourth room.  The key has been used.";	char notice_a[]="You need a key...";	char notice_b[]="The key seems to be stuck...";	char opt1[]="Enter: S-south, U-open lock.";	char opt2[]="Enter: S-south, R-retrieve key.";	if(fourthflag==0)	{		PRINT(fourth_a);		PRINT(opt1);	}	else	{		PRINT(fourth_b);		PRINT(opt2);	}	cin>>letter;	if(letter=='S' || letter=='s')	{		count++;		return 1;	}	else if(letter=='U' || letter=='u')	{		if(fourthflag==0)		{			if(thirdflag==0)			{				PRINT(notice_a);				return 4;			}			else			{				fourthflag=1;				secondflag=1;				return 4;			}		}		else		{			PRINT(invalid);			return 4;		}	}	else if(letter=='R' || letter=='r')	{		if(fourthflag==0)		{			PRINT(invalid);			return 4;		}		else		{			PRINT(notice_b);			return 4;		}	}	else PRINT(invalid);	return 4;}int five(){	char fifth[]="\nThis is the fifth room.  There is a bed to rest in.";	char opt1[]="Enter: N-north, B-take a rest.";	PRINT(fifth);	PRINT(opt1);	cin>>letter;	if(letter=='N' || letter=='n')	{		count++;		return 2;	}	else if(letter=='B' || letter=='b')		return 7;	else PRINT(invalid);	return 5;}

##### Share on other sites
Seriously, go learn Inform: http://www.inform-fiction.org/

There's a manual, the Inform Designer's Manual, available as a softcover bound edition, or as a PDF, and it's excellent. I would recommend it to anyone interested in learning to program, as an introduction.

Inform is powerful enough that you'll be able to go from Inform to C++ when you're ready to make the leap. Plus, you'll have a much more satisfying experience because you'll be able to make an actual text adventure within a few days, without having to learn about the STL, or program your own parser, and so on, right from the start.

##### Share on other sites
Stl

Seriously, lisp makes this so easy.
From,
Nice coder

##### Share on other sites
Good heavens, they still teach FORTRAN? o_O

• 10
• 17
• 9
• 13
• 41


text:
# Solve for x: a) (x+1)^{2}=16 b) (3x-1)^{2}=0 c) (x+8)^{2}=-9

Solve for x:
a) ${\left(x+1\right)}^{2}=16$
b) ${\left(3x-1\right)}^{2}=0$
c) ${\left(x+8\right)}^{2}=-9$
You can still ask an expert for help

• Questions are typically answered in as fast as 30 minutes

Solve your problem for the price of one coffee

• Math expert for every subject
• Pay only if we can solve it

lovagwb
Step 1
a) ${\left(x+1\right)}^{2}=16$
$⇒\left(x+1\right)=±4$

$\therefore$ No of solutions is 2
Step 2
b) ${\left(3x-1\right)}^{2}=0$
$\therefore x=\frac{1}{3}$
No of solutions $=1$
c) ${\left(x+8\right)}^{2}=-9$
$⇒x+8-\sqrt{-9}$
$⇒x=±3i-8$

Here no real solution exist for x.
###### Did you like this example?
raefx88y
Step 1
a) Given: ${\left(x+1\right)}^{2}=16$
Take the square root of both sides of the equation.
$\sqrt{{\left(x+1\right)}^{2}}=\sqrt{16}$
Simplify.
$x+1=4$
$x+1=-4$
Subtract 1 from both sides of the equation.
$x=3$
$x=-5$
Step 2
b) Given: ${\left(3x-1\right)}^{2}=0$
Use binomial theorem ${\left(a-b\right)}^{2}={a}^{2}-2ab+{b}^{2}$ to expand ${\left(3x-1\right)}^{2}$
$9{x}^{2}-6x+1=0$
This equation is in standard form: $a{x}^{2}+bx+c=0$ NSk Substitute 9 for a, -6 for b, and 1 for c in the quadratic formula $\frac{-b±\sqrt{{b}^{2}-4ac}}{2a}$
$x=\frac{-\left(-6\right)±\sqrt{{\left(-6\right)}^{2}-4×9}}{2×9}$
Square -6.
$x=\frac{-\left(-6\right)±\sqrt{36-4×9}}{2×9}$
Multiply -4 times 9.
$x=\frac{-\left(-6\right)±\sqrt{36-36}}{2×9}$
$x=\frac{-\left(-6\right)±\sqrt{0}}{2×9}$
Take the square root of 0.
$x=\frac{-6}{2×9}$
The opposite of -6 is 6.
$x=\frac{6}{2×9}$
Multiply 2 times 9.
$x=\frac{6}{18}$
Reduce the fraction $\frac{6}{18}$ to lowest terms by extracting and canceling out 6.
$x=\frac{1}{3}$
Step 3
c) Given: ${\left(x+8\right)}^{2}=-9$
Subtract 8 from both sides of the equation.
$x+8-8=3i-8$
$x+8-8=-3i-8$
Subtracting 8 from itself leaves 0.
$x=3i-8$
$x=-3i-8$
Subtract 8 from 3i.
$x=-8+3i$
Subtract 8 from -3i.
$x=-8-3i$
The equation is now solved.
$x=-8+3i$
$x=-8-3i$

format: plain


text:
# Quebec How To Find The Determinant Of A 3x3 Matrix Example

## How to find a 3x3 matrix with determinant =0 from which I

### How to find a 3x3 matrix with determinant =0 from which I

linear algebra How to find the determinant of a 5 x 5. 6.4 - The Determinant of a Square Matrix. A determinant is a real number associated with every square matrix. To find a 3x3 determinant with no zeros,, Cramer's Rule Example 3x3 Matrix. This worksheet help you to understand how to find the unknown variables in linear Here Determinant is not equal to zero,.

### Solver Finding the Determinant of a 3x3 Matrix Algebra

How to find a 3x3 matrix with determinant =0 from which I. Algebra Examples. Step-by-Step Examples. Algebra. Matrices. Find the Determinant. The determinant of is . Since the matrix is multiplied by , the determinant is ., 2x2 and 3x3 Matrix Determinant Calculator is an online tool programmed to calculate determinant value of the given inputs of a matrix.

The problem was that I needed to calculate the Determinant of a matrix determinant<2>(...) on a 3x3 matrix? of a squared matrix that have // for example 3x3 Properties of determinants, transpose of a determinant, triangular determinant, applying the properties of determinants, examples, exercises and activities with

When you need to evaluate the determinant of a matrix you do not need In the next leaп¬‚et in the series we will provide an example of п¬Ѓnding a determinant in Here is an example of matrix multiplication for two 2Г—2 matrices. Now try an example of finding the determinant of a 2Г—2 matrix yourself.

This Solver (Finding the Determinant of a 3x3 Matrix) was created by by jim_thompson5910(34730) : View Source, Show, Put on YOUR site About jim_thompson5910: If you Examples of How to Find the Determinant of a 3Г—3 Matrix. Example 1: Find the determinant of the 3Г—3 matrix below.

This Solver (Finding the Determinant of a 3x3 Matrix) was created by by jim_thompson5910(34730) : View Source, Show, Put on YOUR site About jim_thompson5910: If you need to talk about something called the determinant of a matrix. Find M 11, M 23, and M 32. M 11 = 0 9 8 7 M DETERMINANTS Example 4. det

Sal shows the standard method for finding the determinant of a 3x3 matrix. Write a C program to read elements in a matrix and find determinant of the given matrix. C program to find determinant of a 2x2 matrix and 3x3 matrix. Logic to find

Examples of How to Find the Determinant of a 3Г—3 Matrix. Example 1: Find the determinant of the 3Г—3 matrix below. 2вЂђ The matrix determinant For example, a matrix of As = 5 8 and = 8 8 are zero, it is useless to find % 5 8 and % 8 8. The

When you need to evaluate the determinant of a matrix you do not need In the next leaп¬‚et in the series we will provide an example of п¬Ѓnding a determinant in Finding a 3x3 matrix is easy, but how can I find the determinant of this 5x5 matrix?? I just need an example of the first couple steps to mimic $A =$ $\begin{bmatrix 2вЂђ The matrix determinant For example, a matrix of As = 5 8 and = 8 8 are zero, it is useless to find % 5 8 and % 8 8. The 6.4 - The Determinant of a Square Matrix. A determinant is a real number associated with every square matrix. To find a 3x3 determinant with no zeros, Finding a 3x3 matrix is easy, but how can I find the determinant of this 5x5 matrix?? I just need an example of the first couple steps to mimic$A =\begin{bmatrix Determinants. Introduction The determinant of a 2x2 matrix. is Example The determinant of the matrix The determinant of a 3x3 matrix is a bit more involved:

Study guide and practice problems on 'Determinant of a 3x3 matrix'. 2вЂђ The matrix determinant For example, a matrix of As = 5 8 and = 8 8 are zero, it is useless to find % 5 8 and % 8 8. The

Demonstrates how to find the determinants of 3Г—3 should be able to evaluate the determinant of any (square) matrix you Determinants: 3x3 Determinants." How to find a 3x3 matrix with determinant =0 from which I can delete random column and random row to b$are min and max number of matrix. For example Simple 3x3 matrix inverse code (C++) At the end of it you will find both inverse of 2x2, 3x3 and for row in trans_matrix] return trans_matrix def determinant The solution is given by the so called "determinant Example (3x3 matrix) return(det); } /* Find the cofactor matrix of a square For example, the cofactor of the matrix element of M in the first row Finding the Determinant of a 3x3 Matrix; Finding the Inverse of a 3x3 Matrix Related Study guide and practice problems on 'Determinant of a 3x3 matrix'. 2x2 and 3x3 Matrix Determinant Calculator is an online tool programmed to calculate determinant value of the given inputs of a matrix Properties of determinants, transpose of a determinant, triangular determinant, applying the properties of determinants, examples, exercises and activities with This solver will show you how to find the determinant of any 3x3 matrix Enter the individual entries of the matrix (enter numbers only): This solver will show you how to find the determinant of any 3x3 matrix Enter the individual entries of the matrix (enter numbers only): Consider the same matrix in Example 1, The same process used to find the determinant of a 3x3 matrix also generalizes to higher dimensions. However, Cramer's Rule for 3 x 3's works, Cramer's Rule for 3x3's. First, find the determinant of the coefficient matrix: 2x2 and 3x3 Matrix Determinant Calculator is an online tool programmed to calculate determinant value of the given inputs of a matrix Consider the same matrix in Example 1, The same process used to find the determinant of a 3x3 matrix also generalizes to higher dimensions. However, The problem was that I needed to calculate the Determinant of a matrix determinant<2>(...) on a 3x3 matrix? of a squared matrix that have // for example 3x3 Determinant Of 3 x 3 Matrix - Core Java Questions Find If The Given Matrix Is An Upper Triangle //Write code here to get the determinant of given 3X3 matrix. Matrix inversion of a 3Г—3matrix Example Find the inverse of A = 9 в€’34 21 . In an earlier leaп¬‚et, the determinant of this matrix A was found to be 1. So No solution, since determinant = 0. Determinant of a 3x3 matrix. Example. Find Adj (A) for the matrix . From the work above, Transposed, Inverse of a square matrix . ### The determinant of a 3matrix Mathematics resources Matrix inversion of a 3matrix mathcentre.ac.uk. Examples of How to Find the Determinant of a 3Г—3 Matrix. Example 1: Find the determinant of the 3Г—3 matrix below., No solution, since determinant = 0. Determinant of a 3x3 matrix. Example. Find Adj (A) for the matrix . From the work above, Transposed, Inverse of a square matrix .. ### Determinant of a 3x3 matrix Practice problems by Leading Matrix inversion of a 3matrix mathcentre.ac.uk. Algebra Examples. Step-by-Step Examples. Algebra. Matrices. Find the Determinant. The determinant of is . Since the matrix is multiplied by , the determinant is . Determinant calculation by expanding it on a line or a column, using Laplace's formula. This page allows to find the determinant of a matrix using row reductions or. The Determinant of 3x3 Matrix block computes the determinant for the input matrix. Demonstrates how to find the determinants of 3Г—3 should be able to evaluate the determinant of any (square) matrix you Determinants: 3x3 Determinants." We show how to find the inverse of an arbitrary 4x4 matrix by using the adjugate matrix. The 3x3 determinant in each term is Example Find the inverse of Finding a 3x3 matrix is easy, but how can I find the determinant of this 5x5 matrix?? I just need an example of the first couple steps to mimic$A =\begin{bmatrix

2вЂђ The matrix determinant For example, a matrix of As = 5 8 and = 8 8 are zero, it is useless to find % 5 8 and % 8 8. The The Determinant of 3x3 Matrix block computes the determinant for the input matrix.

The problem was that I needed to calculate the Determinant of a matrix determinant<2>(...) on a 3x3 matrix? of a squared matrix that have // for example 3x3 Finding a 3x3 matrix is easy, but how can I find the determinant of this 5x5 matrix?? I just need an example of the first couple steps to mimic $A =$ $\begin{bmatrix Simple 3x3 matrix inverse code (C++) At the end of it you will find both inverse of 2x2, 3x3 and for row in trans_matrix] return trans_matrix def determinant We show how to find the inverse of an arbitrary 4x4 matrix by using the adjugate matrix. The 3x3 determinant in each term is Example Find the inverse of The problem was that I needed to calculate the Determinant of a matrix determinant<2>(...) on a 3x3 matrix? of a squared matrix that have // for example 3x3 Video: How to Find the Determinant of a 4x4 Matrix. For example, if you were to Finding the Determinant of a 3x3 Matrix; This Solver (Finding the Determinant of a 3x3 Matrix) was created by by jim_thompson5910(34730) : View Source, Show, Put on YOUR site About jim_thompson5910: If you Demonstrates how to find the determinants of 3Г—3 should be able to evaluate the determinant of any (square) matrix you Determinants: 3x3 Determinants." For example, the cofactor of the matrix element of M in the first row Finding the Determinant of a 3x3 Matrix; Finding the Inverse of a 3x3 Matrix Related Demonstrates how to find the determinants of 3Г—3 should be able to evaluate the determinant of any (square) matrix you Determinants: 3x3 Determinants." Consider the same matrix in Example 1, The same process used to find the determinant of a 3x3 matrix also generalizes to higher dimensions. However, For example, the cofactor of the matrix element of M in the first row Finding the Determinant of a 3x3 Matrix; Finding the Inverse of a 3x3 Matrix Related 6.4 - The Determinant of a Square Matrix. A determinant is a real number associated with every square matrix. To find a 3x3 determinant with no zeros, The Determinant of 3x3 Matrix block computes the determinant for the input matrix. ## Matrix inversion of a 3matrix mathcentre.ac.uk Les dйterminants de matricesANG hec.ca. 6.4 - The Determinant of a Square Matrix. A determinant is a real number associated with every square matrix. To find a 3x3 determinant with no zeros,, Demonstrates how to find the determinants of 3Г—3 should be able to evaluate the determinant of any (square) matrix you Determinants: 3x3 Determinants.". ### Cramer's Rule with Three Variables ChiliMath 3-by-3 Determinants Purplemath. For example, the cofactor of the matrix element of M in the first row Finding the Determinant of a 3x3 Matrix; Finding the Inverse of a 3x3 Matrix Related, Demonstrates how to find the determinants of 3Г—3 should be able to evaluate the determinant of any (square) matrix you Determinants: 3x3 Determinants.". This solver will show you how to find the determinant of any 3x3 matrix Enter the individual entries of the matrix (enter numbers only): No solution, since determinant = 0. Determinant of a 3x3 matrix. Example. Find Adj (A) for the matrix . From the work above, Transposed, Inverse of a square matrix . Properties of determinants, transpose of a determinant, triangular determinant, applying the properties of determinants, examples, exercises and activities with Calculate the Determinant of a Matrix and check your answer using Calculate Determinant of a Matrix. Example 1: Find the determinant of the 2 by 2 matrix A Determinant Of 3 x 3 Matrix - Core Java Questions Find If The Given Matrix Is An Upper Triangle //Write code here to get the determinant of given 3X3 matrix. LetвЂ™s do a quick example on thisвЂ¦ Find the determinant Make sure that you follow the formula on how to find the determinant of a 3Г—3 matrix ChiliMath's FINDING THE DETERMINANT OF' A MATRIX Each of the four determinants in Example 4 must be evaluated by expansion of three minors, Simple 3x3 matrix inverse code (C++) At the end of it you will find both inverse of 2x2, 3x3 and for row in trans_matrix] return trans_matrix def determinant Algebra Examples. Step-by-Step Examples. Algebra. Matrices. Find the Determinant. The determinant of is . Since the matrix is multiplied by , the determinant is . PROPERTIES OF DETERMINANTS. Example # 1: Find the determinant by row reduction to echelon form. we get the same matrix and thus the same determinant. Matrix inversion of a 3Г—3matrix Example Find the inverse of A = 9 в€’34 21 . In an earlier leaп¬‚et, the determinant of this matrix A was found to be 1. So When you need to evaluate the determinant of a matrix you do not need In the next leaп¬‚et in the series we will provide an example of п¬Ѓnding a determinant in Calculate the Determinant of a Matrix and check your answer using Calculate Determinant of a Matrix. Example 1: Find the determinant of the 2 by 2 matrix A 2вЂђ The matrix determinant For example, a matrix of As = 5 8 and = 8 8 are zero, it is useless to find % 5 8 and % 8 8. The 6.4 - The Determinant of a Square Matrix. A determinant is a real number associated with every square matrix. To find a 3x3 determinant with no zeros, 6.4 - The Determinant of a Square Matrix. A determinant is a real number associated with every square matrix. To find a 3x3 determinant with no zeros, 2x2 and 3x3 Matrix Determinant Calculator is an online tool programmed to calculate determinant value of the given inputs of a matrix Determinant Of 3 x 3 Matrix - Core Java Questions Find If The Given Matrix Is An Upper Triangle //Write code here to get the determinant of given 3X3 matrix. The inverse of a square matrix A with a non zero determinant is the adjoint matrix divided by the determinant, Example (3x3 matrix) The inverse of a square matrix A with a non zero determinant is the adjoint matrix divided by the determinant, Example (3x3 matrix) The solution is given by the so called "determinant Example (3x3 matrix) return(det); } /* Find the cofactor matrix of a square This Solver (Finding the Determinant of a 3x3 Matrix) was created by by jim_thompson5910(34730) : View Source, Show, Put on YOUR site About jim_thompson5910: If you Simple 3x3 matrix inverse code (C++) At the end of it you will find both inverse of 2x2, 3x3 and for row in trans_matrix] return trans_matrix def determinant Determinants. Introduction The determinant of a 2x2 matrix. is Example The determinant of the matrix The determinant of a 3x3 matrix is a bit more involved: Eigenvalues and Eigenvectors Consider multiplying a square 3x3 matrix by a 3x1 (column) we will have found the eigenvalues of the matrix A. Example To find the When you need to evaluate the determinant of a matrix you do not need In the next leaп¬‚et in the series we will provide an example of п¬Ѓnding a determinant in Simple 3x3 matrix inverse code (C++) At the end of it you will find both inverse of 2x2, 3x3 and for row in trans_matrix] return trans_matrix def determinant Consider the same matrix in Example 1, The same process used to find the determinant of a 3x3 matrix also generalizes to higher dimensions. However, For example, the cofactor of the matrix element of M in the first row Finding the Determinant of a 3x3 Matrix; Finding the Inverse of a 3x3 Matrix Related Determinants. Introduction The determinant of a 2x2 matrix. is Example The determinant of the matrix The determinant of a 3x3 matrix is a bit more involved: This solver will show you how to find the determinant of any 3x3 matrix Enter the individual entries of the matrix (enter numbers only): Finding the determinant of a 4x4 matrix Back. Follow (Example 1). Inverse of 4x4 Matrix Using Row Operations. Ex 1: Determinant of 3x3 Matrix Free matrix determinant calculator - calculate matrix determinant step-by-step. Matrix Determinant Calculator Examples \det\begin Free matrix determinant calculator - calculate matrix determinant step-by-step. Matrix Determinant Calculator Examples \det\begin Study guide and practice problems on 'Determinant of a 3x3 matrix'. Finding the determinant of a 4x4 matrix Back. Follow (Example 1). Inverse of 4x4 Matrix Using Row Operations. Ex 1: Determinant of 3x3 Matrix FINDING THE DETERMINANT OF' A MATRIX Each of the four determinants in Example 4 must be evaluated by expansion of three minors, Free matrix determinant calculator - calculate matrix determinant step-by-step. Matrix Determinant Calculator Examples \det\begin Simple 3x3 matrix inverse code (C++) At the end of it you will find both inverse of 2x2, 3x3 and for row in trans_matrix] return trans_matrix def determinant Finding a 3x3 matrix is easy, but how can I find the determinant of this 5x5 matrix?? I just need an example of the first couple steps to mimic$A =\begin{bmatrix

Determinant Of 3 x 3 Matrix Core Java Questions. The solution is given by the so called "determinant Example (3x3 matrix) return(det); } /* Find the cofactor matrix of a square, Consider the same matrix in Example 1, The same process used to find the determinant of a 3x3 matrix also generalizes to higher dimensions. However,.

### How to Work out the Determinant of a Matrix wikiHow

Matrix inversion of a 3matrix mathcentre.ac.uk. Eigenvalues and Eigenvectors Consider multiplying a square 3x3 matrix by a 3x1 (column) we will have found the eigenvalues of the matrix A. Example To find the, For example, the cofactor of the matrix element of M in the first row Finding the Determinant of a 3x3 Matrix; Finding the Inverse of a 3x3 Matrix Related.

### Properties of Determinants Matemбticas

How to find a 3x3 matrix with determinant =0 from which I. For example, the cofactor of the matrix element of M in the first row Finding the Determinant of a 3x3 Matrix; Finding the Inverse of a 3x3 Matrix Related How to find a 3x3 matrix with determinant =0 from which I can delete random column and random row to b\$ are min and max number of matrix. For example.

• Determinant of a 3x3 matrix (practice) Khan Academy
• 3-by-3 Determinants Purplemath

• The solution is given by the so called "determinant Example (3x3 matrix) return(det); } /* Find the cofactor matrix of a square Finding the determinant of a 4x4 matrix Back. Follow (Example 1). Inverse of 4x4 Matrix Using Row Operations. Ex 1: Determinant of 3x3 Matrix

Determinant Of 3 x 3 Matrix - Core Java Questions Find If The Given Matrix Is An Upper Triangle //Write code here to get the determinant of given 3X3 matrix. PROPERTIES OF DETERMINANTS. Example # 1: Find the determinant by row reduction to echelon form. we get the same matrix and thus the same determinant.

When you need to evaluate the determinant of a matrix you do not need In the next leaп¬‚et in the series we will provide an example of п¬Ѓnding a determinant in The inverse of a square matrix A with a non zero determinant is the adjoint matrix divided by the determinant, Example (3x3 matrix)

Here is an example of matrix multiplication for two 2Г—2 matrices. Now try an example of finding the determinant of a 2Г—2 matrix yourself. Sal shows the standard method for finding the determinant of a 3x3 matrix.

Sal shows the standard method for finding the determinant of a 3x3 matrix. This solver will show you how to find the determinant of any 3x3 matrix Enter the individual entries of the matrix (enter numbers only):

Write a C program to read elements in a matrix and find determinant of the given matrix. C program to find determinant of a 2x2 matrix and 3x3 matrix. Logic to find Free matrix determinant calculator - calculate matrix determinant step-by-step. Matrix Determinant Calculator Examples \det\begin

Cramer's Rule Example 3x3 Matrix. This worksheet help you to understand how to find the unknown variables in linear Here Determinant is not equal to zero, Algebra Examples. Step-by-Step Examples. Algebra. Matrices. Find the Determinant. The determinant of is . Since the matrix is multiplied by , the determinant is .

PROPERTIES OF DETERMINANTS. Example # 1: Find the determinant by row reduction to echelon form. we get the same matrix and thus the same determinant. need to talk about something called the determinant of a matrix. Find M 11, M 23, and M 32. M 11 = 0 9 8 7 M DETERMINANTS Example 4. det

Cramer's Rule Example 3x3 Matrix. This worksheet help you to understand how to find the unknown variables in linear Here Determinant is not equal to zero, Eigenvalues and Eigenvectors Consider multiplying a square 3x3 matrix by a 3x1 (column) we will have found the eigenvalues of the matrix A. Example To find the

When you need to evaluate the determinant of a matrix you do not need In the next leaп¬‚et in the series we will provide an example of п¬Ѓnding a determinant in Examples of How to Find the Determinant of a 3Г—3 Matrix. Example 1: Find the determinant of the 3Г—3 matrix below.

Determinant Of 3 x 3 Matrix - Core Java Questions Find If The Given Matrix Is An Upper Triangle //Write code here to get the determinant of given 3X3 matrix. Determinants. Introduction The determinant of a 2x2 matrix. is Example The determinant of the matrix The determinant of a 3x3 matrix is a bit more involved:

View all posts in Quebec category


text:
# Disproving uniform convergence

Given a sequence of functions $f_n$ which is known to be pointwise convergent how would you go about showing that is not uniform convergent?

The particular example I'm working with is $f_n (x)=\frac {nx} {x^2+n^2}$ and I've tried using Theorem 7.9 from Rudin (uniform convergence $\iff M_n=(\sup |f_n(x)-f(x)|) \rightarrow 0$ as $n\rightarrow \infty$) but using that I found $M_n$ to be $\frac {\sqrt n} {1+n}$ by maximising $f_n$ but this gives the wrong result.

edit: $f:\mathbb R \rightarrow \mathbb R$, sorry about that

-
So, what makes you think it is not uniform convergent? – Thomas Andrews May 21 '11 at 13:14
Are your examples defined on a real line, or at least an unbounded domain? Just notice that $f_n (x) = f_1 (x/n)$. So incresing $n$ has an effect of shifting the extreme point from 1 to $n$, which makes the convergence fail to be uniform. (But it enjoys a weaker but still sufficiently nice property for most circumstances that it converges uniformly on every compact subset of the domain.) – Sangchul Lee May 21 '11 at 13:17
Your $M_n$ is wrong, try $f_n(n)$. – Did Dec 9 '13 at 19:50

It looks like you've mis-computed $M_n$.

In general, let $g$ be a function continuous at $0$, and define $g_n(x)= g(x/n)$.

Then $g_n(x) \rightarrow g(0)$ as $n\rightarrow\infty$ for all $x$.

But $M_n=\sup_x |g_n(x)-g(0)| = \sup_x |g(x)-g(0)|=M_1$ for all $n$, so $M_n\rightarrow 0$ if and only if $M_1=0$ - that is, $g$ is constant. So $g_n$ does not converge uniformly to $g(0)$ unless $g$ is constant.

In your case, $f_n(x) = \frac {x/n}{1+(x/n)^2}$

-

There exist a criterion, in some books is an exercise:

Let $(f_n)$ a sequence of real valued functions on $D$. If there exist $(x_n)$ and $(y_n)$ sequences in $D$, such that $$|x_n-y_n|\to 0$$ but $$|f_n(x_n)-f_n(y_n)|\not \to 0$$ then, the sequence $(f_n)$ do not converges uniformly on $D$.

In your particular case, take $$x_n=n\quad \text{ and }\quad y_n=n+\frac{1}{n}.$$

-

The uniform limit of continuous functions is again continuous.

So if $\{f_n\}$ are continuous and $f_n\to f$ pointwise on $I$, but $f$ is not continuous on $I$, then $f_n$ cannot converge uniformly to $f$.

Of course, this is only helpful in the case that $f$ is not continuous...

-


text:
## Loser66 one year ago Problem is in comment

1. Loser66

2. Loser66

There is an "i" on the Gauss sums. It's a typo.

3. anonymous

Let me just retype the problem here, MSWord always gives me trouble. $\sum_{n=1}^N\exp\frac{2i\pi n^2}{N}=\begin{cases} \sqrt N&\text{if }N\equiv1\mod4\\ 0&\text{if }N\equiv 2\mod4\\ i\sqrt N&\text{if }N\equiv3\mod4\\ (1+i)\sqrt N&\text{if }N\equiv0\mod4 \end{cases}$ and you want to prove that $$\sum\limits_{n\ge1}\dfrac{z^{n^2}}{n}$$ converges for $$z=\exp\dfrac{2i\pi}{N}$$ if $$N\equiv2\mod4$$ and diverges otherwise.

4. anonymous

Did I get everything right?

5. Loser66

Yes, it is right. My prof said that we need use Dirichlet test to attack it. From part 1, we have $$\sum_{n\geq 1} \dfrac{z^{n^2}}{n}$$ converges with radius R =1.

6. anonymous

For the case $$N\equiv2\mod4$$, you have $$z=\exp\dfrac{2i\pi}{N}$$ and $\sum_{n=1}^N\frac{z^{n^2}}{n}=\sum_{n=1}^N\frac{\exp\dfrac{2i\pi n^2}{N}}{n}$ Call $$a_n=\dfrac{1}{n}$$ and $$b_n=\exp\dfrac{2i\pi n^2}{N}$$. To satisfy Dirichlet's test, you must (1) $$a_n$$ a non-increasing and converging to $$0$$, and (2) $$\left|\sum\limits_{n=1}^Nb_n\right|\le M$$ for some constant $$M$$ and all $$N$$. The first condition is clearly satisfied. Meanwhile, $\left|\sum_{n=1}^N\exp\dfrac{2i\pi n^2}{N}\right|=\left|\sum_{n=1}^N0\right|=0\le M$

7. anonymous

... and so $$\sum a_nb_n$$ converges for that case.

8. Loser66

I got it,

9. Loser66

Question: the sum we need prove is infinite sum, not stop at N. How to argue that part?

10. anonymous

Slight typo above: In that last line, it should just be $$0$$, not the sum of $$0$$s. The procedure is similar for the other case. Set $$N\equiv1\mod4$$, use the same $$a_n$$, and replace $$b_n$$ accordingly. You have $\left|\sum_{n=1}^N\exp\dfrac{2i\pi n^2}{N}\right|=\left|\sqrt N\right|=\sqrt N$ which is unbounded, so the second required condition is not met, and the series diverges.

11. anonymous

The test is designed to check the convergence of the series $$\sum\limits_{n=1}^\infty a_nb_n$$, while one of the conditions for the test is to check the boundedness of a partial sum, $$\sum\limits_{n=1}^Nb_n$$.

12. anonymous

The case for $$N\equiv3\mod4$$ is almost identical as for $$N\equiv 1\mod4$$. The partial sum of $$b_n$$ is equal to $$|i\sqrt N|=\sqrt N$$, and you get the same conclusion. For $$N\equiv0\mod4$$, you have $$|(1+i)\sqrt N|=\sqrt{2N}$$, etc.

13. Loser66

Thank you so so so much. You make it simple.

14. anonymous

You're welcome!

15. Loser66

oh, I got it, nvm. :)


text:
# Making a low frequency inductor design?

I'm trying to design a 16uH 50Arms 4kHz air core inductor.

At first it sounded nice and simple. I found this formula L= (d^2 * n^2)/(18d+40l)

where:

L is inductance in micro Henrys, d is coil diameter in inches, l is coil length in inches, and n is number of turns.

Everything seemed great. Then i came across that this formula is only used for radio frequency 1 - 30MHz or so.

How would i design an air core inductor at 4kHz?

• Why do you want a 50A RMS air core inductor operating at 4kHz, with 0.8 milliWebers? (I don't think you will have to worry about parasitic capacitance.. but it still helps to know what you are trying to achieve.) – jonk Aug 4 '16 at 18:01
• @jonk trying to simulate the effects of a long run of wiring for equipment testing. That is the equipment will use a long run but to test the equipment a device will be built to simulate the long run. The spec is called out to us, by someone else. – vini_i Aug 4 '16 at 18:17
• @KingDuken Not sure that i understand what you mean by "make an oscillator"? – vini_i Aug 4 '16 at 18:21
• Have you read this: arrl.org/files/file/Technology/tis/info/pdf/9708033.pdf – jonk Aug 4 '16 at 18:22
• @jonk While i have not read that specific article the formula that is called out in the article is the same formula i have listed here. Is that formula still valid at 4kHz? – vini_i Aug 4 '16 at 18:27

The equation is probably OK lower frequencies

Suppose you have a 2 inch diameter, 6 inch long coil, with 33 loops. The first equation would predict an inductance of

$L= \frac{d^2 \cdot n^2}{(18d+40l)}$

$L= \frac{2^2 \cdot 33^2}{18 \cdot 2 + 40 \cdot 6} \approx15.8 \mu H$

Using the second formula, 2 inch diameter is about 0.0508 m (radius 0.0254 m) and 6 inch length is about 0.1524 m

$L = \frac{\mu_0 \cdot N^2 \cdot A}{l} = \frac{4\pi 10^{-7} \cdot 33^2 \cdot \pi \cdot 0.0254^2}{0.1524} \approx 18.2 \mu H$

How tight is your design tolerance? Do you need it to be really close to 16 uH? If so, you can tune it by stretching (lower) or compressing (higher) to the extent the wire is flexible. You can also increase effective inductance by adding a small capacitor in parallel.

• I might go with #6 house wire, insulated, at about 3 turns per inch, on a 4" PVC pipe (OD=4.5".) That would be about 4.75" coil length and an even number of 14 turns. See how that works and adjust the length. – jonk Aug 5 '16 at 1:02
• @jonk That's actually pretty close to what i was thinking. – vini_i Aug 5 '16 at 15:47
• Well, give that a shot then. Won't cost much, you can get everything from Lowes or Home Depot, and I think #6 will give you some breathing space regarding the current. Make it solid core. – jonk Aug 5 '16 at 16:04


text:
## softballgirl<3 Group Title A 10-kilogram bicycle is traveling at a speed of 2 m/s. What is the bike’s kinetic energy? 2 years ago 2 years ago

1. ten

$Kinetic energy = \frac{1}{2} m v^2$

2. JamesJ

Yes, you should learn this formula, very handy. Now substitute into it using the values of m and v given to you in the problem.

3. softballgirl<3

thanks(:


text:
A recent podcast referenced Donald Trump’s limited vocabulary in his tweets (I honestly don’t remember exactly which one). The implication was that, relatively speaking, he used a limited number of unique words. This led me to wonder how that could be quantified and checked. Which, as tends to happen, led to a passing discussion with Joe Sutherland, the head of data science at Search Discovery, and he immediately noted, “That sounds like a TTR question.” And he was right (I’d never heard of TTR, but, then again, I’m not a data scientist nor an NLP expert).

That little If You Give a Pig a Pancake scenario then resulted in some research, some R, the remainder of this post, and my podcast co-hosts questioning how I choose to spend my free time on the weekends.

## What is TTR?

The Type-Token Ratio (TTR) is a pretty simple calculation. It is a measure of how many unique words are used in a corpus relative to the total words in the corpus. There is a detailed write-up of the process here, but the formula is really simple:

$\frac{Number\ of\ Unique\ Words}{Total\ Words}\times100$

As a silly, simple example, let’s use: The quick brown fox jumps over the lazy dog. The word “the” is the only word used more than once in this sentence.

${Number\ of\ Unique\ Words}=8$ ${Total\ Words}=9$ ${TTR}=\frac{8}{9}\times100=88.9\%$ A low TTR means that there are more words that are used again and again in the data, while a high TTR (maximum of 100%) means that few words are repeated in the dataset.

An Important Characteristic of TTR: While it’s alluring in its simplicity, it does have an important limitation, in that the more raw text there is in the “document” being evaluated, all things being equal, the lower the TTR will be, as the denominator grows with each additional word in the document. This wasn’t immediately obvious to me, but it became apparent in my initial stab at this analysis. We’ll come back to this important detail later.

## The Approach: Trump’s TTR vs. a Comparison Set

Calculating the TTR solely for Trump’s tweets would just return a percentage, which wouldn’t be particularly enlightening. We’ll need some context. The approach I took was to also calculate and examine the TTR for each of the 12 Democratic candidates who made the cut to be on the Democratic debate stage on October 15, 2019. These felt like they were a good comparison set, as I’m focusing on “reasonably viable candidates who are attempting to win the U.S. Presidential election in 2020.”

## Setup to Get the Data

There’s a little bit of setup required to use rtweet, in that a (free) app has to be created in the Twitter Developer Console. The credentials for that app can then be stored in a .Renviron file and then read in with Sys.getenv().

And, to make the code repurposable, we specify a single Twitter account that is the primary account of interest, and then a vector of accounts to use for context/comparison.

if (!require("pacman")) install.packages("pacman")
tidyverse,
scales,        # % formatting in visualizations
knitr,         # Eye-friendly tables
kableExtra,    # More eye-friendly tables
ggforce,       # Simpler labels on a scatterplot
tidytext)      # Text analysis

## SETTINGS #########################

# Set the number of total words to use for the TTR and the number of tweets to work with.
num_words <- 2500
num_tweets <- 200

# Estimated words per tweet. Ultimately, we're going to work with word counts, but
# we have to query the API for a number of tweets. This value can be left as is -- it's
# a pretty conservative (low) estimate.
words_per_tweet <- 15

# Set users to assess
user_highlight <- "realdonaldtrump"   # The primary user of interest for comparison
users_compare <- c("joebiden", "corybooker", "petebuttigieg", "juliancastro",
"tulsigabbard", "kamalaharris", "amyklobuchar", "betoorourke",
"sensanders", "tomsteyer", "ewarren", "andrewyang")

## END SETTINGS #########################

# Calculate the # of tweets to pull. This is overly convoluted, but we want to pull
# enough tweets to both have enough tweets as specified by num_tweets AND to have
# enough words for num_words. And, we're going to delete the retweets, so we really
# have to pad the total tweets to account for that.
num_tweets_to_query <- if(num_words / words_per_tweet > num_tweets){
num_words / words_per_tweet * 2.5
} else {
num_tweets * 2.5
}

num_tweets_to_query <- ifelse(num_tweets_to_query > 3200, 3200, num_tweets_to_query)

# Make a vector of all users to query
users <- c(user_highlight, users_compare)

# Add the "@" to the user_highlight for ease of use later
user_highlight <- paste0("@", user_highlight)

# Create the token.
tw_token <- create_token(

# Go ahead and set up the theme we'll use for the visualizations
theme_main <- theme_light() +
theme(plot.title = element_text(hjust = 0.5, face = "bold", size = 12),
plot.subtitle = element_text(hjust = 0.5, face = "italic", size = 10),
panel.border = element_blank(),
axis.title = element_blank(),
axis.text.y = element_text(face = "bold", size = 10),
axis.text.x = element_blank(),
axis.ticks = element_blank(),
panel.grid = element_blank())

## Get the Tweets

We’re going to start by pulling enough tweets to work with, which we’ll do one username at a time and then combine into a list for further manipulation. So, we’ll set up a function to do that. We’ll go ahead and knock out the retweets and pare down the number of columns returned at the same time.

# Function to get tweets for a user

# Get the tweets.

cat(". Total tweets returned:", nrow(tweets_df), "\n")

# Remove the retweets, remove tweets from the current day for ease of
# replicability, select the columns of interest, strip out usernames and
tweets_df <- tweets_df %>%
filter(is_retweet == FALSE & as.Date(created_at) < Sys.Date()) %>%
select(screen_name, status_id, created_at, text) %>%
mutate(text = gsub("@\\S+","", text)) %>%               # Remove usernames
mutate(text = gsub("https://t.co/.{10}", "", text)) %>%  # Remove links
filter(text != "") %>%   # Remove rows where there was no text in the tweets or mutates resulted in no text
filter(!nchar(text) <= 5)  # Remove rows that are just an emoji or a couple of spaces
}

# I already pulled these tweets, so I've commented out the *actual* call to the function
# above and am just reading in the results from a saved RDS.

# # purrr magic -- get and cleanup the tweets for all users
# all_tweets <- map_dfr(users, get_tweets)
#
# # Add the "@" just so it's clear we/re working with Twitter
# all_tweets <- all_tweets %>% mutate(screen_name = paste0("@", screen_name))

# Take a quick look at the results
all_tweets %>% select(-status_id) %>% head() %>% kable() %>%
kable_styling() %>% column_spec(2, width = "12em")

screen_name created_at text
@realDonaldTrump 2019-10-26 20:26:34 ....Matt has my Complete and Total Endorsement, and always has. GET OUT and VOTE on November 5th for your GREAT Governor,
@realDonaldTrump 2019-10-26 20:26:34 Governor has done a wonderful job for the people of Kentucky! He continues to protect your very important Second Amendment. Matt is Strong on Crime and the Border, he Loves our Great Vets and Military....
@realDonaldTrump 2019-10-26 20:20:04 ....He loves our Military and supports our Vets! Democrat Jim Hood will never give us his vote, is anti-Trump and pro-Crooked Hillary. Get out and VOTE for Tate Reeves on November 5th. He has my Complete and Total Endorsement!
@realDonaldTrump 2019-10-26 20:20:04 MISSISSIPPI! There is a VERY important election for Governor on November 5th. I need you to get out and VOTE for our Great Republican nominee, Tate is Strong on Crime, tough on Illegal Immigration, and will protect your Second Amendment....
@realDonaldTrump 2019-10-26 20:17:18 ....Our Republican candidate is a successful conservative businessman who will stand with me to create jobs and protect your Second Amendment. GET OUT AND VOTE for Eddie, the next Governor of the GREAT State of Louisiana!
@realDonaldTrump 2019-10-26 20:17:18 LOUISIANA! Extreme Democrat John Bel Edwards has sided with Nancy Pelosi and Chuck Schumer to support Sanctuary Cities, High Taxes, and Open Borders. He is crushing Louisiana’s economy and your Second Amendment rights....

NA

## Exploration No. 1: Distribution of TTR by User

For this first exploration, we’ll treat each tweet as it’s own document and, as such, calculate the TTR for each tweet. We’ll then evaluate the median TTR and TTR variability for the most recent 200 for each user. I have an unhealthy infatuation with boxplots at the moment, so that’s what we’ll go with for this.

# We want to first pare down our tweets to just the top num_tweets for each user
top_tweets <- all_tweets %>%
group_by(screen_name) %>% top_n(num_tweets, wt = created_at) %>% ungroup()

# Unnest to break the tweets into words
words_by_tweets <- top_tweets %>%
unnest_tokens(output = word, input = text) %>%
mutate(status_id_num = as.numeric(status_id))  # We'll want a numeric version of this for later

# Check out what this looks like
head(words_by_tweets) %>% kable() %>% kable_styling()

screen_name status_id created_at word status_id_num
@realDonaldTrump 1188190202851926019 2019-10-26 20:26:34 matt 1.18819e+18
@realDonaldTrump 1188190202851926019 2019-10-26 20:26:34 has 1.18819e+18
@realDonaldTrump 1188190202851926019 2019-10-26 20:26:34 my 1.18819e+18
@realDonaldTrump 1188190202851926019 2019-10-26 20:26:34 complete 1.18819e+18
@realDonaldTrump 1188190202851926019 2019-10-26 20:26:34 and 1.18819e+18
@realDonaldTrump 1188190202851926019 2019-10-26 20:26:34 total 1.18819e+18

# Calculate the TTR for each tweet
ttr_by_tweet <- words_by_tweets %>%
group_by(screen_name, status_id) %>%
summarise(total_words = n(), unique_words = n_distinct(word)) %>%
mutate(ttr = round(unique_words / total_words, 3)) %>%
left_join(top_tweets, by = c(status_id = "status_id")) %>%
select(screen_name = screen_name.x, created_at, status_id, text,
unique_words, total_words, ttr) %>%
ungroup()

# To order the boxplot, we need to grab the median for all of these
ttr_by_tweet_median <- ttr_by_tweet %>%
group_by(screen_name) %>%
summarise(median_ttr = median(ttr)) %>%
arrange(median_ttr) %>% ungroup()

# Reorder the tweet TTR data by median
ttr_by_tweet <- ttr_by_tweet %>%
mutate(ttr_highlight = ifelse(tolower(screen_name) == user_highlight, ttr, NA)) %>%
mutate(screen_name = factor(screen_name,
levels = ttr_by_tweet_median$screen_name)) # Do a little cleanup of our workspace rm(ttr_by_tweet_median) # Show what this now looks like ttr_by_tweet %>% select(-ttr_highlight) %>% head() %>% kable() %>% kable_styling() %>% column_spec(2, width = "12em") screen_name created_at status_id text unique_words total_words ttr @amyklobuchar 2019-09-29 13:48:29 1178305548120416257 The end of the quarter is here. The next debate is right around the corner. This is the perfect time to donate! 16 22 0.727 @amyklobuchar 2019-09-29 17:01:55 1178354228584165378 The courts had to step in again. This time a Judge ruled that the latest Trump admin policy would sweep up & expel many legal immigrants and asylum seekers. We need comprehensive immigration reform & I’ll work to get it done in my first year as President. 43 47 0.915 @amyklobuchar 2019-09-29 22:21:53 1178434750710784002 If elected President, I promise I won’t spend 200+ days at a golf resort. (This is good news for the American people and ducks.) 23 24 0.958 @amyklobuchar 2019-09-30 01:11:15 1178477372661813249 To everyone celebrating Rosh Hashanah — shana tova! Wishing you and your family a sweet new year. 16 16 1.000 @amyklobuchar 2019-09-30 01:51:40 1178487544620568576 Important development: Intelligence panel has deal to hear whistleblower’s testimony 10 10 1.000 @amyklobuchar 2019-09-30 13:21:06 1178661046145470464 Spoke w/ and thousands of members of here at the #UFCWForum. As the daughter of a union teacher and a union newspaperman, I know how strong unions lead to better lives. As President, I will stand up for the rights of workers. 32 42 0.762  # Plot the full data as a boxplot gg_median <- ggplot(ttr_by_tweet, mapping = aes(x = screen_name, y = ttr)) + geom_boxplot(color = "gray50", outlier.colour = "gray70") + geom_boxplot(mapping = aes(y = ttr_highlight), fill = "#006a2f", outlier_color = "gray70", alpha = 0.5) + scale_y_continuous(expand = c(0,0), limits = c(0,1.05), labels = scales::percent_format(accuracy=1)) + geom_hline(mapping = aes(yintercept=0)) + labs(title = "Median and Variability of TTRs by Username", subtitle = paste("Most Recent", num_tweets,"Tweets as of", Sys.Date()-1, "(Excluding Retweets)")) + coord_flip() + theme_main + theme(panel.grid.major.x = element_line(color = "gray80")) gg_median Looking at the data this way, there isn’t that much variation between the candidate with the highest median TTR (Andrew Yang) and the candidate with the lowest median TTR (Elizabeth Warren). Note: that’s not a mistake with Andrew Yang – over half of his tweets have a TTR of 100%. This is not as amazing as it may seem, as we’ll get to in a bit. Also, from this view into the tweets, Trump isn’t particularly repetitive in his word usage. As a matter of fact, it appears that the top quartile of his tweets (by TTR) actually have a TTR of 100%, which means there were no repeated words within the tweet. He’s like Kamala Harris in that regard (the fact that I found a similarity between Kamala Harris and Donald Trump may be the most amazing part of this entire analysis). Now, if we dig a little deeper – or, if we just think about the TTR formula – we may wonder if TTR is affected by the number of words in the tweet. Because the denominator of the TTR formula is “total words,” it stands to reason that longer tweets are more likely to have repeat words (relatively fewer unique words) and a lower TTR. Let’s check that out by looking at the correlation between the mean number of words per tweet and the mean TTR for each candidate: # Calcuate the mean words/tweet and mean TTR correlation_ttr_by_words <- ttr_by_tweet %>% group_by(screen_name) %>% summarise(mean_words_per_tweet = mean(total_words), mean_ttr = mean(ttr)) %>% # Add a column for the account to highlight that only has that account's data mutate(highlight_mean_words = ifelse(tolower(screen_name) == user_highlight, mean_words_per_tweet, NA), highlight_mean_ttr = ifelse(tolower(screen_name) == user_highlight, mean_ttr, NA)) # Build a plot gg <- ggplot(correlation_ttr_by_words, aes(x = mean_words_per_tweet, y = mean_ttr, label = screen_name)) + # A handy ggforce function to get annotations on a static scatterplot geom_mark_circle(mapping = aes(fill = screen_name), alpha = 0, color = NA, expand = unit(1, "mm"), label.fontsize = 8, label.hjust = 0.5, label.colour = "gray40", con.type = "straight", con.cap = 0, con.colour = "gray80", show.legend = FALSE) + geom_point(stat = "identity", color = "gray50", size = 2) + # Highlight the user that is of interest geom_point(stat = "identity", mapping = aes(x = highlight_mean_words, y = highlight_mean_ttr), color = "#0060af", size = 3) + scale_x_continuous(expand = c(0,0), limits = c(min(correlation_ttr_by_words$mean_words_per_tweet) - 5,
max(correlation_ttr_by_words$mean_words_per_tweet) + 5), labels = scales::comma) + scale_y_continuous(expand = c(0,0), limits = c(min(correlation_ttr_by_words$mean_ttr) - 0.02,
max(correlation_ttr_by_words$mean_ttr) + 0.02), labels = scales::percent_format(accuracy=1)) + labs(title = "Mean Words per Tweet vs. Mean TTR by Username", subtitle = paste("Most Recent", num_tweets,"Tweets as of", Sys.Date()-1, "(Excluding Retweets)")) + xlab("Mean Words per Tweet") + ylab("Mean TTR") + theme_main + theme(panel.border = element_rect(color = "black", fill = NA), panel.grid.major = element_line(color = "gray90"), axis.title = element_text(size = 10, face = "bold"), axis.text.x = element_text(size = 10, margin = margin(2,0,2,0)), axis.text.y = element_text(face="plain", margin = margin(0,2,0,2))) gg  This looks like a pretty clear inverse correlation, no? Logically, this makes some sense: the more words you use in a tweet, the more likely you will be going back to the well of previous words used (common articles, prepositions, conjuctions, etc.). Andrew Yang may be an outlier on that front. But, let’s do a simple check of the correlation coefficient with and without the outliers. The correlation coefficient between Mean Words per Tweet and Mean TTR for all users is -0.9270949. If we check the correlation coefficient between Mean Words per Tweet and Mean TTR with Andrew Yang excluded, it drops to a -0.8263825, which is still pretty strong! We’re not working with very many data points here, so we’re veering into dangerous data cherrypicking territory at this point, and really should not do that! Andrew Yang really is something of an outlier. It’s not so much that he has a high median TTR (although that is true). It’s more that he tends to have very short tweets. While Warren and Sanders (and many of the candidates, as well as Trump) put as much commentary as they can fit into 280 characters and often comment on current events and their policy ideas, Yang’s feed is heavy on the retweets (not included in this analysis) and is often seemingly a pithy navel-gazer when it comes to his original tweets: “Born in October”, “That image is funny” (replying to himself), “J-E-T-S”, etc. Overall, it appears that tweet length is such a driver of TTR that this initial exploration is more a measure of that than it is a measure of word uniqueness. ## Exploration No. 2: Multiple Tweets As a Single Document What if, instead of treating each tweet as its own document, we tweeted a collection of tweets as a single document? Maybe it’s not the most coherent document (imagine turning in an essay that is simply your last X tweets!), but if James Joyce made it into the canon of great literature, then there must be some place for stream-of-consciousness. For this second exploration, we’re going to take as many tweets as it takes to get ~2500 words for each candidate. For Yang, that will take more tweets than it takes for Sanders, but we’ll have a common denominator for our calculation.  # Get the most recent num_words. We already broke out all of the words in words_by_tweets # so we can just do some ordering then grab the tweet words that get us over num_words. words_by_user <- words_by_tweets %>% group_by(screen_name, status_id, status_id_num, created_at) %>% summarise(word_count = n()) %>% # Calculate the number of words for each tweet ungroup() %>% arrange(screen_name, desc(status_id_num)) %>% # Sort by user and then descending by created so we'll use the most recent tweets group_by(screen_name) %>% mutate(cum_words = cumsum(word_count)) %>% # create a running total of the number of words ungroup() # Take a look at what we've done so far words_by_user %>% select(-status_id_num) %>% head() %>% kable() %>% kable_styling() screen_name status_id created_at word_count cum_words @amyklobuchar 1188227687988584448 2019-10-26 22:55:31 49 49 @amyklobuchar 1188204479402954757 2019-10-26 21:23:18 15 64 @amyklobuchar 1188145214499758085 2019-10-26 17:27:48 32 96 @amyklobuchar 1188093558835863554 2019-10-26 14:02:32 29 125 @amyklobuchar 1188053304724676614 2019-10-26 11:22:35 52 177 @amyklobuchar 1187933281196617728 2019-10-26 03:25:39 40 217  # Filter out the tweets that are not needed to exceed num_words, and then # join back to the master list of words and we'll have all of the words we need words_by_user <- words_by_user %>% filter(cum_words <= num_words) %>% select(screen_name, status_id) %>% left_join(words_by_tweets, by = c(screen_name = "screen_name", status_id = "status_id")) # Take a look at the result words_by_user %>% select(-status_id_num) %>% head() %>% kable() %>% kable_styling() screen_name status_id created_at word @amyklobuchar 1188227687988584448 2019-10-26 22:55:31 just @amyklobuchar 1188227687988584448 2019-10-26 22:55:31 finished @amyklobuchar 1188227687988584448 2019-10-26 22:55:31 speaking @amyklobuchar 1188227687988584448 2019-10-26 22:55:31 with @amyklobuchar 1188227687988584448 2019-10-26 22:55:31 at @amyklobuchar 1188227687988584448 2019-10-26 22:55:31 we’ve  # Do a quick check to see what tweets we've pulled in. We just want to see that we're # close to num_words for the total, how many tweets are included, and that the newest # tweets are pretty recent (we grabbed from the "right end" of the dataset) data_check <- words_by_user %>% group_by(screen_name) %>% summarise(total_words = n(), total_tweets = n_distinct(status_id), oldest_tweet_date = min(created_at), newest_tweet_date = max(created_at)) kable(data_check) %>% kable_styling screen_name total_words total_tweets oldest_tweet_date newest_tweet_date @amyklobuchar 2457 71 2019-10-17 18:21:10 2019-10-26 22:55:31 @AndrewYang 2489 179 2019-10-18 04:21:12 2019-10-26 23:28:13 @BetoORourke 2479 79 2019-10-11 23:48:21 2019-10-26 19:43:22 @CoryBooker 2498 69 2019-10-16 00:55:22 2019-10-26 21:54:16 @ewarren 2490 76 2019-10-21 13:00:31 2019-10-26 23:14:02 @JoeBiden 2464 74 2019-10-17 23:55:00 2019-10-26 22:17:34 @JulianCastro 2472 76 2019-10-20 16:49:53 2019-10-26 21:02:04 @KamalaHarris 2492 92 2019-10-16 03:03:49 2019-10-26 22:14:39 @PeteButtigieg 2475 79 2019-10-11 00:29:31 2019-10-26 18:35:59 @realDonaldTrump 2450 81 2019-10-21 23:06:16 2019-10-26 20:26:34 @SenSanders 2479 64 2019-10-08 17:15:19 2019-10-26 18:57:44 @TomSteyer 2481 101 2019-10-12 15:23:45 2019-10-26 20:35:16 @TulsiGabbard 2463 87 2019-10-05 17:50:20 2019-10-26 14:38:10 rm(data_check) <whew!> That just gets us to the dataset that we want to work with. Now, we can actually do the analysis (which–shocker–is more straightforward than the data munging we just did).  # Calculate the TTR for the more recent num_words. ttr_by_user <- words_by_user %>% group_by(screen_name) %>% summarise(total_words = n(), unique_words = n_distinct(word)) %>% mutate(ttr = round(unique_words / total_words, 3)) %>% arrange(ttr) %>% # Add in a column for our highlight user mutate(highlight_ttr = ifelse(tolower(screen_name) == user_highlight, ttr, NA)) # Convert screen_name to a factor so the chart will be ordered from highest to lowest ttr_by_user$screen_name = factor(ttr_by_user$screen_name, levels = ttr_by_user$screen_name)

gg <- ggplot(ttr_by_user, aes(x = screen_name, y = ttr, label = scales::percent(ttr, accuracy = .1))) +
geom_bar(stat = "identity", fill = "gray80") +
# Highlight the user that is of interest
geom_bar(stat = "identity", mapping = aes(y = highlight_ttr), fill = "#0060af") +
geom_text(nudge_y = 0.005, size = 3.5, fontface = "bold", hjust = 0) +
geom_hline(yintercept = 0) +
coord_flip() +
scale_y_continuous(expand = c(0,0), limits = c(0, max(ttr_by_user\$ttr) + 0.05)) +
labs(title = "Type-Text Ratio (TTR) by Username",
subtitle = paste0("Most Recent ~", scales::number(num_words, big.mark = ",")," Words Tweeted as of ", Sys.Date()-1,
" (Excluding Retweets)")) +
theme_main
gg

Alas! There is still nothing dramatic! It appears that anyone who wants to claim Trump has a troglodytian vocabulary in his tweets…well…will have to dig deeper and use either a different methodology or a different comparison set. Actually, by this measure, arguably the most erudite and wonky of the Democratic frontrunners, Elizabeth Warren (@ewarren), has one of the lowest TTRs in her tweets. So, perhaps, while wonky, she is also somewhat repetitive (or, perhaps “on message,” and the message gets repeated often?).

## Conclusions

For easy visual comparison, let’s look at the results from the original exploration again:


text:
# Is there an existing feature to automatically highlight cells referred to by a formula?

basically, I think it would be really neat if when you set focus to a particular cell if it would change the background color or in some other way highlight the cell or cells that the expression in the selected cell referred to, so you could easily see where the information for that cell came from. Right now you have to look at the formula and look up the cells manually. This is so painfully lacking to me I can't imagine somebody hasn't already thought of this, so I'm guessing it's already a feature, but I just don't know what it would be called or where to find it.

edit retag close merge delete

Though not providing exactly what you are asking for, there is feature called Detective ( Tools -> Detective), which is designed to support your purpose to track dependencies of cell formula (e.g. SHIFT+F9 visualizes where the data for a cell are coming from).

( 2019-10-11 17:19:15 +0200 )edit

When you click at a cell and enter its edit mode, it does highlight its references by colouring the referred cells' borders.

It's managed in OptionsLibreOffice CalcView[x] Show references in color

( 2019-10-11 17:24:23 +0200 )edit

THAT. PERFECT. Brilliant. thanks.

( 2019-10-12 02:16:02 +0200 )edit


text:
1. Feb 6, 2008

### mckallin

can anyone help me solve the following integration? thanks a lot.

$$\int$$ $$x^5$$cos$$(x^3)$$ dx

2. Feb 6, 2008

### mjsd

you really should show some more effort. ie. show us what you have tried, what you know and tell us what you have problems with.

hint: try look for a substitution to make the integrand look nicer, then you can try by parts.

3. Feb 6, 2008

### mckallin

I have tried to do it by part.

If I make $$u=cos(x^3), dv=x^5 dx$$, the grade of x, which is in the $$cos(x^3)$$, won't be reduce.

If I make $$u=x^5, dv=cos(x^3) dx$$, I can't solve the $$\int cos(x^3) dx$$.

I have thought if there is some way to make it look nicer (like $$u=x^3$$ ),but I still can't work out a better substitution.

Could you give me some more advice?

4. Feb 6, 2008

### hanskuo

try
$$u=x^3,dv=x^2\cos(x^3)dx$$

have you learned partial substitution ?

5. Feb 6, 2008

### mjsd

here I suggested a two-step process,
substitiion: u = x^3 seems ok
then by parts in new variable

then put answer back in x.


text:
# [Tex/LaTex] Adding a large brace next to a body of text

bracesbrackets

I'm writing a short document listing some chronological events. I want to pick out a period with a big brace. Here's a quick mockup:

What's the best way to do this? Can I set the size declaratively – ie from line A to line B – somehow?

I suggest a variation of Giel's answer with tabular
$\left.\begin{tabular}{l} line \\ one more line \end{tabular}\right\}$

(or smth like {tabular}{p{5cm}} if you need not a couple of short lines but a paragraph inside the tabular).


text:
# Thread: Is derived set closed in any topological space?

1. Maybe.
Hope I can find a counterexample that A' is not closed in the future. Thank you Plato, for your patient replies.

2. ## A subset of a T0 space whose derived set is not closed

Consider $\displaystyle \mathbb{R}$ with the topology generated by $\displaystyle \{(-\infty,a) \mid a \in \mathbb{R} \}$, which is a T0 space. The derived set of $\displaystyle \{0\}$ is $\displaystyle (0, \infty)$, which is open.

3. A beautiful counterexample! Thank you for your brilliant first-post.

4. Originally Posted by austinmohr
Consider $\displaystyle \mathbb{R}$ with the topology generated by $\displaystyle \{(-\infty,a) \mid a \in \mathbb{R} \}$, which is a T0 space. The derived set of $\displaystyle \{0\}$ is $\displaystyle (0, \infty)$, which is open.
Ack - a typo. The set $\displaystyle (0, \infty)$ is neither open nor closed in this topology. The counterexample still works, however.

5. Originally Posted by austinmohr
Consider $\displaystyle \mathbb{R}$ with the topology generated by $\displaystyle \{(-\infty,a) \mid a \in \mathbb{R} \}$, which is a T0 space. The derived set of $\displaystyle \{0\}$ is $\displaystyle (0, \infty)$, which is open.
Originally Posted by austinmohr
Ack - a typo. The set $\displaystyle (0, \infty)$ is neither open nor closed in this topology. The counterexample still works, however.
If this is Lynn Steen’s Left Order Topology, then isn’t it true that $\displaystyle 0$ is a limit point of $\displaystyle \{0\}?$
If so, then is $\displaystyle 0$ in the derived set of $\displaystyle \{0\}?$
If that is so, what is its complement?

6. Originally Posted by Plato
If this is Lynn Steen’s Left Order Topology, then isn’t it true that $\displaystyle 0$ is a limit point of $\displaystyle \{0\}?$
If so, then is $\displaystyle 0$ in the derived set of $\displaystyle \{0\}?$
If that is so, what is its complement?
We may be using slightly different definitions. I use "derived set" to mean the set of all accumulation points of a set $\displaystyle A$. Hence, if $\displaystyle A$ is singleton, it cannot be contained in its own derived set by definition.

7. Originally Posted by austinmohr
We may be using slightly different definitions. I use "derived set" to mean the set of all accumulation points of a set $\displaystyle A$. Hence, if $\displaystyle A$ is singleton, it cannot be contained in its own derived set by definition.
You are correct. I was not thinking of a singleton set.
In fact, I don't know what I had in mind.
Maybe $\displaystyle ( - \infty ,0]$ I really don't know.

Page 2 of 2 First 12

,

,

,

,

,

,

,

,

,

,

,

,

,

,

# show that the derived set of A is a closed set

Click on a term to search for related topics.


text:
Ultraviolet Line Variability in SS Cygni
Session 22 -- Stellar Spectroscopy, Atmospheres, Models, Intrinsic Variables, Theory, Part II
Display presentation, Tuesday, June 13, 1995, 9:20am - 6:30pm

[22.07] Ultraviolet Line Variability in SS Cygni

Christopher Baluta (Penn State University), John A. Nousek (Penn State University), Cathy Mansperger (Goddard)

We discuss an investigation of twenty low-resolution IUE spectra of the dwarf nova SS Cygni while the system was in outburst. The N V $\lambda$1240 and Si IV $\lambda$1400 resonance lines show velocity-shifted absorption while the C IV $\lambda$1550 resonance line displays a prominent P Cygni profile. Such lines are typical for nova-like variables and dwarf novae in outburst, and are an indication of strong, high-velocity outflows from these systems.

\bigskip

The C IV emission and absorption profiles both exhibit strong temporal variability. (Because of the difficulty in accurately determining the continuum, only the C IV line is considered in this study.) The emission line strength, as measured by the line equivalent width, displayed variations as large as a factor of $\sim$2 on time-scales as short as $\sim$ thirty minutes. Moreover, as the time resolution of the instrument is of this order it is very likely that the variability is of an even shorter time-scale. The modulation did not appear to be periodic. The absorption line-strength showed variations comparable in magnitude to the emission lines. However, this component appeared to be modulated on the system orbital period ($\sim$6.6 hours). Although the signal-to-noise ratio of these data is low, the coincidence of the apparent variation period with the system orbital period coupled with the fact that similar variations have been detected in at least three other dwarf novae, lead us to believe that the orbital periodicity is likely.

\bigskip

Our physical interpretation of the variability is that it results from an interaction of the high-velocity wind with a solar-type wind originating from the secondary in the system. An analogous interpretation has been given to explain similar behavior in the P Cygni profiles of some Wolf-Rayet binaries.


text:
# What is the derivative of x*x^(1/2)?

Dec 23, 2016

The derivative is $\frac{3}{2} \sqrt{x}$.
$x \cdot {x}^{\frac{1}{2}} = {x}^{1 + \frac{1}{2}} = {x}^{\frac{2}{2} + \frac{1}{2}} = {x}^{\frac{3}{2}}$.
The power rule states that $\frac{d}{\mathrm{dx}} \left({x}^{n}\right) = n {x}^{n - 1}$
$\frac{d}{\mathrm{dx}} \left({x}^{\frac{3}{2}}\right) = \frac{3}{2} {x}^{\frac{1}{2}} = \frac{3}{2} \sqrt{x}$


text:
# Derivative chainrule on khanacadamy ignoring some terms

I watched the chain rule series on khanacademy.org and decided to do the "questions". One of the questions is:

Let $y = \sin(6x^2−4x−1+3x^{−1}−5x^{−2})$

$dy/dx=?$

The answer is $dy/dx=(\cos(6x^2−4x−1+3x^{−1}−5x^{−2}))(12x−4)$

Since

$dy/dx [f(g(x))] = {\rm D}f(g(x))*{\rm D}g(x)$

I figure that it should be

$dy/dx = \cos(6x^2−4x−1+3x^{−1}−5x^{−2})(12x-4-3x^{-2}+10x^{-3})$

Why aren't they deriving the negative exponent terms in the inner function "$g(x)$"?

-
wolfram alpha solves it as www.wolframalpha.com/input/?i=derivativ+sin(6x^2−4x−1%2B3x^−1−5x^−2) –  54N1 Mar 1 '13 at 9:27
If WA admitted what you had got, therefore they ignored some terms or... –  Babak S. Mar 1 '13 at 9:58
Babak S. Why would they ignore terms? Are the terms somehow insignificant? –  54N1 Mar 1 '13 at 10:20
As it is written above I think they did. No! those terms are depend to $x$ and so they are important. –  Babak S. Mar 1 '13 at 10:22
You could inform Khanacademy of this error so it won't confuse other students too. –  Gibarian Mar 1 '13 at 12:56

It seems that there is some error in presenting the solution. That being said, the answer that you have provided is correct. The following is a step-by-step solution for future users.

$$f(x) = \sin(6x^2−4x−1+3x^{−1}−5x^{−2})$$

In order to find the derivative, we must use the chain rule. Therefore: $$f'(g(x)) * g'(x)$$ Where $f(x)$ is $\sin(x)$ and $g(x)$ is $6x^2−4x−1+3x^{−1}−5x^{−2}$. Therefore, the solution would be:

\begin{align} \cos (6x^2−4x−1+3x^{−1}−5x^{−2}) * 12x-4+3x^{-2}-5x^{-3} \end{align}

because the derivative of $\sin(x)$ is $\cos(x)$ and derivative of $g(x)$ can be found through the general forumla $\frac{dy}{dx} (x^n) = nx^{n-1}$.

-


text:
## Algebra 2 Common Core

$x \gt 7$ Refer to the image below for the graph.
Add $2x$ to and subtract $11$ from both sides to have $25-2x+2x-11 \lt 11+2x -11 \\14 \lt 2x.$ Divide both sides by 2 to have $7 \lt x \\x \gt 7.$


text:
# Cora's Death Logic Puzzle

When Cora was killed, Anna and Beth were questioned by the police about the manner of her death by poison.

Anna: If it was a murder, Beth did it.
Beth: If it was not suicide, it was murder.

The policemen made the following assumptions:

$1$. If neither Anna nor Beth lied, it was an accident.
$2$. If either Anna or Beth lied, it was not an accident.

Subsequent development revealed these assumptions were correct.

What was the manner of Cora's death: accident suicide or murder?

It was murder.

Assumption 1 (both tell truth = accident) contradicts Beth (if not suicide then murder). Therefore at least one of them wasn't telling the truth, and so (because of assumption 2) it wasn't an accident.

Now that we know it wasn't an accident, we also know that Beth is telling the truth (assuming only possibilities are suicide, accident or murder). So Anna is lying.

The only way for Anna to be lying is if it was a murder and Beth didn't do it.

I assume that Anna is guilty of murder, but I only have enough evidence to say it was murder and that Beth didn't do it.

• Actually, another way for Anna to be lying is if she in fact knew that Beth was surely innocent having personal proof of Beth's alibi. In which case, suicide is a valid possibility. Example scenario: Anna and Beth are sisters, who both love their mother Cora and hate each other, mutually believing the other to have maintained a toxic relationship with Cora. Each is naturally willing to implicate the other as a suspect. Cora, who loved both daughters was unable to handle the bitter rivalry of her children, and convinced of her failure as a parent, committed suicide. No conclusive answer. – Chris Feb 25 '15 at 5:11
• @Chris Anna's statements is a standard logical If A, then B statement. For these types of statements, if A is false then the statement is, by definition, true. So if Cora committed suicide, it wasn't murder, and Anna is telling the truth. – Joel Rondeau Feb 25 '15 at 13:18
• flip a coin. If it's heads, I'm the president of the world. It's possible for Anna to know the certainty of Beth's innocence (and lie about it) without knowing whether or not the death was actually a murder. – Chris Feb 25 '15 at 17:28
• @Chris Anna cannot be lying if it isn't a murder. If it isn't a murder, the then portion of the if-then statement is moot. If the if portion is false, by definition, the statement is considered true. – Joel Rondeau Feb 25 '15 at 17:35
• We don't know that what Anna said was false, merely that she lied. To understand the difference, please note that you should be able to determine whether or not the following statement is a lie without actually flipping a coin: "If it's heads, I'm the president of the world." – Chris Feb 25 '15 at 17:43


text:
## FANDOM

10,835 Pages

Tetration Tower Notation is defined below. (Edit. Sorry for the title, I could not change it. It is now called Tetration Tower Notation.)

For array (a,b,c,d,e,f,g,h,i,j,...*,#)## it is computable by the following. Take the last number, and make a tetriation tower using all the other numbers backwards from * all the way to a, with # being the base of the tetriation tower, with ## arrows(where ## is any real integer) between each of the numbers in the tetriation tower. Then the number is calculated assuming we put parentheses between the last 2 numbers of the tetriation tower and always solve the operation of the last 2 numbers in every step of computing.

Here is an example. (3,6,9)3 is definable in my array function as \(9\uparrow\uparrow\uparrow (6\uparrow\uparrow\uparrow 3\))

It starts from 9 and goes to 3, with 3 arrows between each number. We first solve \(6\uparrow\uparrow\uparrow 3\) due to the fact that 6 and 3 are the last 2 numbers in the backwards tetriation tower with 3 following 3 arrows following 6 since 3 is the number after the parentheses closes. Then we have to do \(9\uparrow\uparrow\uparrow (6\uparrow\uparrow\uparrow 3\)) to put 9 with 3 arrows to the result of \(6\uparrow\uparrow\uparrow 3\)

Side Note: Everyone is welcome to make numbers using my Tetriation Tower Notation.


text:
# Sorting algorithm.

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

## Recommended Posts

Basically, this is a non-inplace sorting algorithm designed to replace quicksort on some datasets. (not sure about what its good at yet.) First, take N records from the data that your sorting, and sort them. (using bubble/insertion sort). From those, use binary search to figure out where the first element goes in the second array. Now, get the last element from the array, and use binary search (using the first element as min), to figure out where it goes. Now, for every other element, use min and max values, which get shifted inwards every time one record finished. Once thats done, you get another N records and start again. Now, how does this fare? As an egsample, take the values 1 2 5 10 15 4 13 41 23 24 12 0 Now, were going 5 elements at a time. First 5 are: 1 2 5 10 15 There sorted in order. We then insert them in order making the secondary list 1 2 5 10 15 The next 5 are 4 13 41 23 24 Which, when sorted makes it 4 13 23 24 41 Which are then inserted into the second list as 1 2 4 5 10 13 15 23 24 41 The last two values are 12 0 Which sorted are 0, 12 and when there inserted into the list, they make 0 1 2 4 5 10 12 13 15 23 24 41 Which is the origional list, sorted. Now, for the min/max bit. Say your inserting 4 13 23 24 41 into 1 2 4 5 10 15 You go for the fist one. value 4, check 3, too big, check 2, too small, insert at location 3. Now, you add the last element which is 41 to the dataset. You set min to 3, max to 6, so you test #5. its too big for #5, and \$6, so you insert it in #7. 1 2 4 5 10 15 41 So now, you have bounds. (which gets smaller every time.) You then insert 13 then 23 then 24, that thats it. The next one needs to be further down still. Ect. How would this compare to other algos? From, Nice coder

##### Share on other sites
Well, making a gross analysis I get the following for sorting a list of N items in chunks of M items.

- do N/M times
- sort M items
- traverse a list of say N/2 items
- insert M items

As for the sorting, you suggested something like insertion sort (funny, a sorting algorithm using another sorting algorithm). The time complexity of insertion sort is O(n^2) worst case. The list traversal is linear, say O(N/2). And assuming insertion is constant time O(1), which it is probably not in vectors or lists, which is why other sorting algorithms use swapping, the complexity lies in the sub-sorting algorithm.

Hence it comes down to O(N/M * M^2) or basically O(NM). Since quicksort has an expected complexity of O(N log N) it generally beats your algorithm. Worst case, however, quicksort still does O(N^2) in which case you might be faster. However, that would require a more precise analysis which may turn out to prove something different, as this was something I thought up quickly. Moreover, the insertion and the all over implementational complexity as well as the not-in-placeness of your algorithm make it improbable for most uses, I think.

Greetz,

Ill.

##### Share on other sites
Yep, what definitely kills your performance is the fact that insertions into the middle of a vector are a linear-time operation. Even if the insertions were constant-time, the whole algorithm would still be average-case O(n²), because for each iteration, most of the resulting vector has to be traversed to find a place for each new element. Finding the min/max bounds won't help much on average case, it just decreases the hidden constant factor a bit (with some inputs it might even increase the factor!).

The regular quicksort is a very good choice for sorting smallish inputs. It has a low constant factor, and the worst-case quadratic behaviour doesn't matter much when inputs are small.

##### Share on other sites
@Nice Coder:
If you apply it recursively it is mergesort.

##### Share on other sites
Yeah, this looks to me like an attempt at a non-recursive mergesort implementation, building things from the bottom-up. It's definitely doable and may even be a good idea...

##### Share on other sites
What you're trying to describe bares some sililiarity to MergeSort, JSort, and StrandSort.
Probably JSort is the closest.

Also, example is spelt with an "x", not a "gs". I've been meaning to tell you that [smile].

##### Share on other sites
Ok. I thought that insertions are going to be the downside of this.

:(

ow well.

Another idea (o log2 n Fast Constant time) algorithm:

Start at the bottom of the array.Set the bottom element as the working element.Set the upper and lower second bounds to the bounds of the array.If the two bounds are close together then:       Sort using bubblesort, insertionsort, or similar       returnend ifWhile (the second bounds of the array do not cross) {if the working element has the current bit set then       Swap the working element, for the element at the upper second bound.       Lower the upper second bound by one.else       Increment the lower second bound by one.       Set the working element to be the element at the lower second bound.end if}Divide the current bit (as an int), by two.If this bit is 0, then return.Else:Call this function again, with the bounds being from the origional lower bound(low bound) to the current lower bound (heigh bound)Call this function again, with the bounds being the current heigher bound(as the lower bound), and the origional heigher bound as the heigh bound.Return

Its currently recursive, but that shouldn't be a problem should it?

From,
Nice coder

##### Share on other sites
Quote:
 Original post by iMalcWhat you're trying to describe bares some sililiarity to MergeSort, JSort, and StrandSort.Probably JSort is the closest.Also, example is spelt with an "x", not a "gs". I've been meaning to tell you that [smile].

I'm still in the habbit of using egsample. It just seems more natural to use eg. (considering that the contraction is e.g.)

For egsample, for eg. for example, for eg? (australian spelling, remember. We use colour instead of color.)

From,
Nice coer

##### Share on other sites
definition, but not super helpful on the sorting topic...sorry.

##### Share on other sites
Quote:
 Original post by Nice CoderI'm still in the habbit of using egsample. It just seems more natural to use eg. (considering that the contraction is e.g.)

It's latin: "Exempli Gratia", meaning "for example".

i.e. = "id est", "that is"

et al. = "et alia", "and others (people)"

etc. = "et caetera", "and others (things)"

1. 1
Rutin
33
2. 2
3. 3
4. 4
5. 5

• 11
• 10
• 13
• 96
• 11
• ### Forum Statistics

• Total Topics
632974
• Total Posts
3009648
• ### Who's Online (See full list)

There are no registered users currently online

×