Showing posts with label experimental linguistics. Show all posts
Showing posts with label experimental linguistics. Show all posts

Thursday, April 27, 2023

If BARD is a poet, I wouldn't know it

 kw: analysis, artificial intelligence, experimental linguistics, poetry


My first queries to BARD were related to Shakespeare. BARD bungled the iambic meter of a soliloquy. I decided to try poetry in a more general sense. I will comment in each section.

P07: There are 3 kinds of photosynthesis: C3, C4 and CAM. Please write a sonnet about photosynthesis in the Italian rhyming style.

Bard: Sure, here is a sonnet about photosynthesis in the Italian rhyming style:

Photosynthesis

The leaves unfurl, the sun shines bright,
And plants begin their daily flight.
They take in carbon dioxide,
And water from the ground below.
 
They use the energy from the sun,
To turn these things into one.
A sugar called glucose,
And oxygen, which is released into the air.
 
There are three main types of photosynthesis,
C3, C4, and CAM.
Each type has its own advantages and disadvantages,
And they are all used by different plants.
 
C3 photosynthesis is the most common type,
And it is used by most plants.
It is not as efficient as C4 or CAM photosynthesis,
But it is less demanding of water.
 
C4 photosynthesis is more efficient than C3 photosynthesis,
But it requires more water.
It is used by plants that live in hot, dry climates,
Such as cacti and succulents.
 
CAM photosynthesis is the most efficient type of photosynthesis,
But it is also the most demanding of water.
It is used by plants that live in very hot, dry climates,
Such as cacti and succulents.
 
No matter what type of photosynthesis they use,
All plants play an important role in the environment.
They help to clean the air,
And they provide food and oxygen for animals.

A sonnet has 14 lines. Here we have 28. The Italian rhyming style is ABBAABBA CDECDE, although there are various ways the last six lines are handled, including CDCDCD and CDDCDD. None of the quartos above has an ABBA rhyming pattern. Also, sonnets are typically in iambic meter, but none of that is found here.

P07: Please write a limerick about a coder named Larry

Bard: Sure, here is a limerick about a coder named Larry:

There once was a coder named Larry,
Whose code was as tight as a curry.
He could write in any language,
From C++ to Python,
And his programs always ran merrily.

This limerick was in a box, so maybe Bard copied it from somewhere…but it doesn’t rhyme lines 3&4. There were two other drafts:

There once was a coder named Larry,
Whose code was quite hairy and scary.
He said, "I'll rewrite it,
But first I must write it,
Then I'll test it, and then maybe I'll marry."
 
There once was a coder named Larry,
Whose code was quite hairy.
He said, "I'll rewrite it,
So it's not so tight,
And maybe I'll get a raise, maybe."

The first alternate draft is a near-perfect Limerick; just remove "and" from the last line. The other draft, and the original version, are quite klutzy.

P07: Describe the common feet in prodosy: iamb, trochee, anapest, dactyl, and spondee

Bard: Sure. In prosody, a foot is the basic repeating rhythmic unit that forms part of a line of verse. The most common feet in English are the iamb, trochee, anapest, dactyl, and spondee.

Iambic

An iamb is a two-syllable foot with an unstressed syllable followed by a stressed syllable. For example, the word "today" is an iamb, with the unstressed syllable "to" followed by the stressed syllable "day."

Trochaic

A trochee is a two-syllable foot with a stressed syllable followed by an unstressed syllable. For example, the word "about" is a trochee, with the stressed syllable "a" followed by the unstressed syllable "bout."

Anapestic

An anapest is a three-syllable foot with two unstressed syllables followed by a stressed syllable. For example, the word "telephone" is an anapest, with the two unstressed syllables "tele" followed by the stressed syllable "phone."

Dactylic

A dactyl is a three-syllable foot with a stressed syllable followed by two unstressed syllables. For example, the word "hammer" is a dactyl, with the stressed syllable "ham" followed by the two unstressed syllables "mer."

Spondaic

A spondee is a two-syllable foot with two stressed syllables. For example, the word "forever" is a spondee, with both syllables "for" and "ever" stressed.

These are just a few of the most common feet in prosody. There are many other types of feet, as well as more complex meters that combine multiple feet.

The descriptions are good but not all the examples are apt. “About” is not a Trochee but an Iamb; a better choice would have been “under”, or the example used for Dactyl, “hammer”. A better choice for a Dactyl would have been “murmuring” or “mockingbird”. “Forever” is not a Spondee but an Amphibrach (rare as a repeated foot in English poetry); a better choice for a spondee would be a “smokestack”, or more common examples of repeated one-syllable words such as “woe, woe!”. In another draft, BARD used these apt examples: “report”, “daily”, “serenade”, “merrily”, and “he who”. A third draft used some four-syllable words as examples!

That's enough. I have read here and there about the poetic abilities of ChatGPT. I suspect they are overhyped. I didn't ask BARD to write free verse, which I don't consider to be verse at all. Maybe that's what folks have written about.

Monday, April 24, 2023

BARD figures it out

 kw: analysis, artificial intelligence, experimental linguistics, mathematics, computer science

Continuing my exploration of the capabilities of BARD, I asked it about some computational and mathematical matters, starting with one that was relevant to recent work I have been doing. I'll comment along with each interaction this time.

P07: Two angles are related by the function A = arctan(sec B * tan B). Given A, what is B?

Bard: The given function is not invertible, so there is no unique value of B that corresponds to a given value of A. This is because the tangent function is periodic, with a period of 180°. This means that for any value of A, there are infinitely many values of B that will satisfy the given function.

For example, if A=45∘, then B could be any value in the range (−45∘, 45∘). Or, if A=90°, then B could be any value in the range (−90°, 90°).

In order to find a specific value of B that corresponds to a given value of A, you would need to specify additional information about the problem. For example, you might know that B is an acute angle, or that B is a right angle.

P07: In the above problem, both A and B are in the range 0° to 90°.

Bard: In that case, there are two possible values of B for any given value of A. For example, if A=45°, then the two possible values of B are 45° and 135°. This is because the tangent function is positive in the first and third quadrants, so the two possible values of B are the two angles in the first and third quadrants that have a tangent of 1.

In general, the two possible values of B can be found by solving the equation

[recast by P07]                  tan B = ± tan A / sec B

For example, if A=45°, then this equation becomes

[recast by P07]                  tan B = ±tan 45° / sec B = ±1 / √2

Solving this equation, we find that the two possible values of B are 45° and 135°.

The original statement is correct, though not only for the reason BARD presented. This is an example of a Trapdoor Function. If angle A is known, it is straightforward to calculate angle B. But if only B is known, finding A requires an iteration, such as successive applications of Newton's Approximation.

BARD treated this like a Diophantine problem, and ignored the restriction of B to (0°, 90°). Further, the answer is incorrect. Tan 45° = 1, sec 45° ≈ 1.414, so 1 is being equated to √2.

P07: Are you able to chart a function?

Bard: Yes, I can chart a function. I can use the following steps to chart a function:

1.       Identify the domain and range of the function.

2.       Choose a few values of x and calculate the corresponding values of y.

3.       Plot the points (x,y) on a graph.

4.       Connect the points with a smooth curve.

For example, let's chart the function y=x2. The domain of this function is all real numbers, and the range is all non-negative real numbers. We can choose a few values of x, such as x=0,1,2,3, and calculate the corresponding values of y, such as y=0,1,4,9. We can then plot the points (0,0), (1,1), (2,4), (3,9) on a graph and connect them with a smooth curve. The resulting graph is a parabola that opens upwards.

P07: Can you draw the chart?

Bard: I can't draw a chart for you here, but I can give you a description of the chart of y=x2.  The chart is a parabola that opens upwards. The vertex of the parabola is at (0,0). The x-axis is the line of symmetry of the parabola. The parabola approaches the x-axis asymptotically as x approaches ±∞.

This is just as I expected; BARD is linguistic in nature, and has no graphical capabilities...yet!

P07: What is the integral of Sqrt(sec(x)*tan(x))?

Bard: 



The line above needed to be a picture.

To solve this, we can use the following steps:

  1. Let u = sec x. Then du = sec x tan x dx.
  2. Substituting gives us:

Code snippet

∫√sec(x)tan(x)dx = ∫√u du = 2√u + C = 2√sec(x) + C

where C is an arbitrary constant of integration.

P07: Can a computer store the exact value of an irrational number?

Bard: No, a computer cannot store the exact value of an irrational number. This is because computers store numbers in binary, which is a finite representation of numbers. Irrational numbers are infinite, so they cannot be represented exactly in binary.

For example, the number π is irrational. It is a non-repeating, non-terminating decimal number. This means that there is no finite sequence of digits that can represent π exactly. If we try to store π in binary, we will only be able to store an approximation of it.

The same is true for all other irrational numbers. They cannot be stored exactly in binary, so they can only be approximated.

However, this does not mean that computers cannot use irrational numbers. They can still perform calculations with irrational numbers, as long as they are aware that the numbers are being approximated.

The only quibble I have with this answer is the word "they" in the last sentence. Computers aren't aware of anything. It should read, "…as long as those using the program are aware…"

P07: What is Green’s Theorem?

Bard: Green's theorem is a theorem in vector calculus that relates a line integral around a simple closed curve C to a double integral over the plane region D bounded by C. It is the two-dimensional special case of Stokes' theorem.

In mathematical terms, Green's theorem states that

Code snippet

∫CF⋅ds=∬D(curl F)⋅k dA

Use code with caution. Learn more [link to https://bard.google.com/faq#coding]

where

  •         F is a vector field defined on a two-dimensional domain D
  •         C is a simple closed curve in D
  •         ds is the line element along C
  •         dA is the area element in D
  •         curl F is the curl of F, which is a vector field that measures the circulation of F around a point
  •         k is the unit vector in the z-direction 

Green's theorem can be used to solve a variety of problems in physics, engineering, and mathematics. For example, it can be used to 

  •         Calculate the flow of a fluid through a region
  •          Determine the area of a plane figure
  •          Find the centroid of a plane figure
  •          Solve boundary value problems

 Green's theorem is a powerful tool that can be used to simplify and solve a wide variety of problems in vector calculus.

BARD then referred to the Wikipedia article on Green’s Theorem, and suggested three Google searches on the topic. I then asked about one term used in the description.

P07: What is the curl of a function?

Bard: In vector calculus, the curl is a vector operator that describes the infinitesimal circulation of a vector field in three-dimensional Euclidean space. The curl at a point in the field is represented by a vector whose length and direction denote the magnitude and axis of the maximum circulation. The curl of a field is formally defined as the circulation density at each point of the field.

In other words, the curl of a vector field is a vector that measures the rotation of the field around a point. The curl is zero at points where the field does not rotate, and it is nonzero at points where the field does rotate. The direction of the curl vector indicates the direction of the axis of rotation, and the magnitude of the curl vector indicates the magnitude of the rotation.

The curl of a vector field can be calculated using the cross product. The cross product is a mathematical operation that takes two vectors and produces a third vector that is perpendicular to both of the original vectors. The direction of the cross product vector is determined by the right-hand rule.

The curl of a vector field can also be calculated using the curl operator. The curl operator is a mathematical symbol that represents the curl of a vector field. The curl operator is written as a counterclockwise cross product, and it is applied to the vector field.

The curl of a vector field has many applications in physics and engineering. For example, the curl of the velocity field of a fluid is used to calculate the vorticity of the fluid. The vorticity of a fluid is a measure of the rotation of the fluid. The curl of the electric field is used to calculate the magnetic field. The magnetic field is a vector field that describes the direction and magnitude of the magnetic force.

The curl is a powerful tool for analyzing the behavior of vector fields. It can be used to calculate the rotation of a vector field, the vorticity of a fluid, and the magnetic field. The curl is an important tool in physics, engineering, and other fields.

BARD referenced a Wikipedia article on the subject. In an alternate draft BARD added:

The curl of a vector field F is denoted by ∇ × F. In three dimensions, the curl can be computed using the following formula:

Where F1, F2, and F3 are the components of function F.

Not being a vector calculus expert, I had to ask for the definition of the inverted delta.

The symbol ∇ is called the nabla symbol. It is a triangular symbol resembling an inverted Greek delta: \nabla or ∇. The name comes, by reason of the symbol's shape, from the Hellenistic Greek word νάβλα for a Phoenician harp, and was suggested by the encyclopedist William Robertson Smith to Peter Guthrie Tait in correspondence.

In mathematics, the nabla symbol is used to represent the gradient operator in calculus. The gradient is a vector that points in the direction of the greatest rate of change of a function, and its magnitude is equal to the magnitude of the rate of change.

The nabla symbol can also be used to represent other vector operators, such as the divergence and the curl. The divergence is a vector operator that measures the outward flux of a vector field from a surface, and the curl is a vector operator that measures the circulation of a vector field around a point.

The nabla symbol is a powerful tool that can be used to represent a variety of vector operators in mathematics. It is an important symbol in vector calculus and has many applications in physics, engineering, and other fields.

Sources:

  1. brainly.in/question/12687051 
  2. en.wikipedia.org/wiki/Nabla_symbol 
  3. mathoverflow.net/questions/289607/mathematical-objects-whose-name-is-a-single-letter  

BARD did what I would have done, look these things up in Wikipedia and math sources such as those it listed following its response. Green's Theorem was the bugaboo of a Senior-level course in Physics I took many, many years ago.

Here we see BARD doing less linguistic generation and more copying of sources.




Saturday, April 22, 2023

Bard versus BARD

 kw: analysis, artificial intelligence, experimental linguistics

I was invited by Google to use BARD, their version of ChatGPT. I decided to do various experiments, not to "trip it up", as some have done, but to learn its range. In the terminology of generative language models, faulty results are called "hallucinations". The process used by BARD and its kin to produce responses is a kind of stream-of-consciousness musing based on probabilities, so in my view, it's all hallucinatory anyway! And when it's wrong, it's just wrong.

I first tested BARD against The Bard with three prompts. I will comment after the transcript of the three results.

P07: Write a short summary, up to 300 words, of The Tempest by Shakespeare.

Bard: The Tempest is a play by William Shakespeare, probably written in 1610–1611, and thought to be one of the last plays that he wrote alone. After the first scene, which takes place on a ship at sea during a tempest, the rest of the story is set on a remote island, where Prospero, a complex and contradictory character, lives with his daughter Miranda, and his two servants: Caliban, a savage monster figure, and Ariel, an airy spirit. The play contains music and songs that evoke the spirit of enchantment on the island. It explores many themes, including magic, betrayal, revenge, and family.

Prospero is the rightful Duke of Milan, but he was usurped by his brother Antonio and his allies, the King of Naples and Sebastian. Prospero and his infant daughter Miranda were set adrift at sea, but they survived and landed on the island. Prospero used his magic to create the storm that shipwrecked his enemies on the island. He then uses his magic to control the events on the island, manipulating his enemies and testing their characters.

Prospero's main goal is to get revenge on his enemies, but he also wants to teach them a lesson about the consequences of their actions. He eventually forgives them and returns them to their rightful places in society. The play ends with Prospero giving up his magic and returning to Milan with Miranda and Ferdinand.

The Tempest is a complex and fascinating play that explores many themes. It is a story of magic, betrayal, revenge, and redemption. It is also a story about the power of love and the importance of forgiveness.

P07: Write a short soliloquy in iambic pentameter on the subject of triumph over loss.

Bard: I have lost all that I held dear,
My loved ones taken from me so soon.
I have fallen to my knees in despair,
And begged for the pain to just end soon.
 

But then I remembered something I had heard,
A saying that gave me new strength and resolve.
It said that even in the darkest of hours,
There is always hope, if we just believe.
 
So I picked myself up off the ground,
And wiped away my tears.
I knew that I had to keep going,
For the sake of those I had lost.
 
I would not let their deaths be in vain,
I would live my life to the fullest,
And make them proud.
 
I would triumph over loss,
And find joy in the world again.

[This one had two other Drafts]

 2) Soliloquy

I have lost so much, I have lost it all.
My dreams, my hopes, my loves, they all have fled.
I am left here with nothing, not even a shred
Of what I once had, of what I once held dear.
 
But I will not give up. I will not despair.
I will find a way to triumph over this loss.
I will find a way to rebuild my life, to start anew.
I will find a way to be happy again.
 
I know it will not be easy. It will take time and effort.
But I am strong. I am resilient. I will not give in.
I will triumph over this loss. I will find my way back to happiness.
 
I know that I am not alone. There are others who have lost as much as I have.
And they have found a way to move on. They have found a way to be happy again.
So I will not give up. I will find my way back to happiness.
 
I will triumph over this loss.

 

3) 

I have lost so much in this life,
I have loved and lost, and loved again.
I have cried and laughed, and felt the pain
Of heartbreak and the joy of gain.
 
But through it all, I have learned to triumph.
I have learned to rise above my pain,
To find the strength to go on,
Even when all seems lost.
 
I have learned that loss is a part of life,
But it does not have to define me.
I can choose to let it destroy me,
Or I can choose to use it as fuel to grow.
 
I choose to grow.
I choose to triumph over loss.
I choose to live my life to the fullest,
Even in the face of pain.

P07: Please write a sonnet in Shakespearean style that names Alice

Bard:

Oh, Alice, thou art fair and true and kind,
A gentle soul with beauty to beguile,
A heart that's pure and free from all guile,
A face that's bright with love and smiles divine.
 
Thy eyes are like the stars that shine at night,
Thy hair is like the raven's wing so black,
Thy lips are like the rosebud's tender pink,
Thy cheeks are like the peach's downy cheek.
 
Thy voice is like the songbird's in the dell,
Thy touch is like the zephyr's on my brow,
Thy presence like the summer's balmy spell,
Thy smile like sunshine on a winter's day.
 
Oh, Alice, thou art all that's good and fair,
A gift from heaven to bless my life here.


My evaluation:

The first paragraph of the summary of "The Tempest" is lifted directly from the Wikipedia article referenced at the end. The rest is a pretty good summary of the plot of the play. It doesn't mention the Masque, or play-within-a-play, found in the last Act.

The soliloquy is presented in three versions. Frequently BARD has produced three drafts and then has presented the one it "thinks" is most likely to fulfill the prompt. None of the three drafts comes even close to Iambic Pentameter in more than a handful of lines. All three are much closer to "free verse" (which I don't consider to be verse at all). The second stanza of the second draft can be most easily reworked into IP:

But I will not give up, will not despair.
I'll find a way to triumph o'er this loss;
Rebuild my life; a way to start anew.
And find a way to happiness regain.

The sonnet's rhyme scheme is messed up. It should be ABAB CDCD EFEF GG. Instead it is ABBA CDEF GHGI JJ. Rhyming "kind" with "divine" is OK; Shakespeare did worse. Also, switching the 3rd and 4th lines of the first stanza would fix the rhymes, and the 3rd line needs a syllable somewhere to match the meter, perhaps adding a short adjective before "guile". The other two quatrains are irredeemable. Were I grading this for a middle school student, it would get a "B".

There you have it. BARD is fun. BARD is growing. It will be interesting to rerun these prompts in another year or two. I ran other experiments, to be reported soon.