Bing AI - Write a Ring Program to do a Transformation Matrix

60 views
Skip to first unread message

Bert Mariani

unread,
Mar 1, 2024, 10:46:41 AM3/1/24
to The Ring Programming Language
Hello ALL

2 Examples of asking Bing AI to write a Transformation Matrix to rotate a graph.
First it decided to work with only 1 point.
Second I asked it to work with 4 points

Its definitely not there yet. 
I see copy/paste of snippets of some code it found in a search,
 but  no proper logic or understanding of how to combine the x,y,z matrices into one

As for C ... I recommend buying a C-Book and learning the language yourself  
rather then depending on something else, where you don't know what its doing.

=================================
Example 1
=================================
Line 21 Error (R2) : Array Access (Index out of range)
in file C:/MyStuff/AA-Matrix/Bing-AI-Rotate-A-Point-1.ring

      ==>  point[0],   not starting index at 1

// You
// write a Ring language program to do create Transformation vector to rotate  a 3D graph
// Copilot
// Certainly! Let’s create a simple Ring language program to perform a 3D rotation on a vector. In this example, I’ll demonstrate how to construct a rotation matrix to rotate a 3D point around one of the coordinate axes.

# Define a 3D point (x, y, z)
point = [1.0, 2.0, 3.0]

# Define the rotation angle in radians (e.g., 45 degrees)
theta = 45.0 * (3.14159 / 180.0)  # Convert degrees to radians

# Create a rotation matrix for rotation around the X-axis
rotation_matrix_x = [
    [1.0, 0.0, 0.0],
    [0.0, cos(theta), -sin(theta)],
    [0.0, sin(theta), cos(theta)]
]

# Apply the rotation
new_point_x = [
    point[0],
    point[1] * cos(theta) - point[2] * sin(theta),
    point[1] * sin(theta) + point[2] * cos(theta)
]

# Print the original and rotated points
println("Original point: (${point[0]}, ${point[1]}, ${point[2]})")
println("Rotated point (around X-axis): (${new_point_x[0]}, ${new_point_x[1]}, ${new_point_x[2]})")

//In this program:

//point represents the original 3D point.
//theta is the rotation angle (in radians) around the X-axis.
//The rotation matrix rotation_matrix_x is constructed for rotation around the X-axis.
//The new point after rotation is calculated by multiplying the original point with the rotation matrix.
//Feel free to modify the rotation angle and axis to explore different transformations! 🌟


======================================
Example 2
======================================
Line 39 Error (R3) : Calling Function without definition: matrix_multiply
in file C:/MyStuff/AA-Matrix/Bing-AI-Rotate-4-Point-2.ring
   ===> combined_rotation_matrix = matrix_multiply(rotation_matrix_x, matrix_multiply(rotation_matrix_y, rotation_matrix_z))
 
Definitely Not the way to do this

//You
//write a Ring language program to do create Transformation vector to rotate  a  4 x 4 graph in x, y, z direction of 10, 15,20 degrees
//Copilot
//Certainly! Let’s create a Ring language program to perform a 3D rotation on a 4x4 graph. We’ll apply rotations around the X, Y, and Z axes by the specified angles.

# Define the rotation angles in degrees
angle_x_deg = 10.0
angle_y_deg = 15.0
angle_z_deg = 20.0

# Convert angles to radians
angle_x_rad = angle_x_deg * (3.14159 / 180.0)
angle_y_rad = angle_y_deg * (3.14159 / 180.0)
angle_z_rad = angle_z_deg * (3.14159 / 180.0)

# Create rotation matrices for each axis
rotation_matrix_x = [
    [1.0, 0.0, 0.0, 0.0],
    [0.0, cos(angle_x_rad), -sin(angle_x_rad), 0.0],
    [0.0, sin(angle_x_rad), cos(angle_x_rad), 0.0],
    [0.0, 0.0, 0.0, 1.0]
]

rotation_matrix_y = [
    [cos(angle_y_rad), 0.0, sin(angle_y_rad), 0.0],
    [0.0, 1.0, 0.0, 0.0],
    [-sin(angle_y_rad), 0.0, cos(angle_y_rad), 0.0],
    [0.0, 0.0, 0.0, 1.0]
]

rotation_matrix_z = [
    [cos(angle_z_rad), -sin(angle_z_rad), 0.0, 0.0],
    [sin(angle_z_rad), cos(angle_z_rad), 0.0, 0.0],
    [0.0, 0.0, 1.0, 0.0],
    [0.0, 0.0, 0.0, 1.0]
]

# Combine the rotation matrices
combined_rotation_matrix = matrix_multiply(rotation_matrix_x, matrix_multiply(rotation_matrix_y, rotation_matrix_z))


# Print the resulting 4x4 rotation matrix
println("Combined Rotation Matrix:")
for row in combined_rotation_matrix {
    println(row)
}

//In this program:
//
//We define the rotation angles around the X, Y, and Z axes.
//Each rotation matrix is constructed for its respective axis.
//The matrices are multiplied together to obtain the final combined rotation matrix.
//Feel free to adjust the angles or apply additional transformations as needed! 🌟

=============================
=============================






Ilir Liburn

unread,
Mar 1, 2024, 11:01:20 AM3/1/24
to The Ring Programming Language
Hello Bert,

Yes, I have plan to teach AI how to do correct Ring programming before conversion to C code using Ring2C extension can be done.
it is also necessary to do this because many programmers are using AI to write code and Ring somehow have deficit in this area.

Greetings,
Ilir

Ilir Liburn

unread,
Mar 2, 2024, 5:26:33 PM3/2/24
to The Ring Programming Language
Hello Bert,

in following study, research has revealed that artificial intelligence gives better mathematical answers if asked to act as "trekkie"

Surprisingly, it appears that the model’s proficiency in mathematical reasoning can be enhanced by the expression of an affinity for Star Trek.


Greetings,
Ilir

Bert Mariani

unread,
Mar 2, 2024, 10:01:26 PM3/2/24
to The Ring Programming Language
Hello Illir

Big Laugh hahaha ... 
I tried talking into the Mouse as Scotty did in one of the Star Trek movies ... 
But it didn't work for me either .. no response !!
Maybe I should try Dr. Spock.
All I get is "2001 A Space Odyssey" ... HAL to Dave  "Sorry Dave, I can not do that."

Mahmoud Fayed

unread,
Mar 3, 2024, 7:22:13 AM3/3/24
to The Ring Programming Language
Hello Ilir, Bert

>> "in following study, research has revealed that artificial intelligence gives better mathematical answers if asked to act as "trekkie""

Updating the prompt is a known technique that open the way to a lot of research ideas.
idea.png
This table from the research paper looks interesting.

table.png

Greetings,
Mahmoud

Mansour Ayouni

unread,
Mar 3, 2024, 7:34:24 AM3/3/24
to Mahmoud Fayed, The Ring Programming Language
Hello Mahmoud,

Can you please share a link for the study...

Prompting by design is the most important subject I'm focusing on in the research I'm making around ZaiLib. My objective is to turn prompting into a kind of structured programming experience inside the Ring code...

Hopefully, I discovered a couple of months ago a research team who worked on that exact problem, and delivered a beautiful concept of SQL-Like prompting language we can use inside our codes, without being experts in prompting divers LLMS!

Here is the study PDF. And this is the link of their language website (which I discovered today when I came back to their GitGub repo after your message):


All the best,
Mansur

--

---
You received this message because you are subscribed to the Google Groups "The Ring Programming Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ring-lang+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ring-lang/d62bf9a4-c71e-419e-92a4-679d4ce3d192n%40googlegroups.com.
prompting is programming.pdf

Mahmoud Fayed

unread,
Mar 3, 2024, 7:36:50 AM3/3/24
to The Ring Programming Language
Hello Mansour

>> "Can you please share a link for the study..."

The HTML version of the study is already shared by Ilir in previous pos in this topic

This is the PDF version: arXiv:2402.10949v2 [cs.CL] 20 Feb 2024

Greetings,
Mahmoud

Mansour Ayouni

unread,
Mar 3, 2024, 8:24:11 AM3/3/24
to Mahmoud Fayed, The Ring Programming Language
Thank you Mahmoud, and thank you Ilir for the link.

The study uses what the AI research calls Chains Of Thoughts...

At a conceptual  level, it's more or less the same concept I crafted, at least 3 years ago, in the semantic layer of SoftanzaLib, in stzChainOfTruth and stzChainOfValue classes.

The difference is that the machine learning industry needs it to (try to) synthesis the thinking flow inside the LLM blackbox, while I use it as a transparent symbolic synthesiser of the thinking flow in "traditional" computar code and algorithms.

If you are interested, look at this example of Ring code:

image.png

Now you can imagine the rest of the story...

Philosophically speaking, I believe the future of programming is a kind of combination between symbolic intelligence (PROLOG-Like) and statistical intelligence (LLM-Like), and that humanity should not leave itself, entirely, in the hands of uncontrollable AIs.

After skipping the AGI hype, in the-not-to-distant future, and after seeing some of its dangerous applications when AGIs are combined with robots (OpenAi started a program like that last week), and when those robots will be used in making war crimes against humanity, there here will be a vivid resistance movement in the tech community towards a really responsible and controllable programming style (not like the one promoted by GAFA under the motto "Responsible AI').  

I feel being part of the movement, since now, and ZaiLib would be a modest POC that this vision I'm thinking of is not only necessary but also very useful in many human-friendly AI applications.

All the best,
Mansour


Best,
Mansour

Reply all
Reply to author
Forward
0 new messages