chatGPT vs Gemini: A Comparison from a Physical Model Perspective

Which Performs Better: chatGPT’s Successor Gemini?

I asked both, “Which has higher performance, chatGPT or Gemini?” As of April 2023, chatGPT doesn’t recognize the term “Gemini.” According to Gemini, however,

ChatGPT

Strengths:

  • Fact-based accuracy
  • Ethical considerations
  • Computational efficiency

Weaknesses:

  • Creative writing
  • Humorous writing
  • Multilingual support

Gemini

Strengths:

  • Creative writing
  • Humorous writing
  • Multilingual support

Weaknesses:

  • Fact-based accuracy
  • Ethical issue
  • Computational cost

As previously introduced in this blog, we wondered how the March 2024 versions of chatGPT 4 and Gemini Advanced would handle solving a physical model’s Matlab code.

↓ First, chatGPT’s approach

function pendulum_simulation
    m = 1;      % Mass
    c = 0.1;    % Damping coefficient
    k = 10;     % Spring constant
    F = 1;      % Magnitude of external force

    % Time range and initial conditions
    tspan = [0 10]; % Time range for the simulation
    x0 = [0; 0];    % Initial displacement and velocity

    % Solve the system using an ODE solver
    [t, x] = ode45(@(t, x) system_dynamics(t, x, m, c, k, F), tspan, x0);

    % Plot the results
    figure;
    plot(t, x(:,1));
    title('Displacement over Time');
    xlabel('Time (s)');
    ylabel('Displacement (m)');
end

function dxdt = system_dynamics(t, x, m, c, k, F)
    % Displacement and velocity
    x1 = x(1);
    x2 = x(2);

    % External force (constant in this example)
    % In real problems, you may need to define it as a time function, f = F(t).
    f = F;

    % Convert the second-order differential equation to a system of first-order equations
    dx1dt = x2;
    dx2dt = (1/m)*(f - c*x2 - k*x1);

    % Return the results
    dxdt = [dx1dt; dx2dt];
end



Impressive. The approach differs slightly from last time, but it’s still valid.

Next, Gemini’s approach.

% Parameters of the physical model
R = 1; % Ohm
L = 1; % Henry
C = 1; % Farad

% State equations
xdot = [
  -R/L * x(1) - 1/L * x(2)
  1/C * x(1) - 1/RC * x(2)
];

% Output equations
y = [
  x(1)
];

% Initial conditions
x0 = [
  1
  0
];

% Simulation time
t = 0:0.01:10;

% Execute simulation
[t, x] = ode45(@(t, x) xdot, t, x0);

% Display results
plot(t, x)
xlabel('Time (s)')
ylabel('State variables')



???

It seems there was a mix-up with an electrical model example. Indeed, it’s still a system of second-order differential equations, but the response was a bit off-target.

In conclusion, chatGPT responds more directly to the asked questions.
Therefore, I prefer chatGPT♡

That’s all for today,
Thank you for reading till the end.
Love & Respect♡
Hiroki🐶