text:
# How to Spend Money on Public Transport Better

After four posts about the poor state of political transit advocacy in the United States, here’s how I think it’s possible to do better. Compare what I’m proposing to posts about the Green Line Extension in metro Boston, free public transport proposals, federal aid to operations, and a bad Green New Deal proposal by <NAME>.

If you’re thinking how to spend outside (for example, federal) money on local public transportation, the first thing on your mind should be how to spend for the long term. Capital spending that reduces long-term operating costs is one way to do it. Funding ongoing operating deficits is not, because it leads to local waste. Here are what I think some good guidelines to do it right are.

Working without consensus

Any large cash infusion now should work with the assumption that it’s a political megaproject and a one-time thing; it may be followed by other one-time projects, but these should not be assumed. High-speed rail in France, for example, is not funded out of a permanent slush fund: every line has to be separately evaluated, and the state usually says yes because these projects are popular and have good ROI, but the ultimate yes-no decision is given to elected politicians.

It leads to a dynamic in which it’s useful to invest in the ability to carry large projects on a permanent basis, but not pre-commit to them. So every agency should have access to public expertise, with permanent hires for engineers and designers who can if there’s local, state, or federal money build something. This public expertise can be in-house if it’s a large agency; smaller ones should be able to tap into the large ones as consultants. In France, RATP has 2,000 in-house engineers, and it and SNCF have the ability to build large public transport projects on their own, while other agencies serving provincial cities use RATP as a consultant.

It’s especially important to retain such planning capacity within the federal government. A national intercity rail plan should not require the use of outside consultants, and the federal government should have the ability to act as consultant to small cities. This entails a large permanent civil service, chosen on the basis of expertise (and the early permanent hires are likely to have foreign rather than domestic experience) and not politics, and yet the cost of such a planning department is around 2 orders of magnitude less than current subsidies to transit operations in the United States. Work smart, not hard.

However, investing in the ability to build does not mean pre-committing to build with a permanent fund. Nor does it mean a commitment to subsidizing consumption (such as ongoing operating costs) rather than investment.

Funding production, not consumption

It is inappropriate to use external infusions of cash for operations and, even worse, maintenance. When maintenance is funded externally, local agencies react by deferring maintenance and then crying poverty whenever money becomes available. Amtrak fired David Gunn when the Bush administration pressured it to defer maintenance in order to look profitable for privatization and replaced him with the more pliable Joe Boardman, and then when the Obama stimulus came around Boardman demanded billions of dollars for state of good repair that should have built a high-speed rail program instead.

This is why American activists propose permanent programs – but those get wasted fast, due to surplus extraction. A better path forward is to be clear about what will and will not be funded, and putting state of good repair programs in the not-funded basket; the Bipartisan Infrastructure Framework’s negotiations were right to defund the public transit SOGR bucket while keeping the expansion bucket.

Moreover, all funding should be tied to using the money prudently – hence the production, not consumption part. This can be capital funding, with the following priorities, in no particular order:

• Capital funding that reduces long-term operating costs, for example railway electrification and the installation of overhead wires (“in-motion charging“) on bus trunks.
• Targeted investments that improve the transit experience. Bus shelter is extremely cost-effective on this point and a federal program to fund it at a level of around $15,000/stop (not more – it’s easy to make local demands that drive it up to$50,000) would have otherworldly social rates of return. Washington bureaucrats are loath to be this explicit about what to do – they try to speak in circumlocutions, saying “standards for bus stops” instead of just funding shelter, or “transit asset management” instead of just committing to not playing the SOGR game.
• Accessibility upgrades. This require close federal control to eliminate local waste, because much of the money would be going to New York, which has a long-term problem of siphoning accessibility money to other priorities like adding station access points or repairing stations, and has a uniquely incompetent local environment when it comes to construction costs.
• Planning aid for improving bus-rail interface; these two modes are often not planned together in American cities, and commuter rail is not planned in conjunction with other modes. San Jose, for example, has a proposal for large expansion of bus service, part of which is parallel to Caltrain; the local agency, VTA, owns one third of Caltrain and could expand rail service within the county and integrate it with bus service better, but does not do so.
• Rail automation, to reduce long-term operating costs. Bus automation could go in this bucket too but is at this point too speculative; save it for one or two stimuli in the future.

Avoiding local extraction

Local government has very little democratic legitimacy. It’s based on informal power arrangements, in which direct elections play little role; partisan elections are rare and instead primaries reign with severe democratic deficits (for example, it’s hard to form any kind of base for opposition to challenge a sitting New York mayor or governor). Without national ideology to guide it, it is the domain of cranks and people with the time and leisure to attend community meetings on weekdays at 3 pm. Local community takes its illegitimate power and thieves what others create, whether it is the market or the state.

Recognizing this pattern means that federal funding should not under any circumstances coddle local arrangements. If, for example, California cannot spend money cost-effectively because it is constrained by referendum, federal funding can be used to bypass this system, but never work under its rules. If the local business community is traumatized by cut-and-cover construction in the distant past, the feds should insist that subway money that they give will be used for cut-and-cover instead of mined stations.

The typical surplus extraction pattern concerns car dominance. State DOTs are in effect highway departments; transit planning is siloed, usually at separate agencies. They use their power to demand the diversion of transit money to roads. For example, in Tampa, a plan to increase bus service led to a DOT demand to pave the routes with concrete lanes at transit agency expense (with federal or state transit funding). The list of BRT projects that were just highway widenings is regrettably too long. The feds should actively demand to keep transit funding for transit, and not roads, social services, policing, or other priorities.

In particular, the feds should give money for some bus improvements, but demand that agencies prioritize the bus over the car. No bus lanes? No signal priority? No money. Similarly, they should demand they engage in internal efficiency measures like stop consolidation and all-door boarding with proof of payment ticket collection, which a larger and more expert FTA can give technical assistance for.

It may also be prudent to give transitional resources, up to a certain point. Funding private-sector retraining for workers displaced by automation is good, and in some limited cases public-sector retraining, as long as it doesn’t turn into workfare (there is no way for the subway in New York to absorb redundant conductors or surplus maintenance staff). If moderate amounts of capital funding are required for bus improvements, such as traffic signal upgrades to have active control and conditional TSP, then they are good investments as well.

Conclusion

Funding public transportation is useful, provided there is enough of a connection between the source of funds and the management thereof that the money is not wasted. A larger and more technocratic federal government is an ideal organ for this, with enough planning power to propose bus network redesigns, rail planning, integrated fare systems, and intermodal coordination. It can and should have technical priorities – shelter is far and away the lowest-hanging fruit for American bus systems – and state them clearly rather than hiding behind bureaucratic phrases (again, “transit asset management” is a real phrase).

It’s fundamentally an investment rather than consumption. And as with all investments, it’s important to ensure one invests in the right thing and the right people. A local transit agency with a track record of successful projects, short lead times from planning to completion, technical orientation, and the ability to say no to highway departments and other organs that extract surplus is a good investment. One that instead genuflects before antisocial groups that launch nuisance lawsuits is not so good an investment, and funding for such an agency should be contingent on improvement in governance of the kind that will make local notables angry.

# Quick Note: California Gets Electrification Wrong

Caltrans has a new plan to make its intercity rail fleet zero-emission. The snag: it rejects electrification as infeasible and is instead looking for hydrogen fuel cell trains. I do not think any of the people who were involved in this study is competent enough to keep working in this field, and it’s important to explain why.

I refer readers to the electrification report we at TransitMatters put out a few months ago. It talks about the costs and benefits of overhead wire, and goes over some case studies of some electrification projects, some good (Trondheim), some okay (Israel, Denmark), and some examples of what not to do (Caltrain, Toronto). Since then I’ve seen additional data of electrification costs out of Italy, where they’re near the bottom of our range.

Our report also goes into alternatives to wire and why they’re infeasible. Hydrogen is not even remotely close. The largest order as of 2019 was 27 trains for the Rhine-Main region, each 54 meters long, for 500M€, or around 343,000€ per linear meter; single-level EMUs typically cost around 80,000€/m in Europe. It’s infant technology with wanting performance and its cost is not worth it compared with the cost of wiring the trains.

Instead, Caltrans thinks that overhead wires are infeasible. It does not publish cost estimates; those estimates would be based on the failure of Caltrain and not on successes in non-English-speaking countries (or even in Britain, with high but not fire-everyone costs), because nobody at Caltrans who has any authority knows or cares.

To make it worse, Caltrans says electrification “has right-of-way implications.” In other words, it requires space for poles and this is supposed to be difficult. In reality, it isn’t. A short distance from the tracks is needed for poles, but the rights-of-way in the state are not especially constrained; Caltrain, in a fairly dense suburban area, did not have that problem, but rather had problems with the execution of the design and with unusual standards for pole placement.

It’s a perennial problem in the United States that rail managers and agency heads are allergic to electrification. It’s a foreign concept, literally. They don’t travel – when they do they think of it as a vacation, not as work to see how countries with an order of magnitude more rail ridership per capita do it. None of the people they know knows, either. Nor are they technically apt or curious – they come from a managerial culture in which speaking of technical details is low-prestige, and making excuses and talking about politics are high-prestige. Fresh master’s graduates in Europe know more than they ever will. They are useless, and they know it.

So they avoid that technology using whatever excuses that they can find. Hydrogen feels to them like they’re innovative; they’re not, US mainline passenger rail is a joke, but they think they are because the notion that the US is a technological laggard doesn’t come naturally to them, since in many fields, none of which is public-sector, the US really is at the technological frontier. Nor are they qualified to tell the difference between mature and experimental tech, which is why they think electrification is not affordable and hydrogen trains at four times the upfront acquisition cost and an unproven maintenance cost are.

The only long-term solution to this recurrent problem is removing the people involved. I don’t have direct experience with California the way I do with the Northeast, but between what I know of the Northeast and what <NAME> and others have said of California, what’s likely is that the top people do not know what an EMU is, the traditional railroaders think electric wires are for toy trains, and the analysts have never once written an alternatives analysis in which the outcome was not politically pre-decided.

# Quick Note: Do Costs Ever Go Down?

Bad agencies have a ratchet process in costs: they can go up, but not down. If there’s a cost saving, it does not reduce the budget, but only cancels out with unspecified cost increases. Agency heads and politicians trumpet their value engineering while costs never go down, leading to premium-cost, substandard quality projects.

Case in point: the Baltimore and Potomac Tunnel replacement project. The project used to be $750 million, in the 2000s, as a two-track passenger rail tunnel. Over the next decade, this turned into a four-track system with mechanical ventilation for diesel freight trains and enough clearance for double-stacked freight; costs ran over to$4 billion. Well, two months ago Amtrak announced a scope reduction back to two tracks, which it claims would save a billion dollars, cutting cost to… $4 billion. This is not the first time this happens. Value engineering in California has had the same effect: every attempt to reduce scope – the blended plan for Northern California, plus various design compromises in both the Bay Area and the Central Valley – has failed to reduce costs. At most, they’ve prevented further cost overruns. And in New York, the removal of the cavern underneath Penn Station in the planning process between the canceled ARC tunnel and the Gateway tunnel did not reduce costs at all. The cost estimate was$10 billion, much of which was the cavern; the cost estimate now is $10 billion for the bare tunnel with less scope than before. ARC was canceled on the grounds of potential cost overruns, and yet as soon as it took over the project, even while descoping the cavern, Amtrak presided over further increases in costs due to extras (Penn South, etc.). It’s as if once there’s a number circulating out there, it will be spent, no matter what. If there’s a surplus, it will be blown on unspecified extras or on sheer inefficiency. Why spend$3 billion when the political system has already indicated that $4 billion is okay? Thus, 4-1 = 4, and, no doubt, if further value engineering is identified, the cost will stay$4 billion.

At no point does anyone say, okay, if there’s a cost saving, here’s the next slate of projects that the money can be spent on. Nor is there any proactive value engineering. Costs are only a problem insofar as they prevent the political system from saying yes, but even then, if there’s a number out there, even an outlandish one that nobody will say yes to (such as $117 billion for medium-speed rail on the Northeast Corridor), then it is the number. Any cuts from that are against inherently moral workers, communities, etc., in the service of inherently immoral outsiders and experts. # Amtrak’s Continued Ignorance There was a congressional hearing about high-speed rail. <NAME> in comments here took notes – thanks for this, much appreciated! The overall content was lacking; the politicians seemed like they were spinning their wheels, not because they themselves were bad (Reps. <NAME>, <NAME>, and <NAME> all raised interesting issues) but because they were getting ignorant advice from the witnesses, none of whom has any experience in successful high-speed rail networks. Among those, Amtrak deserves the most demerits, and its head, <NAME>, should lose his job purely over that testimony, if the reporting of what he said is accurate. Flynn, based on both what Henry said in comments and on reporting in Politico Pro, said that Amtrak needs a trust fund on the model of that for American highways – and said that this is “the most important lesson we can learn” from countries with high-speed rail. The rub is that countries with high-speed rail do not in fact have such trust funds. Financing models vary by country, but do not look like the American highway trust fund. For example, French LGVs are funded line-by-line, with the decision on each specific line taken at the highest level of government, with financing coming either purely from the public sector (as with the LGV Est) or from a higher-cost PPP (as with the LGV Sud-Europe-Atlantique). To understand why, it’s important to understand the relationship between politics and the civil service in functioning, high-capacity states. Politicians make big decisions on spending priorities, and then the civil service implements those decisions. There is little political input on routing decisions, and the exceptions where there is tend to have the worst, highest-cost programs. So the planning is done by the civil service, which then presents a preliminary design for politicians. But the elected politicians have the final word on the yes-no decision whether to fund, and can also ask for high-level modifications (“reduce the budget,” “give the unions the wage increases they demand,” etc.). The American highway trust fund inverts this principle. Going back to <NAME>, federal highway builders had internal sources of money without having to ask elected politicians for regular appropriations. In contrast, politicians exerted considerably petty power over routing. For example, in Twentieth-Century Sprawl, <NAME> points out that in the early planning for what became the Interstate highways, the FDR administration reduced the scope of roads to be built in Vermont from four planned routes to two in retaliation for its voting Republican in 1936. In The Big Roads, <NAME> also notes that MacDonald himself did not think the Interstates could pay for themselves through tolls, but, due to pressure by politicians to write a positive report, the resulting report’s coauthor proposed toll-free motorways instead, hence the prohibition on tolling Interstates. MacDonald himself was fired by the Eisenhower administration for expressing concern that the roads were hollowing out the American rail network and proposing cars-and-trains investment instead of cars-only. And here we have Amtrak’s CEO not only supporting that model, but also lying that this model is how high-speed rail has been built. In reality, no such trust funds exist anywhere with high-speed rail. I don’t know why Flynn says such a thing, which not only is verifiably wrong, but also has no reason to be believed in the first place – there is no grain of truth to it, no trust fund-like model for high-speed rail megaprojects. As with most such fraud, he is probably lying to himself and not just to the people who pay his salary. Americans, as a collective, are wantonly ignorant of the rest of the world. The only time they interact with the rest of the world, especially countries that don’t speak English, is through intermediaries in international consulting, who get the skewed sample of world projects that invite in international consultants, omitting the bulk of public works built in states with in-house design capacity. Individual Americans can be knowledgeable, but their knowledge is not respected, even by people who profess their interest in state capacity. Thus, no matter how smart individual Americans can get, collectively America remains incurious. This is the most acute in mainline rail. I suspect that this relates to the rail industry’s highway envy. For a railroader like Flynn, steeped in a culture that is technologically and institutionally reactionary and looks back to its heyday in the first half of the 20th century, the enemy, that is the Interstate system, is the obvious model for how to build. That this model produced severe cost overruns on the highways themselves does not matter; that treating rails institutionally like roads is inappropriate does not matter; that systems that get as much ridership in two days (cf. JR East) as Amtrak gets in an entire year and deliver a profit to their shareholders doing so work differently does not matter. The future, which is not in the United States in this field and hasn’t been in 60 years, is one in which people like Flynn do not even qualify for an internship. And if Flynn wouldn’t qualify for an internship, why is he allowed to be the CEO? He should lose his job. The people who briefed him should lose their jobs. It is likely that full replacement of Amtrak’s planning staff and possibly the line workers too would be a big win for riders. Even total liquidation could well be a net positive relative to status quo: most Amtrak routes have no social value, and the one route that does, the Northeast Corridor, could well produce a more competent institution from among the ashes. Without liquidation, it is still advisable to sideline Amtrak until it can be put out of its delayed customers’ misery. The best way forward institutionally is to set up an agency responsible for all Northeastern passenger rail operations, to subsume and replace Amtrak and the commuter rail operators. It will be run by people who can speak to the difference between French, German, and Japanese high-speed rail operating models, and who know how to implement integrated timed transfer networks and intermodal fare integration. It will buy imported equipment if there is no domestic equivalent for a similar price, and use standard European or East Asian methods for track geometry machines, signaling (ACSES is thankfully an Americanized variant of the European standard, ETCS), safety systems, timetabling, and so on. The United States has no shortage of dedicated people who speak Spanish, and secondarily Japanese, Korean, Chinese, Italian, German, or French. Moreover, since in many cases the knowledge does exist among Americans but isn’t valued, it is important to let American civil servants interview for such an agency. I expect that most would come from an urban transit background, where in my experience the people are more curious than in mainline rail. But American railroaders too could join if they demonstrate sufficient knowledge of advanced-world operations. That said, under no circumstances should the organizational culture be allowed to turn into anything like present-day American railroading. Current workers who do not qualify for this agency are to be laid off, perhaps with a pro-rated pension for partial service, and told to seek private-sector work. Flynn himself has no role to play in any successful rail agency. He must go, and it’s almost certain that the rest of Amtrak’s management should as well. Every day he stays in his job is a day American railroading plans based on assumptions that can be easily verified to be fraudulent. # The United States Needs to Learn How to Learn I just saw an announcement from November of 2020 in which the Federal Transit Administration proposes to study international best practices… in on-demand public transit. It goes without saying that the international best practice in on-demand micromobility is “don’t.” The strongest urban public transport networks that I know of range from not making any use of it to only doing so peripherally, like Berlin. In fact, both France and Germany have rules on taxis that forbid Uber from pricing itself below the regulated rates; Japan, too, banned Uber from operating after it tried to engage in the usual adversarial games with the state that it is so familiar with from the US. And yet, here we see an FTA program attempting to learn from other countries not how to write a rail timetable, or how to modernize regional rail, or how to design a coordinated infrastructure plan, or how to integrate fares, or how to do intermodal service planning, or how to build subways affordably. It’s perhaps not even aware of those and other concepts that make the difference between the 40% modal split of so many big and medium-size European cities and the 10-15% modal splits that non-New York American cities top at. Instead, the FTA is asking about a peripheral technology that markets itself very aggressively to shareholders and VCs so that it can ask for more money to fund its losses. Earlier today I saw a new announcement of congressional hearings about high-speed rail. There are 12 witnesses on the list, of whom none has any experience with actual high-speed rail. They’re American politicians plus people who either run low-speed trains (Amtrak, Brightline) or promise new vaporware technology (Hyperloop*2, Northeast Maglev). American politicians and their staffers are not that stupid, and know that there are strong HSR programs in various European and Asian countries, and yet, in the age of Zoom, they did not think to bring in executives from JR East, DB, SNCF, SBB, etc., or historians of these systems, to discuss their challenges and recommendations. I bring up these two different examples from the FTA and Congress because the US has trouble with learning from other places. It’s not just that it barely recognizes it needs to do so; it’s that, having not done so in the past, it does not know how to. It does not know how to form an exchange program, or what questions to ask, or what implementation details to focus on. Hearing of a problem with a public agency, its first instinct is to privatize the state to a consultancy staffed by the agency’s retirees, who have the same groupthink of the current publicly-employed managers but collect a higher paycheck for worse advice. Worse, this is a nationwide problem. Amtrak can and should fully replace its senior management with people who know how to run a modern intercity railroads, who are not Americans. But then middle management will still think it knows better and refuse to learn what a tropical algebra is or how it is significant for rail schedule planning. They do not know how to learn, and they do not recognize that it’s a problem. This percolates down to planners and line workers, and I don’t think Americans are ready for a conversation about full workforce replacement at underperforming agencies. This will not improve as long as the United States does not reduce its level of pride to that typical of Southern Europe or Turkey. When you’re this far behind, you cannot be proud. It’s hard with American wages being this high – the useless managers even in the public sector earn more than their Northern European counterparts and therefore will not naturally find Northern Europe to have any soft power over them. Wearing sackcloth and ashes comes more naturally with Italian or Spanish wages. But it’s necessary given how far behind the US is, and bringing in people who are an American’s ideal of what a manager ought to be rather than people who know how to run a high-speed passenger railroad is a step backward. # Streaming the Biden Infrastructure Plan I streamed my thoughts about the Biden infrastructure plan, and unlike previous streams, I uploaded this to YouTube. I go into more details (and more tangents) on video, but, some key points: • Out of the nearly$600 billion in the current proposal that is to be spent on transportation, public transportation is only $190 billion:$80 billion for intercity rail, $85 billion for (other) public transit,$25 billion for zero-emissions buses. This 2:1 split between cars and transit is a change from the typical American 4:1, but in Germany it’s 55:42 and that’s with right-wing ministers of transport.
• Some of the spending on the car bucket is about electric vehicles, including $100 billion in consumer subsidies, but that’s still car spending. People who don’t drive don’t qualify for these subsidies. It’s an attempt to create political consensus by still spending on roads and not just public transit while saying that it’s green, but encouraging people to buy more cars is not particularly green, and there’s no alternative to sticks like fuel taxes in addition to carrots. • The$25 billion for zero-emissions buses is likely to go to battery-electric buses, which are still in growing pains and don’t function well in winter. In California, in fact, trolleybuses are funded from the fixed infrastructure bucket alongside light rail and subways and are ineligible for the bucket of funding for zero-emissions buses. It is unknown whether in-motion charging qualifies for this bucket; it should, as superior technology that functions well even in places with harsh winters.
• The $85 billion for public transit splits as$55 billion for state of good repair (SOGR) and only $30 billion for expansion (including$5 billion for accessibility). This is a terrible idea: SOGR is carte blanche for agencies that aim to avoid public embarrassment rather than provide useful service to spend money without having to promise anything to show for it, and Amtrak in particular cycles between deferring maintenance and then crying poverty when money becomes available. Federal money should go to expansion alone; a state or local agency that doesn’t set aside money for maintenance now isn’t going to do so in the future, and periodic infusions of SOGR money create moral hazard by encouraging maintenance deferral in good times.
• The Amtrak money is a total waste; in particular, Amtrak wants $39 billion for the Northeast Corridor while having very little to show for it, preferring SOGR, climate resilience, and agency turf battles over the Gateway project over noticeable improvements in trip times, reliability, or capacity. • The expansion money is not by itself bad, and in fact should grow by$55 billion at the expense of SOGR, but I worry about cost control. I’m just not sure how to express it in Washington policy language, as opposed to agency-level language regarding in-house design, more flexible procurement, civil service independence, adoption of foreign best practice and not just domestic practices, keeping station footprints small, using cut-and-cover more, and so on.

You should go watch the whole thing, which has some on-screen links to the breakdowns above, but it’s a 1:45 video.

European and American intercity train planning takes it as a given that every train must have a car dedicated to cafeteria service. This is not the only way to run trains – the Shinkansen doesn’t have cafe cars. Cafe cars waste capacity that could instead be carrying paying passengers. This is the most important on lines with capacity limitations, like the Northeast Corridor, the West Coast Main Line, the LGV Sud-Est, and the ICE spine from the Rhine-Ruhr up to Frankfurt and Mannheim. Future high-speed train procurement should go the Shinkansen route and fill all cars with seats, to maximize passenger space.

How much space do cafe cars take?

Typically, one car in eight is a cafe. The standard European high-speed train is 200 meters long, and then two can couple to form a 400-meter train, with two cafes since the two 200-meter units are separate and passengers can’t walk between them. In France, the cars are shorter than 25 meters, but a TGV has two locomotives and eight coaches in between, so again one eighth of the train’s potential passenger space does not carry passengers but rather a support service. Occasionally, the formula is changed: the ICE4 in Germany is a single 12-car, 300-meter unit, so 1/12 of the train is a cafe, and in the other direction, the Acela has six coaches one of which is a cafe.

A 16-car Shinkansen carries 1,323 passengers; standard class has 5-abreast seating, but even with 4-abreast seating, it would be 1,098. The same length of a bilevel TGV is 1,016, and a single-level TGV is 754. The reasons include the Shinkansen’s EMU configuration compared with the TGV’s use of locomotives, the lack of a cafe car in Japan, somewhat greater efficiency measured in seat rows per car for a fixed train pitch, and a smaller share of the cars used for first class. An intermediate form is the Velaro, which is an EMU but has a cafe and three first-class cars in eight rather than the Shinkansen’s three in 16; the Eurostar version has 902 seats over 16 cars, and the domestic version 920.

The importance of the first- vs. second-class split is that removing the cafe from a European high-speed train means increasing seated capacity by more than just one seventh. The bistro car is an intermediate car rather than an end car with streamlining and a driver’s cab, and if it had seats they’d be second- and not first-class. A German Velaro with the bistro replaced by a second-class car would have around 1,050 seats in 16 cars, almost even with a 4-abreast Shinkansen even with four end cars rather than two and with twice as many first-class cars.

How valuable are cafes to passengers?

The tradeoff is that passengers prefer having a food option on the train. But this preference is not absolute. It’s hard to find a real-world example. The only comparison I am aware of is on Amtrak between the Regional (which has a cafe) and the Keystone (which doesn’t), and Regional fares are higher on the shared New York-Philadelphia segment but those are priced to conserve scarce capacity for profitable New York-Washington passengers, and at any rate the shared segment is about 1:25, and perhaps this matters more on longer trips.

Thankfully, the Gröna Tåget project in Sweden studied passenger preferences in more detail in order to decide how Sweden’s train of the future should look. It recommends using more modern seats to improve comfort, making the seats thinner as airlines do in order to achieve the same legroom even with reduced pitch, and a number of other changes. The question of cafes in the study is presented as unclear, on PDF-p. 32:

Put another way, the extra passenger willingness to pay for a cafeteria compared with nothing, 14%, is approximately equal to the increase in capacity on a Velaro coming from getting rid of the bistro and replacing it with a second-class car. The extra over a Shinkansen-style trolley is 3%. Of course, demand curves slope down, so the gain in revenue from increasing passenger capacity by 14% is less than 14%, but fares are usually held down to a maximum regulatory level and where lines are near capacity the increase in revenue is linear.

Station food

Instead of a bistro car, railroads should provide passengers with food options at train stations. In Japan this is the ekiben, but analogs exist at major train stations in Europe and the United States. Penn Station has a lot of decent food options, and even if I have to shell out $10 for a pastrami sandwich, I don’t think it’s more expensive than a Tokyo ekiben, and at any rate Amtrak already shorts me$90 to travel to Boston. The same is true if I travel out of Paris or Berlin.

Even better, if the station is well-designed and placed in a central area of the city, then passengers can get from the street to the platform very quickly. At Gare de l’Est, it takes maybe two minutes, including time taken to print the ticket. This means that there is an even broader array of possible food options by buying on the street, as I would when traveling out of Paris. In that case, prices and quality approach what one gets on an ordinary street corner, without the premium charged to travelers when they are a captive market. The options are then far better than what any bistro car could produce, without taking any capacity away from the train at all.

# MAGA Trains

American railfans are full of nostalgia for a past era when American trains were great. So much of the discussion among industry insiders, railfans, and advocates is about how to make American railroads great again, how to return to the mid-20th century era of American domination. This is not correct history: while American railroads were in fact in a pretty good position from the 1920s to the 50s, they were not competitive with mass motorization and air travel, and trying to imitate what they were like then has no chance of competing with cars or planes. The story of American railroads has to be understood not as decline but as stagnation: operations, technology, and management stagnated, and this is what led to ridership decline. Instead of indulging in a MAGA fantasy about past greatness, it is important for the United States to implement all the innovations of the last half century that it has missed out on, innovations coming from East Asia and Western Europe.

Organization

American railroads were private until Amtrak took over intercity operations and states took over commuter rail operations, which happened well after the terminal decline in ridership. There was intense competition between rival companies, at times leading to physical violence. There was no coordination of operations between different railroads, no coordination with municipal public transportation systems, no attempt at seamless passenger experience. What was the point? This system evolved in the early 20th century, when there was no competition from other modes, only from other railroads.

Over time, most of the rest of the developed world has learned to coordinate different modes of public transportation better, to compete with cars. This usually occurred under nationalized mainline rail companies, but even when companies remained separate, as with the division between municipal subways (e.g. the Berlin U-Bahn) and national railways (e.g. the S-Bahn), or with the separate BLS system around and south of Bern, there has been integration. There is fare and schedule coordination in German cities across rail and bus operators, and even better coordination in the Netherlands and Switzerland.

The US remains fixated on competition, and thus there is no fare integration, but rather relationships between different operators are adversarial. In Chicago, the mayor opposes integration between the municipal L and the regionally-owned Metra commuter rail system, since the city does not own Metra. Every time Amtrak has to share territory with a commuter railroad, one side is screwing the other out of something, whether it’s Amtrak overcharging on electricity or Metro-North arbitrarily slowing Amtrak down. In Boston, there is no integration between city-focused MBTA service, which includes commuter rail, and buses in outlying cities, called RTAs (regional transit authorities); the MBTA is simply uninterested in matching fares or schedules, and is not even integrating its own buses with its commuter trains.

Planning coordination

Switzerland has higher rail usage than every place I know of once one controls for city size. Zurich’s modal split may not be as favorable to public transportation as Paris or London’s, but is a world better than that of any French or British city of similar size. Switzerland got to this point through a stingy political process in which planners had to stretch every franc, substituting organizational capacity for money. Thus, construction in the 1990s used the following principles of value engineering:

• Infrastructure, rolling stock, and the timetable should be planned together (the magic triangle), since decisions on each affect the other two.
• Trains should run as fast as necessary for transfer windows, overtakes, meets on single track, etc. Infrastructure should likewise be only as expansive as necessary – if the timetable does not have trains on a given single track meeting, this segment does not need to be doubled.
• Trains should have timed transfers at major cities, to enable everywhere-to-everywhere travel. Connecting buses should be timed with the regional trains at major suburban nodes.
• Electronics before concrete: it’s cheaper to resignal a line to have short headways and high speeds than to add tracks and tunnels.

These principles do not exist in the United States. Worse, too many American activists, even ones who are pretty good on related issues, do not believe it’s even possible to implement them. “This isn’t Switzerland or Japan” is a common refrain. There’s growing understanding among American cycling advocates that 50 years ago the Netherlands wasn’t as bike-friendly as it is today; there sadly isn’t such understanding regarding the state of rail coordination in Switzerland until about the 1990s.

While Switzerland manages to build its Knot System at low cost, leading to sharp increases in rail usage in the 2000s and 2010s, Americans are unable to do the same. Activists propose massive spending, which the political system is unwilling to fund. Nor is the political system interested in adapting low-cost solutions for infrastructure coordination, since the sort of apparatchiks who governors like appointing to head state agencies can’t implement them; we all know what happened last time a foreigner got appointed to a major position and succeeded too much. The way forward is right there, and the entire American political system, from every governor down to most activists, either is ignorant of it or explicitly rejects it.

Technology

Amtrak runs slower than it used to on most lines. Trip times on the Northeast Corridor south of New York are if anything slightly slower than they were in the 1970s in the early days of the Metroliner. The corridor and long-distance service outside the Northeast are considerably slower. For example, the Super Chief took 39:45 between Chicago and Los Angeles, whereas its current Amtrak version, the Southwest Chief, takes 43:10. At shorter range, the Chicago-St. Louis trains take 5:20 today, compared with 4:55 in the 1930s. This has led too many Americans to assume that there has been technological regression and that the main focus should be on restoring midcentury service levels rather than on moving forward.

In reality, high speeds in the middle of the 20th century came from the facts that express passenger trains were highly profitable and used by important people and so had priority over all other traffic, and that superelevation was set high for these trains; both of these aspects collapsed as riders and high-value shippers decided driving and flying were better than taking 5-hour train rides, so the profit center shifted to low-value freight. Today, getting high passenger ridership is plausible at high-speed rail speeds, but that requires getting Chicago-St. Louis down to 2 hours, not 5 hours, and having excellent connections to local and regional public transportation at both ends.

Nor was midcentury rolling stock good by current standards. Electric locomotives in Europe weigh around 90 tons. American ones weigh a little more, still in compliance with superseded FRA regulations enacted just after WW2. But the locomotives from just before these regulations weighed far more: the Pennsylvania Railroad’s GG1 weighed 215 metric tons. Europe has achieved weight reductions over generations of innovation since, and Japan has achieved even more impressive reductions; 215 tons would get you 2/3 of the way to a 10-car EMU set in Tokyo.

Worse, even in the middle of the 20th century, the US was no longer at the technological forefront of rail service. The civil service formation following the German Revolution brought forth a new railway law and new technology, such as the tangential switch, since adopted throughout Continental Europe; the US mostly sticks with secant switches built to late-19th century specs. In the 1950s the differences between German and American rail technology weren’t huge, but they were there. Since then they’ve gradually widened – in the 1960s Germany came up with LZB signaling, while the US was at best stuck on 1930s signaling, federal regulations on the matter leading to lower top speeds than to the adoption of automatic train protection.

There seems to be general ignorance of the advances that the US has not been part of. Rail managers ask questions like “does Europe have positive train control?” (yes, ETCS is already a second-generation system, we just call this automatic train protection instead of positive train control) or say “Europe doesn’t have the ADA” (accessibility laws here are comparable to American ones and overall the public transportation networks here are on average more accessible). In technology as in organization, the MAGA mentality for trains refuses to admit that there are innovations abroad to learn from.

The way forward: imitate, don’t innovate

The United States can innovate in public transportation, but only if it imitates better countries first. It needs to learn what works in Japan, France, Germany, Switzerland, Sweden, the Netherlands, Denmark, South Korea, Spain, Italy, Singapore, Belgium, Norway, Taiwan, Finland, Austria. It needs to learn how to plan around cooperation between different agencies and operators, how to integrate infrastructure and technology, how to use 21st-century engineering.

There are great places where such imitation could work. I work a lot on Boston-related issues at TransitMatters; New England has high population density, a wealthy and growing urban core in Boston, ample legacy rail infrastructure, and town centers that work more like Central European suburban sprawl (albeit at lower density) than like structureless Californian or Texan sprawl. But it can’t move forward without rejecting MAGA fantasies and replacing them with a program of learning from what works here and in Japan. There are so many projects under discussion of limited or no value, and some even with negative value, like anything that interacts with the hobby freight railroad Pan Am.

Instead, the tendency in the United States is to do anything to avoid learning from outside North America. Plans for intercity rail improvement outside the Northeast and California are steeped with MAGA language about restoring midcentury rail. Plans in New York spend far too much time on midcentury expansion plans and far too little on understanding cost explosion factors dating to the 1920s. Regional rail plans vaguely nod to European S-Bahns, but are generally filtered through several layers, mainly Philadelphia’s implementation. Anything that touches freight invites kludges that European planners no longer use for cost or maintenance reasons.

This tendency has to end. Meiji Japan didn’t join the first world by closing itself to foreign inventions – quite the opposite. The US needs to understand that the path to a future with better American transportation lies not in America’s past, but in Europe and East Asia’s present. The history isn’t one of American decline and renaissance through rediscovery of ancient learning, but one of American insularity and stagnation, to which the solution is to adapt technologies that work elsewhere.

# Fare Regulations

Public transportation companies may have the ability to raise fares arbitrarily based on market demands, for examples British buses outside London and American freight railroads. Or they may be subject to regulations capping the fare, for example Japanese railroads. Mixed systems exist as well, such as British rail fares. In Britain, the privatized, mostly deregulated approach is so commonly accepted that a Conservative recently called Labour dangerous socialists for proposing municipalizing bus systems, as in such socialist states as the US, Japan, Germany, etc. In reality, in the case of rail specifically (and perhaps buses as well), there’s a theoretical case with some empirical backing for why reasonable fare caps as in Japan can lead to more investment and more capacity, whereas wholly unregulated fares lead to hoarding and capacity cuts to create shortages.

The model

I’m stealing the economic model for this post from <NAME>, who used it to explain the California blackouts of 2000-1. The demand curve is inelastic: the demand is 1,000 units at $20/unit, decreasing to 900 units at$1,000/unit, at which point the curve goes flat. The supply curve is a constant $20/unit, but the market is oligopolistic (say, there are very high barriers to entry because building your own power plant is hard), and there are 5 producers, each with 200 units. If the price is regulated at$20/unit, each producer will supply 200 units. If the price is unregulated, then each producer alone gets an incentive to hold back production, since 100*1000 > 200*20, and then production will be curtailed to 900 units.

The model is simplified in a number of ways: real supply curves slope up; the part about demand going flat at 900 units is unrealistic and exists purely to avoid dealing with optimizing where at 800-something units each producer has an incentive to go back to producing more; capacity constraints involve escalating production costs rather than a God-given restriction on the number of suppliers and their capacity. But with all these caveats, it fits markets that have the following characteristics:

• There are steep barriers to entry, for example if large amounts of capital are required to enter (to build a power plant, set up a rail operating company, etc.).
• Demand is highly inelastic.
• Adding new capacity is expensive.

The issue of capacity

In rail, we can start plugging real numbers for both demand elasticity and the cost of new capacity.

In the above model the price elasticity is -0.0244 in the 900-1,000 units range, which is ridiculously inelastic, on purpose so as to highlight how the model works. TCRP Report 95 says the elasticity in a number of large cities studied is about -0.18, and a VTPI review in a mixture of cities and circumstances (peak vs. off-peak, bus vs. rail, etc.) asserts a short-term average of about -0.3. Unregulated fares will lead to supply reductions if the elasticity times the number of producers is more than -1 (or less than 1 if you flip signs); if no producer has <18% of the market, there will be supply restrictions under unregulated fares, just as a monopolist will hold back supply and raise fares if demand is inelastic.

The cost of new capacity of course depends on the line and the characteristics of competition between different railroads. It’s higher in Japan, where separate railroads run their own lines and trains, than in Britain, where different companies franchise to run trains on the same tracks. But even in Britain, getting a franchise requires a commitment to running service for many years. The significance of this is that the long-run public transport ridership elasticity with respect to fare is more elastic (VTPI recommends a range of -0.6 to -0.9), with a few estimates even going below -1.

For the purposes of this section, we do not distinguish capital from operating costs. Thus, the cost of new capacity is not given in units of capital costs, but in units of operating costs: if increasing service by 1% raises operating expenses by 2% counting the extra investment required, then we say the supply elasticity is 2. Note that supply curves slope up so the elasticity is always positive, but the elasticity can be below 1, for example if economies of scale are more important than the need to invest in new capacity.

Set the following variables: u is quantity of service, r is total revenue (thus, fare is r/u), c is total costs. The railroad is assumed profitable, so r > c. We are interested in the change in profit based on quantity of service, i.e.

$\frac{dr}{du} - \frac{dc}{du}.$

The important thing to note is that price controls keep dr/du higher in an oligopoly (but not in a competitive environment, like housing – a single landlord can’t meaningfully create a housing shortage). With price controls, we get

$\frac{dr}{du} = \frac{r}{u} = \mbox{constant fare}$

whereas without price controls, with elasticity $e_{d} < 0$, we get

$\frac{dr}{du} = \frac{r}{u} + \frac{r}{ue_{d}} = \frac{r}{u}(1 + 1/e_{d}).$

And likewise, with supply elasticity $e_{s} > 0$, we get

$\frac{dc}{du} = \frac{c}{ue_{s}}.$

Note, moreover, that price controls as construed in Japan let operating companies recover profits, letting them raise prices if they invest in more capacity, so that dr/du is actually higher than r/u.

The real world

I do not know to what extent the lack of fare regulation on many British trains contributes to capacity shortages. However, there is some evidence that the same situation is holding back investment in the United States, on Amtrak. Amtrak is a monopolist facing some fare regulations, for example congressional rules limiting the spread between the lowest and highest fares on a given train, but within its ability to set its own capacity in the medium run, it has relatively free hand, and in fact a strong incentive to maximize fares, in order to subsidize money-losing trains outside the Northeast Corridor.

Amtrak generally runs the trains it has on the Northeast Corridor, without explicitly holding back on capacity. However, this is in an environment with very low utilization rates. There are 20 Acela trainsets, but only 16 run in service at a given time, giving them the moniker “hangar queens.” There is no real interest within Amtrak at raising speed just enough to be able to run consistent service intervals, for example hourly with two trainsets coupled to form a 16-car train south of New York. Nor is there any interest in making small investments to permit such long trainsets to run – most Acela stops from New York to the south have platforms long or almost long enough for such trains, but the rest need to be lengthened, within right-of-way so that the cost is positive but low.

In the future, capacity cliffs may prove serious enough to stymie American passenger rail development. Right now the main obstacle are Amtrak itself and obstructive commuter railroads such as Metro-North, but assuming competent, profit-maximizing investment plans, it is not so expensive to invest in capacity and speed so as to permit around 4 long high-speed trains per hour north of New York (or even New Haven) and 6 south of it. But then the next few trains per hour require further bypasses, for example four-tracking most of the Providence Line. High supply elasticity – let’s say around 2 – is plausible. Then eventually a dedicated pathway to intercity trains through New York becomes necessary, raising supply elasticity even higher. In an environment with uncapped, profit-maximizing fares, a rational Amtrak management may well just keep what it has and jack up prices rather than build more capacity.

# Metro-North Doesn’t Know Best Industry Practices

Governor N<NAME>’s plan for speeding up trains between New York, New Haven, and Hartford seems to have fallen by the wayside, but Metro-North and the Connecticut Department of Transportation are still planning for future investments. Several high-level officials met with the advocates from the Connecticut Commuter Rail Council, and the results are unimpressive – they have made false statements out of ignorance of not just best practices outside North America but also current federal regulations, including the recent FRA reform.

The meeting link is a video and does not have a searchable transcript, so I’m going to give approximate timestamps and ask that people bear with me. At several points, highly-paid officials make statements that are behind the times, unimaginative, or just plain incorrect. The offenders are <NAME>, the bureau chief of public transportation for CDOT, who according to Transparency.CT earns a total of $192,000 a year including fringe benefits, and <NAME>, Metro-North’s vice president of engineering, who according to See Through NY earns an annual base salary of$219,000.

20-25 minutes: there’s a discussion, starting a few minutes before this timestamp, about Metro-North’s future rolling stock procurement. In addition to 66 M8 electric multiple units (EMUs), the railroad is planning to buy 60 unpowered railcars. Grilled about why buy unpowered railcars rather than multiple units, such as diesel multiple units (DMUs), Andreski said a few questionable things. He acknowledged that multiple units accelerate faster than locomotive-hauled trains, but said that this was not needed on the lines in question, that is the unpowered Metro-North branch lines, Shore Line East, and the New Haven-Hartford line. In reality, the difference, on the order of 45 seconds per stop at a top speed of 120 km/h (55 seconds if the top speed is 144 km/h), and electrification both massively increases reliability and saves an additional 10 seconds per stop (or 30 if the top speed is 144).

More worryingly, Andreski talks about the need for flexibility and the installed base of diesel locomotives. He suggests unpowered cars are more compatible with what he calls the train of the future, which runs dual-mode. Dual-mode trains today are of low quality, and the innovation in the world focuses on single-mode electric trains, with a growing number of railroads electrifying as well as transitioning to multiple units. Metro-North itself is a predominantly EMU-based railroad – running more EMUs, especially on the already-wired Shore Line East, is more compatible with its existing infrastructure and maintenance regime than keeping low-performing diesel branches and running diesel under catenary on the trunk line.

1:14-1:17: Andreski states that the 60 unpowered single-level cars should cost about $250 million, slightly more than$4 million per car. When a reader of this blog noted that in the rest of the world, a 25-meter multiple-unit costs $2.5 million, Andreski responded, “this is not accurate.” The only trouble is, it is in fact accurate; follow links to contracts reported in Railway Gazette in the rolling stock cost section of this post. It is not clear whether Andreski is lying, ignorant, or in a way both, that is making a statement with reckless disregard for whether it is true. Hayden then chimes in, talking about FRA regulations, saying that they’re different from American ones, so European and Asian prices differ from American ones, seemingly indifferent to the fact that he just threw Andreski under the bus – Andreski said that multiple-units do not cost$2.5 million per car and if a public contract says they do then it’s omitting some extra costs. The only problem is, FRA regulations were recently revised to be in line with European ones, with specific eye toward permitting European trains to run on American tracks with minimal modifications, measured in tens of thousands of dollars of extra cost per car. In a followup conversation off-video, Hayden reiterated that position to longtime reader <NAME> – he had no idea FRA regulations had been revised.

Hayden’s response also includes accessibility requirements. Those, too, are an excuse, albeit a slightly defensible one: European intercity trains, which are what American tourists are most likely to have experience with, are generally inaccessible without the aid of conductors and manual boarding plates. However, regional trains are increasingly fully accessible, at a variety of floor heights, and it’s always easier to raise the floor height to match the high platforms of the Northeast Corridor than to lower it to match those of low-platform networks like Switzerland’s.

1:45: asked about why Metro-North does not run EMUs on the wired Shore Line East, a third official passes the buck to Amtrak, saying that Amtrak is demanding additional tests and the line is Amtrak’s rather than Metro-North’s property. This is puzzling, as 1990s’ Amtrak planned around electrification of commuter rail service east of New Haven, to the point of constructing its substations with room for expansion if the MBTA were ever interested in running electric service on the Providence Line. It’s possible that Amtrak today is stalling for the sake of stalling, never mind that commuter rail electrification would reduce the speed difference with its intercity trains and thus make them easier to schedule and thus more reliable. But it’s equally possible that CDOT is being unreasonable; at this point I would not trust either side of any Amtrak-commuter rail dispute.


text:
# Finding the amplitude of a multi-tone signal

How do you find the amplitude of a signal consisting of multiple sinusoids with different frequencies such as
$$f(t) = A\cos(\omega_1t)+B\sin(\omega_2t)\text?$$

I'm thinking that you take the derivative and set it equal to zero (finding the maximum), but I can't really say why this works. This is for communication systems when finding the amplitude of a message signal.

• For what purpose are you finding the amplitude? If you need the worst case peak amplitude e.g. to ensure you never clip the signal, that's trivial. A+B. – user_1818839 May 9 '20 at 20:15
• I'm ultimately trying to find the modulation index Am/Ac. I should also mention this is for academia. Does A+B work for signals with different frequencies? – Aaron May 9 '20 at 20:25
• the instantaneous amplitude is your $f(t)$, and there's no other way than evaluating the cosine and the sine, multiply them with A and B, respectively and sum them up. And your question has little to do with the modulation index... so I'm not quite sure what you're asking about! – <NAME> May 9 '20 at 20:41
• The definition of the modulation index is Message Amplitude/Carrier Amplitude right? I'm trying to find the Message Amplitude. – Aaron May 9 '20 at 21:06
• i.e. f(t) is the message of an amplitude modulated signal? – Ocanath May 9 '20 at 21:14

In a comment you clarified that you're trying to find the modulation index of an amplitude modulated signal. I assume this means that the signal provided takes the form of your message signal, and that is the reason you're trying to find the maximum. If you're unable to predict the exact frequencies, amplitudes, and phases of your sinusoids, you should assume the worst case upper bound is $$\ |A| + |B| \$$.
If all of your signals are cosines and have zero phase shift, then if the amplitudes are all positive, obviously the maximum is the sum $$\(t = 0)\$$. Interestingly, if there are only two cosines with no phase shift, and if the amplitudes are not both positive, you can still assume the maximum is $$\ |A| + |B| \$$ if the ratio $$\r = \frac{\omega_1}{\omega_2}\$$ is not rational.

format: plain


text:
# If $F=K(u,v)$ with $u^p$,$v^p\in K$ and $[F:K]=p^2$, $\operatorname{char} K=p>0$, then $F$ is not a simple extension of $K$.

Greetings I'm trying to show this exercise from Hungerford's Algebra Chapter five section 6 exercise 15; but I'm stuck. the exercise says the following: Let $\operatorname{char} K=p>0$ and assume $F=K(u,v)$ where $u^p,v^p\in K$ and $[F:K]=p^2$, then $F$ is not a simple extension of $K$. Exhibit an infinite number of intermediate fields. Thank you.

-
Suppose $F=K(\alpha)$. Write $\alpha$ as a rational function in $u$ and $v$. What can you say about $\alpha^p$? Why is this a contradiction?
Nice.$\alpha^p\in K$ implies that $\alpha$ is a root of $x^p-w\in K[x]$ with $w=\alpha^p$, and says that $[F:K]=p$. Thnak you man. –  <NAME> Mar 18 '13 at 2:45


text:
# How do I properly convert the file to UTF-16LE encoding without strange characters appearing in the file?

I'm having some peculiarities with the dictionary file of .dsl format I'm trying to convert. It's essentially a text file with the dictionary pairs. The dictionary software I use is GoldenDict. It requires UTF-16 dictionaries so they render properly.

All the dictionaries I have are UTF-16LE format. There is one standing out however. It has iso-8859-1 encoding. An entry looks like this when I open it with vim:

abandonarse
[m2][c crimson][b]Sinónimos[/b][/c][/m]
[m2][i][c green]verbo[/c][/i][/m]
[m1][trn][b]desanimarse:[/b] <<desanimarse>>, <<abatirse>>, <<tumbarse>>, <<plegarse>>, <<entregarse>>, <<desligarse>>[/trn][/m]

I have to convert it to UTF-16LE because Goldendict renders some Cyrillic characters instead of Spanish accented characters. Then I try:

iconv -f iso-8859-1 -t utf-16le dictionary.dsl -o test.dsl

The new test.dsl dictionary is rendered correctly by Goldendict, however I can see some peculiar things I would love to get rid of. First is that the just converted file's encoding is not recognized as it usually is with the other dictionaries:

    aleksandr@desktop:~/windoc/Dic/Es extra/dictionary.dsl> file dictionary.dsl
dictionary: data

When I open the file test.dsl with vim every character inside has ^@ added to it. Here is the example of the same entry:

    ^@<^@<^@e^@n^@t^@r^@e^@g^@a^@r^@s^@e^@>^@>^@,^@ ^@<^@<^@d^@e^@s^@l^@i^@g^@a^@r^@s^@e^@>^@>^@[^@/^@t^@r^@n^@]^@[^@/^@m^@]^@
^@      ^@[^@m^@2^@]^@[^@c^@ ^@c^@r^@i^@m^@s^@o^@n^@]^@[^@b^@]^@A^@n^@t^@ó^@n^@i^@m^@o^@s^@[^@/^@b^@]^@[^@/^@c^@]^@[^@/^@m^@]^@
^@      ^@[^@m^@2^@]^@[^@i^@]^@[^@c^@ ^@g^@r^@e^@e^@n^@]^@v^@e^@r^@b^@o^@[^@/^@c^@]^@[^@/^@i^@]^@[^@/^@m^@]^@

I tried removing this characters in vim

%s/<Ctrl-V><Ctrl-J>//g

However, then I save the file, it has the encoding iso-8859-1 again. I would like to have this file to be show without ^@ characters, because I may need to edit some headings in the dictionary manually.

• The real question here is How do I get VIM to correctly recognize my text file as UTF-16LE (or ucs2-le) when the file does not have a BOM?, iconv not adding BOMs when it is explicitly told the endinanness to use. – JdeBP Sep 8 '20 at 15:54
• How do I get file to correctly recognize my text file as UTF-16LE when the file does not have a BOM? is really a separate question. – JdeBP Sep 8 '20 at 16:00

Your vim hasn't recognised the encoding, and is showing the 16-bit characters as 8-bit characters. The ^@ markers represent the higher order 8-bits, which for common Latin characters will be zero valued.

You can type this after reading in the file to force recognition of UTF-16LE

:e ++enc=utf-16le

(Credit: StackOverflow)

It seems that this would also work, but whether it's ideal is far from clear to me

vim -c 'e ++enc=utf-16le' dictionary.dsl

Finally, from your comment it seems that a BOM would be quite acceptable. You can't use iconv to add a BOM but you can add one yourself

(
printf "%s" \$'\xFF\xFE'
iconv -f iso-8859-1 -t utf-16le dictionary.dsl
) > dictionary-utf16le.dsl

Confirm with

file dictionary-utf16le.dsl
dictionary-utf16le.dsl: Little-endian UTF-16 Unicode text


text:
# CAT Quantitative Aptitude Questions | CAT Time and Work questions

###### CAT Questions | Time and work | Work Time
CAT Questions

The question is from Time and work: Charging Time. A future phone has multiple charge outlets, what would happen if we chose to use all the outlets? A unique Time and Work Question.

Question 25: It’s year 2025 and iphone16 has just been launched. Apple has claimed that it is the best iphone they have created so far. It’s 4 charging inlets have completely revolutionized the mobile market. If only top and bottom inlets are used, it takes 20 mins to fully charge. If the right, left and bottom inlet are used, it takes 15 mins to fully charge. If top, left and right inlets are used, it takes 12 mins to charge. What is the fastest possible time in which the iphone16 can be fully charged?

1. 12 min
2. 8 min
3. 11 min
4. 10 min


text:
### re: Project Euler #2 - Even Fibonacci numbers VIEW POST

Math to the rescue again!
To compute the n-th Fibonacci number, you can use the Binet formula:

where φ is the Golden Ratio, (1 + √5)/2. Also, it's given that f(0) = 0 and f(1) = 1, instead of having 1 and 2 as the first two Fibonacci's numbers.

In order to know which Fibonacci number is the highest below 4 million, we can solve by n... which isn't really easy. So, instead, we get to obtain a (pretty good) estimate by ignoring the second term (-1/φ)n, which quickly approaches to 0, and solve:

In fact, f(33) = 3524578 and f(34) = 5702887.
Now, it's time to sum. First of all, let's notice that the even terms in the Fibonacci sequence happen once every three: f(0) = 0, f(3) = 2, f(6) = 8, f(9) = 34 and so on. So, we just have to sum every f(3 k) for k from 0 to 11. Using the known formula:

and using a = φ, h = 3 and n = 11, we have:

So, more in general, using JavaScript (for example):

const SQ5 = 5 ** .5;
const PHI = (1 + SQ5) / 2;
function allEvenFibonacciUpTo(limit) {
const highestIndexBelowLimit = Math.floor(Math.log(limit * SQ5) / Math.log(PHI));
// I love expressive variable names, but the formula could get too long!
const n = Math.floor(highestIndexBelowLimit / 3);
return ((PHI ** (3 * n + 3) - 1) / (PHI ** 3 - 1)
- ((1 - PHI) ** (3 * n + 3) - 1) / ((1 - PHI) ** 3 - 1)) / SQ5;
}

console.log(allEvenFibonacciUpTo(4e6)); // 4613731.999999999

Well... I guess we'll have to deal with some rounding problems 😅
But another O(1) solution, yay! 🎉

(By the way, -1/φ = 1 - φ if you were confused.)

These are really great solutions. I think it would be worthwhile for you to publish them as standalone articles. One quibble: I don't think this is O(1) since arithmetic operations are not constant time as a function of input, although I guess as long as we’re sticking with floating point numbers O(1) is probably valid.

You're correct that addition is O(log N) for a number N, or O(log n) where n is the number of digits. The power function x^n also has a O(log N) time complexity if N is an integer (I presume it's also linear on number of significant bits).

Given fixed sized types on a computer though I believe most of these become constant time, as the inputs have a fixed upper limit on bits. It probably involves an unrolled loop, or fixed iterations on a CPU.

Yes, indeed. I am in fact using just plain double precision numbers there, and they do take a fixed amount of ticks for common operations like those on a modern CPU.

I wouldn't be so certain if I used JavaScript's BigInt numbers (or rather, I would be certain of the opposite).

Thank you for the explanation!

Ah nice to see maths, I came up with the same thing however with a different approach of using generator functions.

Let us forget about fibonacci and think of the even fibonacci as a new series. (I probably think there would be a mathematical way of deducing it, but I just used brute force to find it out)

series = 2, 8, 34, 144, 610, 2584...
34 = 8*4 + 2,
144 = 34*4 + 8,
610 = 144*4 + 34;
Number = 4 * (Previous Number) +  Previous Previous Number

So the recurrence relation for this series would be

Fn= 4Fn-1 + Fn-2.
To find out the Sum of n elements in this series (let's call this Sn), we can rewrite the recurrence relation like this:
4Fn-1 = Fn - Fn-2
and we can move all n's by 1:
4Fn = Fn+1 - Fn-1

Now we can use the same logic to finder other n's:
4Fn = Fn+1 - Fn-1
4Fn-1 = Fn - Fn-2
4Fn-2 = Fn-1 - Fn-3
4Fn-3 = Fn-2 - Fn-3
...
...
4F4 = F5 - F3
4F3 = F4 - F2
4F2 = F3 - F1
4F1 = 4F1

For folks not familiar with this technique, we are simply doing to cancel out similar terms when we add all equations. (Note all items in pair are canceled out since x - x = 0).

4Fn = Fn+1 - Fn-1
4Fn-1 = Fn - Fn-2
4Fn-2 = Fn-1 - Fn-3
4Fn-3 = Fn-2 - Fn-3
...
...
4F4 = F5 - F3
4F3 = F4 - F2
4F2 = F3 - F1
4F1 = 4F1

4Fn + 4Fn-1 + 4Fn-2 + ... + 4F2 + 4F1 = Fn+1 + Fn - F2 + 3F1

If you notice the left hand side is essentially equivalent to
4Sn

Now we can finally write the relation between sum and series as:

Sn= ( Fn+1 + Fn - F2 + 3F1 ) / 4

The point is this avoids the for loop for summing all the values. Go ahead and try substituting values and you will find this sums it up. You will have to use F(1) = 2 and F(2) = 8.

Now that we have removed one for loop, how do we get a direct formula for getting the Fn.

This involves a bit more complicated math(for adventurous folks visit austinrochford.com/posts/2013-11-0...).
In short the closed form for this recurrence relation is

And if you compute the roots and follow along the url I posted above, you will end up with this

This gives us a function to compute Fn .

Now we can combine our summing and this formula to get a simple O(1) arithmetic function to get the sum. Side note: Running a for loop will take much less brain time :P

I applaud your solution, fellow math lover! 👏

code of conduct - report abuse


text:
## Algebra: A Combined Approach (4th Edition)

The midpoint formula is $(\dfrac{x_1+x_2}{2},\dfrac{y_1+y_2}{2})$.


text:
## Center of mass of a half-ball

Hi, I've been working on the following question for a little while. I've looked it over several times and I can't find any obvious (to me anyway) errors in my work. Would you please scan it through and let me know if I am correct or, if not, please guide me in the right direction so I can try again.

I have attached a scanned copy of the question and my work.

 Recognitions: Gold Member Science Advisor Staff Emeritus I don't see anything wrong with it. (Except that you really don't need to integrate to find the volume of the hemisphere: it is (1/2)(4$\pi$)!)


text:
# What is the limiting factor of the speed of light?

Have been really struggling for some considerable time to understand the universal limitation of speed i.e. it is not possible to travel faster than the speed of light. In particular - what is the limiting factor? Is it something physical that can be understood (e.g. is there an equivalence to terminal velocity of a falling body, which can easily be understood by a layman of balancing the wind resistance against the force of gravity).

Firstly, in trying to understand this I have learned that speed is only a relativistic quantity, everything can be considered to be at rest or in motion in makes no difference? So the limitation is only between two (or more) bodies. But if there was nothing in existence other than two independent particles separated by some arbitrary distance (let's say 10 light years for example) how can one influence the other? By which I mean the (relative) speed between the two is limited, so they must somehow influence each other? And if so how do they influence each other? Or is it the space-time vacuum between them that marks the relative distance & speed? What is the limiting mechanism and the reference??

Asked another way, in trying to understand this problem I have learned from various sources that the universe is expanding at an incredible rate...at more than half light speed in one direction, and more than half light speed in the opposite direction. I have learned that this is "allowed" since the two opposite ends are outside of each others sphere of influence...no information can ever be communicated between, neither can have cause or influence over each other (or are even aware of each others existence, and could perhaps be considered to be independent realities), yet it does seem possible that something could exist in between the two to observe that, relative to each other they are travelling faster than light...

So if we imagined just three particles in space, A moving "left" of B and C moving "right" of B (and saying B is "stationary" for the sake of argument). Let's say that initially A & C are within a sphere of influence (i.e. close enough to each other) so that they are limited in not being able to travel more than 0.5c away from each other. Let's say they are going 0.49c relative to B (in opposite directions). Over time they get further and further away...Suddenly, they reach the event horizon (the A-C event horizon) and they both increase speed to 0.9c relative to B. Particle B sees that A and C are now suddenly moving away from each other at 1.8c, almost as if they've hit a turbo switch. They have suddenly been allowed to increase speed by the universe.

When they fall off each others causality event horizon, what is it that allows them to increase speed? What is the limiting factor just before they reach the horizon? And finally, in going over that horizon would they experience any acceleration?

• I did a quick count and found at least eleven questions which is far too many for one post. This isn't a good first post for this reason. Have you taken some time at the help center for some tips on writing good questions for this format? Jun 23, 2018 at 0:15
• as far as we know, the speed of light is a fundamental limit of the geometry of spacetime. No theory so far derives the geometry from some more fundamental concepts Jun 23, 2018 at 0:32
• "then happy to delete it and live in ignorance" - an alternative would be to delete it and then spend a modest amount of time searching this site's many questions regarding the light speed limit. Many of the regulars here that volunteer their time to answer questions have posted high quality answers to such questions and maybe, just maybe, after perusing these, you won't feel the need to 'live in ignorance'. And then, if you still have a question, reference these other answers and identify what, in particular, isn't clear to you. Jun 23, 2018 at 0:35
• For a start, try this one: If all motion is relative, how does light have a finite speed? Jun 23, 2018 at 0:39
• Possible duplicate of If all motion is relative, how does light have a finite speed? Jun 23, 2018 at 2:06

Either the structure of space-time has no speed limit (unbounded relative velocities would then be possible), or the structure of space-time has a maximum speed (limitation on the maximum relative speed possible).

The first case corresponds to Newtonian space & time. We know that this is incorrect for fast moving objects, and evidence has been accumulating since before Einstein's work of 1905.

The second case, where there is a speed limit, is explained by Einstein's Special Relativity. Here the maximum speed is c, which also happens to be the speed that light travels.

To consider the cosmological case of the expanding universe, one needs Einstein's General Relativity. Here we have a dynamic space-time, which responds to local density of matter and energy. From observation it is known that the cosmos is expanding, and the further away (in time and space), the faster it is moving away from the observer, such as us. There are two elements to this motion: one is ordinary motion, the other is due to the expansion (stretching) of space.

The stretching of space is not limited by the speed of light, and thus there are elements of the cosmos which used to be observable, but which now have attained speeds, due to the expansion of space, such that they can no longer be seen.

For details, see How Can the Universe Expand Faster Than the Speed of Light?

The limiting factor is the speed of time. In relativity, time and space are related (hence "relativity"). The faster you move in space (relative to me), the slower your time moves (as I see it). As you approach the speed of light, I see your time slowing down to zero. Nothing is smaller (in the absolute value) than zero. Therefore no faster speed exists in relativity (in the hyperbolic geometry of spacetime) than the speed of light.

Speed is distance divided by time. If time and space were independent, naturally, any speed would be possible (as in the Galilean or Newtonian spacetime). However, in special relativity (Minkowski spacetime), time and space relate to each other. So when you divide distance by time, but time is relative to space, it so works out in this (counterintuitive) geometry, that the result of your division is never larger than one (as in one light second per second).

So the speed of light is the maximum speed, not because of a technical limitation or limiting factor. It is not the case where a higher speed conceptually exists, but nothing can achieve it. The actual case is that a faster speed simply does not exist in the (Minkowski) geometry of spacetime. You cannot move faster than light for a similar reason as why you cannot move to the North of the North Pole. In the geometry of the globe, no place exists to the North of the North Pole. Similarly, in the geometry of spacetime, no speed exists faster than one (the speed of light in natural units).

Speed geometrically is represented by a rotation of coordinates, say, $x$ and $t$. Well, these coordinates in our spacetime are very dissimilar and behave quite differently. One is space, the other is time. Mathematically this is described by the hyperbolic geometry of Minkowski. In this geometry, the speed also is represented by a rotation of coordinates, except the space and time coordinates rotate in different directions, one clockwise, the other counterclockwise. Accordingly, you cannot rotate them more than 45 degrees (visually, the hyperbolic angle is calculated differently) before they meet. And at 45 degrees the speed is one. So the maximum possible speed in this type of geometry (in which we live) is one lightsecond per second. There simply is no faster speed. Even if you magically could achieve any speed, no faster speed exists in our spacetime, so you'd still be limited to the speed of light.

Now let's move onto two objects (A and B) flying apart from you (C) in the opposite directions each near the speed of light relative to you. Is their relative speed a double speed of light? No. "Relative" means the speed of an object relative to another object. So, if you figure the speed of A relative to B, then, according to the relativistic speed addition formula, this relative speed is still slower than light. Wait, but don't you see that these two objects are flying apart from you with a double speed of light? Yes, but it is not their relative speed (as just explained). There is no such thing as "the speed of A and B relative to C". "Relative" means "A relative to B" or "A relative to C" or "B relative to C" where all three of these speeds are slower than light. So, when you see two objects flying apart from you with a double speed of light, it's OK. No laws are broken. No relative speed is faster than the speed of light. These objects would not disappear from you or from each other behind any horizon (in a flat non-expanding space of special relativity).

Finally, moving on to the expansion of space faster than light. One flaw in your reasoning is when you say that two objects separated by a distance are limited in their relative speed by the speed of light. This would be true only in the Minkowski (flat and non-expanding) spacetime. However, our spacetime is flat only locally (asymptotically). It is not flat globally or even at a relatively small distance in gravity where spacetime is curved by a heavy mass (e.g. of the Earth). And when spacetime is curved, the geometry is no longer Minkowski, and speed is no longer limited by the speed of light. However, in a small region (locally), the geometry is still Minkowski and the speed of light limitation is still there. Things far away from you can conceptually move faster than light relative to you, by nothing can fly near you faster than the speed of light.

For example, consider the frame of the rotating Earth. In this frame you simply sit and watch the stars rotating around the sky. Alpha Centauri is 4.4 light years away making a 27-light-year circle around you in just 24 hours. This is ten thousand times faster than the speed of light. Another example, the universe expands. The further the galaxy is from us, the faster it moves away. Can it move faster than the speed of light? Sure, because it is not a local speed. The speed of light limitation is only local - nothing can fly faster than the speed of light (relative to you) near you. However, far far away, there are different rules. The universe expands. Black holes slow down time to a halt. Spacetime is curved. Frames are not inertial. So sure, under certain conditions, things that are not near you can move faster than the speed of light relative to you. This is OK, no laws are broken. The law of the maximum speed is only local. Globally the universe is not limited by any speed.

The limiting factor is the speed of light itself. Nothing can travel faster than this speed.

This is both an empirical fact deduced from the Michaelson-Morley experiment and a theoretical fact deduced from Maxwells theory of electromagnetism.

In fact, as particles begin to approach light speed their mass begins to increase so it progressively takes more and more energy to increase their speed; this is why particles that do travel at this speed are massless.


text:
# Thread: Reduction method of integration

1. ## Reduction method of integration

Establish a reduction formula for the following integrals.

$\int\tan^n x dx$ (use $tan^2 x\equiv\sec^2 x -1$)

$\int \sec^n x dx$

I figure that both are similar, and that if I can figure out one i should be able to do the other.
The examples i was given would give the method
$\int\tan^n x dx=\int\tan x\tan^{n-1} x dx$ and then use integration by parts, but I'm not sure about this one.
I tried
$\int\tan^n x dx=\int\tan^2 x\tan^{n-2} x dx$
$=\tan^{n-2}x(\tan x -x)-(n-2)\int(\sec^2 x \tan^{n-3} x)(\tan x -x)$
But i could not work it out to the answer which is
$(n-1)(I_n+I_{n-2})=\tan^{n-1} x$, $I_n=\int\tan^n x dx$ and $I_{n-2}=\int\tan^{n-2} x dx$

Thanks!

2. $\displaystyle{\int{\tan^n{x}\,dx} = \int{\tan^2{x}\tan^{n-2}{x}\,dx}}$

$\displaystyle{= \int{(\sec^2{x} - 1)\tan^{n - 2}{x}\,dx}}$

$\displaystyle{= \int{\sec^2{x}\tan^{n - 2}{x} - \tan^{n - 2}{x}\,dx}}$

$\displaystyle{= \int{\tan^{n - 2}{x}\sec^2{x}\,dx} - \int{\tan^{n - 2}{x}\,dx}}$

$\displaystyle{= \int{u^{n - 2}\,du} - \int{\tan^{n - 2}{x}\,dx}}$ after making the substitution $u = \tan{x}$

$\displaystyle{= \frac{u^{n - 1}}{n - 1} - \int{\tan^{n - 2}{x}\,dx}}$

$\displaystyle{ = \frac{\tan^{n - 1}{x}}{n - 1} - \int{\tan^{n - 2}{x}\,dx}}$.

So $\displaystyle{\int{\tan^n{x}\,dx} = \frac{\tan^{n - 1}{x}}{n - 1} - \int{\tan^{n - 2}{x}\,dx}}$

3. So $\displaystyle{\int{\tan^n{x}\,dx} = \frac{\tan^{n - 1}{x}}{n - 1} - \int{\tan^{n - 1}{x}\,dx}}$
you mean $\displaystyle \int\tan^nx dx=\frac{\tan^{n-1} x}{n-1}-\int\tan^{n-2}x dx$?

4. Yes I do


text:
# Perturbative violation of the unitarity: what is it?

Consider the Fermi theory:

$$\mathcal{L} = \frac{G_{F}}{2\sqrt{2}}\bar{n}\gamma_{\mu}(1-\gamma_{5})p \bar{\nu}\gamma^{\mu}(1-\gamma_{5})e$$

The cross section of $$2 \to 2$$ scattering calculated within the leading order of the perturbation theory grows with energy: $$\sigma_{\bar{p}n \to e\bar{\nu}} \sim G_{F}^{2}s$$ Thus, as is typically said, it violates the unitarity since it breaks down the "tree level unitarity" at high energies.

My question is the following: why the first statement follows from the second statement? Maybe the perturbation theory cannot be considered for energies $$s\gtrsim G_{F}^{-1}$$, since the effective coupling is $$G_{F}s$$?

• One assumes you are cool with this? – <NAME> Jun 25 '19 at 19:30


text:
# How can I improve the numerical results while working Mathematica

I'm trying to solve nonlinear equations using Newton-type methods with very high accuracy using Mathematica. I found many research papers in which the numerical results are calculated with very high accuracy. e.g. To solve the equation $$e^{-x}+\sin(x)-2=0\text{ with initial guess }x_0=-1.$$ Many authors evaluated its functional value after some iterations up to $10^{-300}$ and less than this. But with the same function and same initial guess, I could not get the functional value better than $10^{-16}$. Why? Is there any special coding to increase the accuracy of the result.

## migrated from math.stackexchange.comMay 21 '18 at 23:45

This question came from our site for people studying math at any level and professionals in related fields.

• Welcome to MSE. Please use MathJax. – <NAME> May 19 '18 at 6:55
• With the errors, did you mean 1e-300, 1e-16 as in $10^{-300},\,10^{-16}$? – LutzL May 19 '18 at 9:59
• yes, it means 10^(-300) and so on. – Prem May 20 '18 at 7:00
• It's hard to answer your question "Why?" without seeing how you coded your Newton-type methods. – Michael E2 May 22 '18 at 1:51

Try

FindRoot[Exp[-x] + Sin[x] - 2 == 0, {x, -1}, WorkingPrecision -> 500]

• I'm using the following code : – Prem May 20 '18 at 16:20

You could also use Solve as long as you provide a domain restriction:

root = x /. First @ Solve[Exp[-x]+Sin[x]-2==0 && -2<x<0]

Root[{1 - 2 E^#1 + E^#1 Sin[#1] &, -1.05412712409121289977}]

The nice thing about the Root representation above is that it behaves like an exact expression. Anywhere you can use an exact expression (like Pi), you can instead use the above Root object. For example:

N[root]
N[root, 100]
Integrate[x^root, {x, 1, 2}]
Minimize[x^2 - 2 root x + 1, x]

-1.05413

-1.054127124091212899766844310942376610765302238222244358374175157259667078894540095490830534013697076

(-1 + 2^(1 + Root[{1 + E^#1 (-2 + Sin[#1]) &, -1.05412712409121289977}]))/(1 + Root[{1 + E^#1 (-2 + Sin[#1]) &, -1.05412712409121289977}])

{1 - Root[{1 - 2 E^#1 + E^#1 Sin[#1] &, -1.05412712409121289977}]^2, {x -> Root[{1 - 2 E^#1 + E^#1 Sin[#1] &, -1.05412712409121289977}]}}


text:
# Q. 1.     Make up as many expressions with numbers (no variables) as you can from three numbers $\inline 5,7$ and $\inline 8.$  Every number should be used not more than once. Use only addition, subtraction and multiplication.(Hint: Three possible expressions are $5+(8-7),\ 5-(8-7), \ (5\times8)+7$ make the other expressions.)

M mansi

The  other expressions are :

(i)$(8\times 5)-7$

$(ii)(8+5)-7$

$(iii)(8+7)-5$

$(iv)(8\times 7)-5$

$(v) 5\times (7+8)$

$(vi) 5\times (7\times 8)$

$(vii) 5-(7+ 8)$

$(viii) 5+(8-7)$

Exams
Articles
Questions


text:
# Plot complex region

1. Apr 17, 2010

### Mechdude

1. The problem statement, all variables and given/known data
i was supposed to figure out what this region looks like ad to plot it
$$\left| \frac{z + i}{z - i} \right| > 1$$

2. Relevant equations

$z = x + iy$

3. The attempt at a solution

i tried a couple of rearrangements but i got nowhere:
$$\left|z+i \right| > \left| z - i \right|$$
getting:
$$\sqrt{ x^2 + (y+1)^2 } > \sqrt{ x^2 + (y-1)^2 }$$

which ends up $$4y > 0$$
is this it? simply y>0?
1. The problem statement, all variables and given/known data

2. Relevant equations

3. The attempt at a solution

2. Apr 17, 2010

### annoymage

i think, im not sure, but try something like this

|a| > |b|

=> a > |b| or a < -|b|

=> -a < b < a or a < b < -a

=> (b > -a and b < a ) or (b > a and b < -a)

and plot

Last edited: Apr 17, 2010


text:
This is my first ever experience with GNU Radio. I am trying to implement a simple FM receiver shown below with its C++ API.

I seem to have pedantically deconstructed this receiver into its smallest components and implemented them with GNU Radio's C++ API but does not work.

It runs but I hear no sound which makes me suspect I have misconfigured some component, missed to set some sort of gain, etc.

Any feedback is appreciated. Thank you.

#include <gnuradio/analog/quadrature_demod_cf.h>
#include <osmosdr/source.h>

std::vector<double> d_fftaps;  /*! Feed forward taps. */
std::vector<double> d_fbtaps;  /*! Feed back taps. */

using namespace gr;

int main(int argc, char** argv)
{
int sample_rate = 2.88e6; // audio card sample rate
int audio_decimation = 5;

// Build a top block that ill contain flowgraph blocks

osmosdr::source::sptr osmocom = osmosdr::source::make("rtl=0,repeat=true,throttle=true");
osmocom->set_center_freq(96.3e6);
osmocom->set_sample_rate(sample_rate);
osmocom->set_gain(20, 0);
osmocom->set_if_gain(20, 0);
osmocom->set_bb_gain(20, 0);

// Low pass filter
unsigned int flt_size = 1024;
std::vector<float> low_pass_filter = filter::firdes::low_pass(1, sample_rate, 100e3, 10e3);
filter::pfb_arb_resampler_ccf::sptr d_filter = filter::pfb_arb_resampler_ccf::make(288, low_pass_filter, flt_size);

int max_dev = 75e3;
float fm_demod_gain = quad_rate / (2 * M_PI * max_dev);

d_fftaps.resize(2);
d_fbtaps.resize(2);

filter::iir_filter_ffd::sptr d_deemph = \
filter::iir_filter_ffd::make(d_fftaps, d_fbtaps, false);

int audio_rate = quad_rate / audio_decimation;
int width_of_transition_band = audio_rate / 32;
std::vector<float> d_pll_taps = \
filter::firdes::low_pass(1, quad_rate, audio_rate / 2 - width_of_transition_band, width_of_transition_band);
filter::fir_filter_fff::sptr low_pass_filter2 = \
filter::fir_filter_fff::make(1, d_pll_taps);

// Rational Resamplifier - might not be needed hence not used atm
filter::freq_xlating_fir_filter_ccf::sptr filt = \
gr::filter::freq_xlating_fir_filter_ccf::make(288, {1}, 0.0, sample_rate);

audio::sink::sptr sink = audio::sink::make(48000);

top_block->connect(osmocom, 0, d_filter, 0);
top_block->connect(d_deemph, 0, low_pass_filter2, 0);
top_block->connect(low_pass_filter2, 0, sink, 0);

top_block->run();

return 0;
}

{
if (tau > 1.0e-9)
{
// copied from fm_emph.py in gr-analog
double  w_c;    // Digital corner frequency
double  w_ca;   // Prewarped analog corner frequency
double  k, z1, p1, b0;

w_c = 1.0 / tau;
w_ca = 2.0 * fs * tan(w_c / (2.0 * fs));

// Resulting digital pole, zero, and gain term from the bilinear
// transformation of H(s) = w_ca / (s + w_ca) to
// H(z) = b0 (1 - z1 z^-1)/(1 - p1 z^-1)
k = -w_ca / (2.0 * fs);
z1 = -1.0;
p1 = (1.0 + k) / (1.0 - k);
b0 = -k / (1.0 - k);

d_fftaps[0] = b0;
d_fftaps[1] = -z1 * b0;
d_fbtaps[0] = 1.0;
d_fbtaps[1] = -p1;
}
else
{
d_fftaps[0] = 1.0;
d_fftaps[1] = 0.0;
d_fbtaps[0] = 0.0;
d_fbtaps[1] = 0.0;
}
}

CMakeLists.txt for those wanting to try it out:

cmake_minimum_required(VERSION 3.8)

include_directories(
$${GNURADIO_ALL_INCLUDE_DIRS}$${Boost_INCLUDE_DIRS}
$ENV{HOME}/.grc_gnuradio ) set(GR_LIBRARIES boost_system gnuradio-blocks gnuradio-filter gnuradio-analog gnuradio-audio gnuradio-runtime gnuradio-pmt gnuradio-osmosdr log4cpp ) add_executable(fm_radio fm_radio.cpp) target_link_libraries(fm_radio${GR_LIBRARIES})

• Hello Oleksandr, and welcome to ham.stackexchange.com! – rclocher3 Jul 13 at 14:01
• Cheers, @rclocher3! – <NAME> Jul 13 at 16:39

There is at least one error in your code that would result in silence:

std::vector<double> d_fftaps;  /*! Feed forward taps. */
std::vector<double> d_fbtaps;  /*! Feed back taps. */
d_fftaps.resize(2);
d_fbtaps.resize(2);

filter::iir_filter_ffd::sptr d_deemph = \
filter::iir_filter_ffd::make(d_fftaps, d_fbtaps, false);

The taps of this IIR filter are all zero (because you resized the vectors but did not write any values into them), so the output signal will be always zero.

As a quick test to see if this is the sole problem, you can remove the deemphasis filter block entirely; the audio frequency response will be wrong but you'll still be able to tell the difference.

You could also remove the squelch block temporarily, as one fewer thing to go wrong. The absolute minimum you need for a receiver that will pass some coherent signal is a decimating low-pass filter to select the desired signal and adapt the sample rate, and the quadrature demodulator; everything else is refinement.

• Thanks for your assistance. You were right, I have completely forgotten to set up the taps. I have borrowed the code for calculating iir taps from Gqrx and can now hear some noise. The main suspect is my implementation of the WBFM Receive block which unfortunately has no C++ implementation, so I had to copy it from the Python blocks it is comprised of. I have updated the code. Is there an example of a simple FM receiver without usage of WBFM Recive block, so I could study it? Thank you again. – <NAME> Jul 13 at 1:55
• @OleksandrKravchuk Gqrx is the one example I'd know of to point you at. I recommend focusing on understanding your signal processing stages and testing them individually to ensure they behave as you expect (and you could run them with file input and output blocks and compare the results to GRC/Python versions), rather than looking for examples to copy. – <NAME> AG6YO Jul 13 at 2:10


text:
# zbMATH — the first resource for mathematics

Probability that the maximum of the reflected Brownian motion over a finite interval $$[0,t]$$ is achieved by its last zero before $$t$$. (English) Zbl 1329.60292
Summary: We calculate the probability $$p_c$$ that the maximum of a reflected Brownian motion $$U$$ is achieved on a complete excursion, i.e. $$p_c:=P\big(\overline{U}(t)=U^*(t)\big)$$ where $$\overline{U}(t)$$ (respectively $$U^*(t))$$ is the maximum of the process $$U$$ over the time interval $$[0,t]$$ (respectively $$\big[0,g(t)\big]$$ where $$g(t)$$ is the last zero of $$U$$ before $$t$$).

##### MSC:
 60J65 Brownian motion 60G70 Extreme value theory; extremal stochastic processes 60G17 Sample path properties 60J25 Continuous-time Markov processes on general state spaces
Full Text:


text:
# User:Marcov

Jump to: navigation, search

The contributions of this user are both placed in the public domain as licensed under 3 clause BSD (the one without advocacy clause)