Problem A: Solar Sailing to Mars
Team # 678
Abstract
In this paper, we have worked out the problem of finding the optimum flight
plan for a spacecraft, launched from Earth, to Mars, completely propelled by
solar sails. In addition, there is a constraint of 2000 kgs on the total mass of
payload plus the solar sail and fixed surface density of 7 g/m2 for the solar sail.
Also, the spacecraft is initially given the escape velocity of Earth.
In the present study, we have first identified the nature and form of the ra-
diation pressure force and gravitational force on the spacecraft. The equations
governing the motion of the spacecraft were arrived at. It was observed that the
equations are very difficult to solve analytically. Hence, we solved them numer-
ically using fourth-order Runge-Kutta method. After that, a cost comparison
is done with NASA’s Opportunity Rover. We found out that the maximum
payload mass that our spacecraft can carry lies in the range of 450-650 kgs and
the time of flight between 381-449 earth days.
We find that the spacecraft is successful in increasing the payload to pro-
pellant ratio to around 10 orders of magnitude larger than the that of Mars
missions like Mangalyaan(MOM orbiter) and MEVAN. However, the time of
transit is nearly 100-150 days more than the other missions.
1
Problem A Team # 678
Contents
1 Background 3
2 Introduction 4
3 A Rough Sketch of the Mission 6
4 Theory 6
4.1 Radiation Pressure . . . . . . . . . . . . . . . . . . . . . . . . . . 6
4.2 Gravity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
4.3 The Equations of Motion of the Spacecraft . . . . . . . . . . . . 7
5 Solving the Equations of Motion 8
5.1 Why the Analytic Method won’t Work . . . . . . . . . . . . . . . 8
5.2 Fourth-order Runge-Kutta Solution . . . . . . . . . . . . . . . . . 8
6 Analysis 9
6.1 The Parameters Involved . . . . . . . . . . . . . . . . . . . . . . 9
6.2 Optimization Process . . . . . . . . . . . . . . . . . . . . . . . . . 9
6.3 Understanding the Results . . . . . . . . . . . . . . . . . . . . . . 10
6.4 Simulation Results . . . . . . . . . . . . . . . . . . . . . . . . . . 11
7 Comparison with Thrust-Engine Spacecrafts 11
8 Steering Mechanism 12
9 Power Generation 13
10 Physical structure of solar sails 14
11 Comparison with Recent Mars Missions 14
2
Problem A Team # 678
1 Background
The first unmanned space-probe Sputnik I was launched in 1957. This can offi-
cially be regarded as the dawn of the space age. Since then, the propellant fueled
thrusting technology has heavily improved to provide the necessary propulsion
to almost all of the space missions and satellites. Recently, many novice yet
innovative and efficient technologies have been developed by researchers around
the world. Sailing spacecrafts, making use colossal sails (like in sailboats but
orders of magnitude larger) using the radiation pressure of sun, though ap-
pearing to be more of science fiction at first sight, has emerged as one of the
most promising techniques. The idea was first proposed by Russian and soviet
rocket scientist Konstantin Tsiolkovsky. The first serious research was done by
Friedrich Zander when he published a technical paper in 1925 including a tech-
nical analysis of solar sailing. The first formal technology and design effort for
a solar sail began in 1976 at Jet Propulsion Laboratory for a proposed mission
to rendezvous with Halley’s comet. JAXA successfully tested the first space-
craft to succeed in spaceflight, IKAROS in 2010. NASA successfully deployed
NanoSail-D in Low Earth Orbit in 2011.
3
Problem A Team # 678
2 Introduction
Since the early years if the space age there have been many attempts to develop
cheap and efficient propulsion technologies that can replace the traditional pro-
pellant fueled thrusters. Now with increasing human knowledge and capacity,
new frontiers are opened up that require exceedingly longer and sophisticated
space endeavours to be undertaken. Interplanetary travel is one such feat that
require massive use of fueling resources, that poses a risk on Earth’s resources
and immediately puts at question, the feasibility and practicality of such a mis-
sion.
Mars is the most extensively studied planet as of today, with numerous
orbiters and surface rovers studying it at the same time. Currently six orbiters
and two rovers are actively studying mars, and numerous missions have been
completed. The main reasons are its proximity to earth, rocky structure, thin
atmosphere and sustainable temperature (as against Venus or mercury which
have either tremendous surface temperature or thick atmosphere). Colonisation
of mars is one of the serious possibilities in far future.
Recently in 2013, ISRO successfully launched Mangalyaan,the cheapest ever
space mission to Mars at around $74 million. While the MEVAN mission at
around the same time cost around a whooping $671 million. While a manned
mission to mars is estimated by NASA to cost a gigantic $100 billion. A big
chunk of the mass composed of the propellant itself. Again, the very small
payload to total mass ratio is one of the biggest concerns for the whole value
of a mission itself because it limits the number of instruments, components and
people.
Solar sail technology provides us with a great option to significantly reduce
many of the aforementioned shortcomings of traditional rocket propulsion sys-
tems. Solar sails work on the principle of radiation pressure, which is based on
mass-energy equivalence. Photons have no mass but carry momentum. When
electromagnetic radiations from sun strikes the huge sails of the spacecraft, it
reflects it and the net effect is generation of a force perpendicular to the sail
(for perfect reflection and perfect plane sails).
The force is however very small for a massive spacecraft, even for a large area
of sails.The total force exerted on an 800 × 800 meter solar sail, for example, is
about 5 newtons at Earth’s distance from the Sun. However, over a long span
of time the momentum adds up and spacecraft can achieve cosmic speeds. Thus
solar sails can significantly reduce the cost, with comparable transit time for
the mission. We also find that the payload to total mass ratio is increased upto
10 to even 100 times of that of Mangalyaan or MEVAN.
However, radiation can provide kind of a uniform momentum flow and unlike
thrusters, we cannot provide spacecraft with a large momentum in a short time.
Also we face the problem of steering the sails over the course of the trajectory to
adjust for the forces in tangential and radial directions, for optimising the path.
Traditional spacecrafts can have very effective local attitude control systems
which the solar sails lack due to very huge size.
For the current mission, the total mass is fixed at 2000 kilograms, hence,
4
Problem A Team # 678
assuming a square shaped sail, the upper limit of the side length of the sail is
534.52 meters. We thus have a task to increase the payload size. But as the
total mass is constant, increasing the payload size leaves lesser mass for sails
and thus lesser surface area which in turn compromises with the maximum force
that could be extracted from the radiation pressure. This has a direct effect on
the overall flight time.Thus, the problems boils down to finding an effective
trajectory and optimising the flight plan so as to have a maximum payload size
with a decent travel time.
Even if the cost is viable, there are concerns of higher importance to mission
like the Payload to fuel ratio, Total time of transit and potential reusability.
Payload to fuel ratio for Mangalyaan was at around 0.0157 and it took nearly
298 days to trans.
5
Problem A Team # 678
3 A Rough Sketch of the Mission
Our mission will be divided into three parts:
• Stage 1: Exit from the Earth’s sphere of influence.
• Stage 2: The journey from Earth to Mars.
• Stage 3: Entry into Mars’s sphere of influence.
The spacecraft is initially given some push by a rocket. The purpose of the
rocket is just to expel the spacecraft from Earth’s gravity.
The challenging part of the mission is to guide the spacecraft in the second
Stage. We want to accelerate the spacecraft towards Mars, initially; but at
a later stage, we also want to decelerate the spacecraft to reduce the relative
velocity between it and Mars.
We can see that by keeping the sails at a certain angle, we are able to
accelerate the spacecraft and by keeping the sails at some other angle, we can
decelerate it. So, the plan is to accelerate the spacecraft until a certain radial
distance from the Sun, and then to decelerate it.
4 Theory
4.1 Radiation Pressure
According to Maxwell’s theory of electromagnetism, light is an electromagnetic
wave which caries momentum. Whenever a wave of light bounces off a surface,
it changes its direction of motion; hence changing its momentum. This change
in momentum imparts a force on the surface. The pressure generated by this
force is called radiation pressure.
Consider a beam of light with intensity I incident on a mirror at an angle
θ with the normal. There is no change in momentum of the light beam along
the surface of the mirror. The change in momentum of the beam in the normal
direction, in a time interval dt is 2dpcos(θ).
Figure 1: Beam of light imparting momentum to mirror
6
Problem A Team # 678
2dpcosθ dE
Hence the force exerted on an area A is: dt . Since dp = c , we have:
2dEcosθ F 2Icos2 (θ)
F = dt .Hence, the pressure due to this radiation is: = A c .
The Sun is a ball of fire constantly emitting radiation. If the Sun emits a
total power of P , then the intensity of the radiation at distance of r from the
P
Sun is: I = 4πr 2.
We will assume the sail of our spacecraft to be a square sheet made up of a
highly reflective material. Hence, if the spacecraft is at a distance of r from the
Sun and the normal vector to the surface of the sail makes an angle of δ with
the radius vector, then the force experience by the satellite will be inversely
proportional to r2 , proportional to the area of the sail, and proportional to
cos2 δ. The force will act normally to the sail.
4.2 Gravity
The satellite, when in free space will experience a gravitational force due to the
Sun, Earth and Mars.
The problem of handling three gravitational forces can be simplified by mak-
ing use of the concept of a sphere of influence. Whenever we want to calculate
the gravitational field at a point in space due to two bodies, one massive and
one relatively smaller, we divide the whole space into two parts. In one part,
the gravitational force due to the massive body is dominant, and in the other
part the gravitational force due to the other body is dominant.
We are aided by a rocket for the first stage of the mission, which can provide
an energy equivalent to the escape velocity of Earth. That is, at the end of the
first stage, our spacecraft will be just outside the sphere of influence of Earth
and will be following the orbit of Earth around the Sun.
Hence, in the second stage of the mission, we are in the sphere of influence
of the Sun. That is, the gravitational force that the spacecraft will experience
will be due to the Sun’s gravity.
4.3 The Equations of Motion of the Spacecraft
Consider the Sun to be at the origin of our coordinate system. The following
notation will be used for our analysis:
n̂ = Normal to surface of the sail.
r̂ = Normal radial vector.
θ = Angle between n̂ and the x-axis.
φ = Angle between radius vector and x-axis.
δ = Angle between n̂ and r̂
The forces acting on the spacecraft are:
2
• The force due to radiation pressure: AA0 cos
r2
(δ)
, in the n̂ direction, where
A0 is a constant and A is the sail area.
B0
• The force due to Sun’s gravity: r2 , in the negative r̂ direction.
7
Problem A Team # 678
Figure 2:
Hence, we can write two force equations:
For the radial direction:
AA0 cos3 δ B0
m(r̈ − rφ̇) = − 2
r2 r
For the tangential direction:
AA0 cos2 δsinδ
m(2ṙφ̇ + rφ̈) =
r2
5 Solving the Equations of Motion
5.1 Why the Analytic Method won’t Work
Solving system of two second order differential equations of two dependent vari-
ables analytically would be challenging without using appropriate assumptions.
These assumptions would inevitably introduce errors in our calculations. Hence,
we chose to solve the equations numerically.
5.2 Fourth-order Runge-Kutta Solution
Runge-Kutta method would not only give us a good approximation of the tra-
jectory of the spacecraft, but also would finish the task in a short time.
In order to invoke the R-K method, we write the equations as four first order
equations of four variables (r, ṙ, φ, φ̇) dependent on t.
We replace ṙ by s and φ̇ by p. Hence, we get the following four equations:
ṙ = s
φ̇ = p
A0 cos3 δ − B0
ṡ = rp2 +
mr2
−2sp Acos2 δsinδ
ṗ = +
r mr3
8
Problem A Team # 678
6 Analysis
6.1 The Parameters Involved
The mission should start when Mars is at a point closest to Earth. Since the
eccentricity of Earth’s orbit is less than 0.02, we can assume it to be circular.
However, the eccentricity of Mars’s orbit is around 0.0934. Hence, we assumed
Mars’s orbit to be elliptic.
The second stage of the mission is divided into two parts: in the first part,
the rocket is given a constant push until it reaches a certain radial distance, and
then the second part in which it experiences a constant pull.
In our simulation, we have θ−φ = δ (constant) in the first case and θ−φ = −δ
in the second. This will ensure that the spacecraft always gets a constant push
or pull.
The parameters and constants involved in the analysis are:
Area of sail = A
Radius of Earth’s orbit = r0
Angular velocity of Earth’s orbit = w0
Initial radial position of Mars = rm0
Initial angular velocity of Mars = wm0
µ, where rm01+µ+µr0
is the angular position of the spacecraft when it first begins
to decelerate.
The orientation of the spacecraft = δ
The number of days required to complete the mission.
The condition given is that the velocity of approach towards mars should be
less than 9 km/s.
The parameters that we can manipulate are: A, δ, µ.
6.2 Optimization Process
We have three parameters that we can manipulate. We calculated µ for certain
values of A and δ. The results are shown in the following table:
9
Problem A Team # 678
4δ
A(m2 ) π (radians) µ days velocity of approach (m/s)
200000 0.40 0.34 419 6963
200000 0.42 0.36 418 7009
200000 0.44 0.37 418 7108
200000 0.46 0.38 417 7142
200000 0.48 0.39 418 7227
200000 0.50 0.39 418 7390
200000 0.52 0.38 420 7472
200000 0.54 0.38 421 7543
200000 0.56 0.37 423 7616
200000 0.58 0.35 425 7689
200000 0.60 0.34 427 7755
200000 0.62 0.32 430 7820
200000 0.64 0.30 433 7887
190000 0.40 0.10 443 6906
190000 0.42 0.12 441 6994
190000 0.44 0.14 440 7085
190000 0.46 0.16 440 7184
190000 0.48 0.17 440 7266
190000 0.50 0.18 441 7343
190000 0.52 0.17 442 7435
190000 0.54 0.17 443 7537
190000 0.56 0.17 444 7570
190000 0.58 0.16 446 7648
190000 0.60 0.15 448 7719
220000 0.34 0.87 383 6792
220000 0.36 0.89 382 6891
220000 0.38 0.91 381 6984
220000 0.40 0.92 381 7034
220000 0.42 0.92 381 7165
220000 0.44 0.92 381 7248
220000 0.46 0.91 381 7290
220000 0.48 0.90 382 7371
220000 0.50 0.88 383 7491
6.3 Understanding the Results
It is seen that as payload capacity of our mission can be increased, i.e. area
A of sail can be decreased, at the cost of time taken to reach Mars. Again,
relative velocity of approach to Mars is higher for larger payload capacity. This
increases our chances of missing Mars. Hence, we need to strike a balance
between payload capacity and the optimum mission path.
10
Problem A Team # 678
6.4 Simulation Results
The following simulation has been performed for the values: A = 200000m2 , µ
π
= 0.34 and δ = 10 .
Figure 3: Red orbit = Mars, Blue Orbit = Earth, Black Orbit = Spacecraft
7 Comparison with Thrust-Engine Spacecrafts
Rockets and sails both have the same roles: to provide propulsion. However,
there is a marked difference between the way two work and control the trajectory
of a spacecraft. While rockets can provide huge thrusts for short amounts of
time, solar sails can provide a small, but continuous thrust. Again, rockets are
far more complicated to operate than solar sails.
The major complications with using rockets are:
• Engines, fuel tanks and piping systems may be extremely complicated to
design. Moreover, when designing missions to Jupiter, Saturn or other
far off celestial bodies, one important parameter to consider is the proba-
bility of pumps and engines being functional after being dormant for years.
• Rockets face problem of storing various kinds of fuels: cryogenic fuels re-
quire low temperatures, hypergolic fuels require extreme care while storing
and handling, and so on. Furthermore, solid propellants, which are easily
stored, face problem of stopping, once ignited, and throttling.
11
Problem A Team # 678
• Sometimes, more than 80 per cent of the mass of the rocket is the propul-
sion system, which includes engine, fuel, fuel tank, nozzles, and piping
system. This in turn means that a large amount of fuel is used to propel
fuel itself. Thus, the mass of scientific equipment that can be placed on-
board is very little.
• Rocket failures can be very nasty. Death of those onboard on Space Shut-
tle Columbia on 1st February, 2003 was a very unfortunate event. Failure
to contain the chemical reaction, leaks in pipes or tanks, or any other
cause may be several of the causes for rocket blasts.
On the other hand, solar sails are very simple to handle. They do not
require to carry much fuel; hence, large proportion of spacecraft’s mass can be
the payload. Also, they can get constant thrust, as opposed to transient thrust
in case of rockets. This implies that, although sails start off slowly, they can,
over the time, pickup velocities larger than those of rocket-propelled ships. This
reduces the time of the mission, even as it increases the payload capacity.
However, solar sails suffer from these major drawbacks:
• Solar sails cannot provide very high impulse in a short time. At any in-
stant, solar sails cannot increase the momentum of the spacecraft beyond
a fixed maximum. Thus Hohmann transfer, which is the most efficient
orbital transfer mechanism for rocket engine, involving high impulses at
specific points in the orbit, cannot be used for a solar sail.
• Solar sails cannot be opened before crossing the GEO (Geosynchronous
Earth Orbit), since large amounts of space debris in this region can harm
the fragile sails.
• Solar sails cannot be used to decelerate the spacecraft radially, since no
orientation of the sail can provide it force towards the centre of the solar
system.
• Solar sails cannot provide thrust large enough to escape Earth, or to safely
land on other heavenly bodies. For this purpose, rockets are the only op-
tion.
8 Steering Mechanism
Angle of solar sails with respect to the sun is a crucial parameter: it is the factor
that determines the thrust that the sail is experiencing. It directly affects the
12
Problem A Team # 678
flight trajectory. This information of the angle of orientation of the sails with
respect to the position vector from the sun is contained in the angle , taken with
respect to reference axis (refer the equations of motion).
It is necessary that we have control of the orientation of the sails. To establish
this, we thought of using gyroscope to change the alignment of our ship. By law
of conservation of angular momentum, if we rotate the gyroscope anti-clockwise
at huge angular velocity, the ship will rotate clockwise with a small angular
velocity, and vice versa, due to large ratio in the moment of inertia of ship and
gyroscope.
By Conservation of Angular Momentum, we have I1 (ω1 − ω2 ) = I2 ω2 . Since,
the gyroscope is rotating with angular velocity ω1 with respect to frame attached
to the spacecraft, its angular velocity with respect to sun is ω1 − ω2 . Here, I1
is moment of inertia of gyroscope, and I2 is moment of inertia of spacecraft
without the gyroscope, both about the axis of gyroscope. Thus, power required
is given by P = Iω ω̇, where I = I1 + I2 .
For calculation of moment of inertia, we assume that large proportion of
moment of inertia would be due to sails. Since sails are square in shape, with
approximate area of 2 × 105 m2 and mass of 1450 kg, moment of inertia of sails
would be about 2.5 × 107 kg.m2 (using I = ma2 /12). For moment of inertia of
the spacecraft, essentially close to the axis of gyroscope, is small, we neglect it.
The rate at which we need to rotate sails is equal to φ̇, because θ = φ + δ.
Hence θ̇ = φ̇ (δ = constant). ω = φ̇ = 3 × 10− 7 (maximum possible value).
Further, ω̇ is very negligible, due to very small values ω, and large time duration
involved.
Hence, P = Iω ω̇ = 7.5ω̇, which is very small number. Power required by
gyroscope would be negligible compared to other equipments. So, we neglect it.
9 Power Generation
On spacecrafts with solar rays as the primary source of propulsion, one feasible
way of power generation is using solar cells. Assuming power requirements of 3
kW for electronics, gyroscope, and other equipments; and power to mass ratio
of 300 W/kg for high efficiency power cells, we would need around 18 kg of solar
panels, considering fall in intensity of sunlight due to increase in radial distance.
Although a feasible power source, solar panels come with their own draw-
backs. The radiation pressure of sun would also affect solar panels, but this
time the thrust would not be perpendicular to solar panels. Instead, sun’s rays
would constantly push solar panels in radial direction, since solar panels absorb
photons instead of reflecting. This would create errors in our analysis. Hence,
we would have to periodically monitor the path of the spacecraft, correcting for
errors.
13
Problem A Team # 678
10 Physical structure of solar sails
In our case we replicate the structure of the solar sales to be the same as that
demonstrated by NASA in the solar sails demonstrator ‘sunjammer’. The shape
of sails can thus be approximated to be a square with a hole at the centre where
the payload would be placed. The payload has its own solar panels for power
generation so that it can be used for powering the necessary electronics, the
gyroscopic steering system and temperature maintenance of the assembly.
The main component of solar sails is Aluminium. However alloys of Lithium,Beryllium
and Magnesium with Aluminium or with each other prove to be very good re-
flectors. However polymers like Mylar can also be used. The mass of sails
comes out to be nearly 1500 kgs and hence the cost is mainly limited by the
manufacturing process for such a delicately thin sail.
11 Comparison with Recent Mars Missions
Any general space mission intended to reach a solar system body consists
of 3 main stages: The launch stage, the cruise stage and orbital injection
stage(followed by a descent and landing stage in case of surface landing mis-
sions)
Solar sails are used over most of the part of the 2nd stage and that’s where a
comparison can be made with any other spacecraft, because other 2 stages are
similar for both the cases and rocket thrusting is inevitable. However it should
be noted that the cruise stage occupies a very high proportion of the travel time
and as such time of cruise stage can be equated to the total time within very
less errors.
In our study we found that the spacecraft along with the solar sails take
around 381-449 earth days in the cruise stage, which is nearly the total mission
time. And the payload size is at 450-650 kgs out of a total 2000 kgs of mass.
Thus, if the rest of the mass(i.e. Mostly the mass of sails and its framework) is
considered as mass of the propelling systems, then,
Payload fuel-fraction, r = mass of payload/mass of propelling system
For our case minimum value of r = 450/1550=0.2903
For the case of Mangalyaan(MOM), r = 13.4/852 = 0.0157 and total time
of transit = 298 days. For the case of MEVAN, r = 65/1645 = 0.0395 and total
time of transit = 308 days. For the case of opportunity rover spacecraft, r =
1013/50 = 20.26
We see a very clear rise in the payload size to nearly 10 times from the first
two cases. However the 3rd case leads on to a completely different scenario.
This can be explained with initial velocity relative to earth. A most common
maneuver that is employed in almost all of the rocket propelled space missions
is that main rocket assembly gives them a very high initial velocity relative
to Earth, after they have escaped escaped the gravity field of the Earth. The
velocity is of the order of Km/sec. If the spacecraft weighs around 103 kgs
and maximum initial velocity is of the order of 103 m/s then the kinetic energy
14
Problem A Team # 678
imparted by burning the fuel is of the order of 109 joules. This would however
require a huge amount of fuel, thereby increasing the cost. In our case we
have started with initial zero velocity and the payload is enough to carry a 2
opportunity like rovers(each 185 kgs) to Mars.
Appendix
Code
f u n c t i o n [ r , phi , s , p , r m , phi m , v r e l , d i s t r e l , in , days , v f , r e , p h i e ] =
%o u t p u t f i l e = ’ output . txt ’ ;
%outID = f o p e n ( o u t p u t f i l e , ’w ’ ) ;
A = A 0∗ A s ;
in = 0;
days = 0 ;
v f = 0;
y = zeros (4 , n ) ;
y m = zeros (4 , n ) ;
y m (1 , 1) = R m;
y m (2 , 1) = 0 ;
y m (3 , 1) = 0 ;
y m (4 , 1) = w m;
y(1 , 1) = r 0;
y(2 , 1) = phi 0 ;
y(3 , 1) = s 0;
y(4 , 1) = p 0;
r e = ones (1 , n ) ;
r e = 149597870700∗ r e ;
phi e = zeros (1 , n ) ;
f u n c t i o n [ d e l t a ] = d e l t a ( r , R m , r 0 , mu, gamma)
i f ( r <(R m+mu∗ r 0 )/(1+mu) )
d e l t a = gamma ;
else
d e l t a = (−gamma ) ;
end
end
f u n c t i o n [ k ] = f u n c ( y n , t n , A, B, m, R m , r 0 , mu, gamma)
k = zeros (4 , 1);
k(1) = y n (3);
15
Problem A Team # 678
k(2) = y n (4);
k ( 3 ) = y n ( 1 ) ∗ ( y n ( 4 ) ) ˆ 2 + ( (A/m) ∗ ( c o s ( d e l t a ( y n ( 1 ) , R m , r 0 , mu, gamma)))ˆ3 −(B
k ( 4 ) = −2∗y n ( 3 ) ∗ y n ( 4 ) / y n ( 1 ) + (A/m) ∗ ( c o s ( d e l t a ( y n ( 1 ) , R m , r 0 , mu, gamma ) ) ) ˆ
end
f u n c t i o n [ k ] = funcm ( y m , B m)
k = zeros (4 , 1);
k(1) = y m (3) ;
k(2) = y m (4) ;
k ( 3 ) = y m ( 1 ) ∗ ( y m (4))ˆ2 −B m/ ( y m ( 1 ) ) ˆ 2 ;
k ( 4 ) = −2∗y m ( 4 ) ∗ y m ( 3 ) / y m ( 1 ) ;
end
last = 1;
for i = 2:n
k1 = f u n c ( y ( : , i −1) , t ∗ ( i −2) , A, B, m, R m , r 0 , mu, gamma ) ;
k2 = f u n c ( y ( : , i −1)+k1 ∗ t / 2 , t ∗ ( i −3/2) , A, B, m, R m , r 0 , mu, gamma ) ;
k3 = f u n c ( y ( : , i −1)+k2 ∗ t / 2 , t ∗ ( i −3/2) , A, B, m, R m , r 0 , mu, gamma ) ;
k4 = f u n c ( y ( : , i −1)+k3 ∗ t , t ∗ ( i −1) , A, B, m, R m , r 0 , mu, gamma ) ;
y(: , i ) = y(: , i −1) + t ∗ ( k1+2∗k2+2∗k3+k4 ) / 6 ;
km1 = funcm ( y m(: , i −1) , B m ) ;
km2 = funcm ( y m(: , i −1)+km1∗ t / 2 , B m ) ;
km3 = funcm ( y m(: , i −1)+km2∗ t / 2 , B m ) ;
km4 = funcm ( y m(: , i −1)+km3∗ t , B m ) ;
y m(: , i ) = y m(: , i −1) + t ∗ (km1+2∗km2+2∗km3+km4 ) / 6 ;
y e ( i ) = t ∗ ( i −1)∗2∗ p i / ( 3 6 5 . 2 5 ∗ 2 4 ∗ 3 6 0 0 ) ;
i f ( ( ( y ( 1 , i ))ˆ2+( y m ( 1 , i ))ˆ2 −2∗ y ( 1 , i ) ∗ y m ( 1 , i ) ∗ c o s ( y ( 2 , i )−y m ( 2 , i ) ) ) ˆ . 5 <
in = 1;
days = ( i ∗ t ) / ( 2 4 ∗ 3 6 0 0 ) ;
last = i ;
break ;
end
end
r = y(1 , : ) ;
phi = y(2 , : ) ;
s = y(3 , : ) ;
p = y(4 , : ) ;
r m = y m(1 , : ) ;
phi m = y m ( 2 , : ) ;
s m = y m(3 , : ) ;
16
Problem A Team # 678
p m = y m(4 , : ) ;
v r e l = ( ( s m−s ) . ˆ 2 + ( r m . ∗ p m−r . ∗ p ) . ˆ 2 ) . ˆ . 5 ;
d i s t r e l = ( r m .ˆ2+ r .ˆ2 −2∗ r m . ∗ r . ∗ c o s ( phi m−p h i ) ) . ˆ 2 ;
v f = v rel ( last );
%f p r i n t f ( outID , ’%.8 f \ t %.8 f \ t %.8 f \ t %.8 f \ t %.8 f \ t %.8 f \n ’ , [ r ; p h i ; s ; p ; v r e
end
o u t p u t f i l e = ’ output . txt ’ ;
outID = f o p e n ( o u t p u t f i l e , ’w ’ ) ;
for i = . 4 : . 0 1 : . 6
br = 0 ;
days = 0 ;
mu = . 3 ;
j = 0;
w h i l e ( br == 0 && mu < 1 0 )
[ ˜ , ˜ , ˜ , ˜ , ˜ , ˜ , ˜ , ˜ , br , days , vr ] = RK delta ( 2 . 0 4 0 3 6 6 3 7 ∗ 1 0 ˆ 1 7 , 2 6 5 5
mu = mu + 0 . 0 1 ;
j = j + 1;
end
f p r i n t f ( outID , ’ i = %.8 f \ t mu = %.8 f \ t days = %.8 f \ t , v e l o c i t y = %.8 f \n ’ , i ,
end
17