text:
# a cool easy problem 4

When a voltage of $$20 V$$ is applied between two ends of a coil, $$800 \frac{cal}{s}$$ of heat are produced.

What is the resistance of the coil?

• $$1 cal = 4.2 J$$
×

format: plain


text:
# [EfiensCTF2019 Round2] All Challenges Writeups

This is a write-ups for the Efiens’s qualification CTF - round 2 and this is my first CTF write-ups ever. Actually, when I participated in this CTF, I was kind of a newbie who had just gotten into programming for 5-6 months and CTF for about 2 months so this write-ups might not be perfect and the solution might be somewhat naive. But I hope I can deliver the general idea of my thought process on each challenge and how to solve them. So, welcome, and let’s begin with our first challenge.

## Pwn: lottery

This first challenge is pretty simple, it gives us a program that secretly generates 2 random integers, ask for the player’s name, print out that name and then ask for a number, if our input number is equal to the sum of the 2 random numbers generated earlier, we get the flag.

Looking at the source code, I realized that there is a format string bug because our name input will be taken directly into the format string parameter of printf, and also, the 2 numbers are generated before that printf, so we can easily exploit the bug to leak out those 2 numbers, take their sum, and input it to get the flag. Debugging with GDB, I saw the 2 numbers were at the position of the 6th and 7th parameters of printf, so in order to leak those numbers, my input was as follow: %6$d %7$d.

efiens{ez_vietlot}

## Pwn: Cuộc đời bạn màu gì?

This challenge is also pretty simple, we are given a Python program that will randomly choose one of the 6 colors, ask for your name and then print out that color as the color of your life. There is no flag in the source code this time, so our goal will be getting a shell here.

For the first few minutes, I couldn’t spot out the bug here, “How can a program as simple as this has a bug?” - I asked myself. But very soon after that, I looked at the very first line of the code and noticed that this is Python 2, and in Python 2, we seldom take user’s input with the input() function (it may sound a bit silly but whatever). The function input() in Python 2 is not equivalent to that of Python 3, while Python 3’s input() takes user’s input as a string, Python 2’s input() actually evaluates your input.

With that figured out, I could just use this to execute the system function in the os library with the parameter /bin/sh to get a shell. My input was as follow: __import('os')__.system('/bin/sh') .

efiens{python2_iz_da_best}

## Pwn: heap

Checksec:

Okay, things start to get interesting as we don’t get the source code for this challenge, but we do have an information that ASLR is disabled.

First of all, I ran the program and tried several inputs, the outputs were pretty much the same for all of those: some weird sentences and a bunch of asterisks were printed out. So after that, I tried to open the binary with IDA. I didn’t go through all of those instructions because I’m bad, but I did notice some important things: under some conditions, the program will print out “Uh oh! You smashed something” and some DEBUG lines. I then immediately tried to “smash” it with a long input, and yes, those lines got printed out. In addition, those asterisks that were printed out earlier were not here, a part of my input got printed out instead. “A program that prints out your input? This maybe format string again!” - I thought. And yes, it was indeed format string. Next up, I tried to reduce the size of my input to see at which length did it get smashed, and it started to happen at 136-byte-long input, the first character to be printed out is the 137th byte. So I tried to leak the stack out, and what I got was as follow:

efiens{the_art_of_formatstring}

## Pwn: calculator

Checksec:

This program has 3 options: write up to 16 numbers into the calculator at the chosen index, read a number at the chosen index, take the sum of those and exit. I actually had never solved a challenge with ASLR before this so I had to ask the author of this challenge @pickaxe for some technical stuff, and with those knowledge, I managed to solve it.

Again, there is no flag or get flag function in the source, so our goal to get a shell. Moreover, the program has NX, so we can no longer execute a shellcode on the stack like in the previous challenge. Therefore, we need to do some ret2libc action.

First of all, I saw that the program restricts the upper bound of the index can be chosen to write into, but it doesn’t restrict the lower bound! So, we can have negative index input and that will actually overwrite something on the stack. Open the program with GDB and debug it, I quickly noticed that the return address of the dowork function is located at index number -8, so it is fully under our control (overwriting the return address doesn’t even touch the stack canary which is extremely convenient for us).

The system has ASLR, so I had to leak the base of libc first. I did it by overwriting the return address and 2 next memory slots as follow: [email protected] | puts ret addr | [email protected] (I chose the start of main for the ret addr just to be sure nothing weird happens). Parsing the first 4 bytes and substracting it with the puts offset, I had the base of libc. With it, I could easily calculate the addresses of system and /bin/sh. Now with all the information, I went back to the overwriting process again and set it up as follow: system addr | 4 random bytes | /bin/sh addr . And that should give me the shell, right?…

Wrong!!! No shell for me! I struggled for quite a while trying to figure out what was the problem here. Even though my solution seemed very logical, it didn’t go the way I wanted. Later, I figured out that the problem here was that the input was taken as long, which has the upper bound of 2^31 - 1, which is much smaller than the addresses on libc, so I couldn’t directly input it that way. With the problem figured out, the solution was pretty simple: just take the correspondent negative value of the addresses by substracting it with 2^32. And finally, the shell was mine.

efiens{ret2libc_is_sooo_fun}

## Pwn: PhoneBook

Checksec:

Another challenge that I required some hint to solve. The author’s hints were: “overwriting GOT” and “the do you want to quit prompt”.

This program has 4 options: adding a contact, viewing one, deleting one and quit. There is a getFlag function in the source, so our goal is to find a way to call it.

First of all, before the second hint was given, I had already realized that when the phonebook is full, the index checking doesn’t stop, and because the choice input’s buffer is 16 bytes long, if I set the third 4 bytes of it to 0, the program will treat it as a new index and I could overwrite the handler function’s frame pointer (but of course, I didn’t know what to do with it at the time because I could’t think of a way to overwrite GOT when I only had control over the frame pointer).

With the latter hint revealed, I started to look at main (because the prompt happens in main). Reading the instruction, I realized that the first parameter of readString - which is the address of the buffer - is taken as rbp - 0x10, and that value is modifiable. After handler returns to main, its frame pointer is popped, so then I could set the rbp in main to anywhere I want. After prompting for input, strcmp got called, so if I could overwrite the address at [email protected] to getFlag’s address, it will be called instead. Overwriting GOT became much more simple now, the only thing I needed to do was set the handler’s frame pointer to [email protected] + 0x10 and input the prompt with getFlag address. And with that, I got the flag.

efiens{master_of_stack_based_exploit}

Note: The quitting prompt interaction is pretty weird because “y” means stay and any other characters mean quit. However, this was pretty much intended by the author because otherwise you can make another index and overwrite the return address itself.

## RE: xor

We continue to our first Reverse Engineering challenge. In this challenge, we are given a program that take a key as the input, does something with it (maybe does some xor operator as the name suggests) and if our key is correct, we get the flag.

The solution is extremely simple though. First, I opened the binary with IDA and then I saw a string that looks like the key: M3A8S174, so I tried to run the program and input that string as the key. And that really was the key so I got the flag (I didn’t even bother looking at the rest of the binary tbh that’s why I am not sure what it does lol) .

efiens{x0r_s0_fun^^}

## RE: tricky

This challenge is a pretty nice one. The program asks us for a password, and if our password is correct, we will get the first half of the flag. It then asks us for the second password and rewards us with the second half if we get it right. The program also has an anti-debug mechanic (but bypassing it was pretty easy though [1]).

First of all, I opened the binary with IDA and looked at the algorithm that checks the first password. It was pretty simple. First, (strlen(s) & 3) must not be 1 so that means the last two bits of the password’s length must be 0, in other words, the password’s length must be divisible by 4. Next, the password must not contains any character that has the restricted ASCII value. The final condition was pretty hard to understand for me at first, but after bypassing the anti-debug and debugged it, I realized that what it does is just splitting your password into blocks of 4 bytes, taking the sum of them and then comparing it with… -1??? This is the first tricky part, because it was not compared with -1 at all, it was with 0xffffffff (I think that was because IDA pseudocode reads that as -1 since that value is more likely to be -1 so it kinda messed up there). With all those conditions, I wrote a short Python script that generate a password that satisfies them all, which I got AAAAAAAA}}}}.

The next half was where it seemed to be tricky because there was some Virtual Machine action going on. But before that, our password must satisfy some conditions first. Again, (strlen(s) & 3 != 1), that means the length must be divisible by 4. Then, (strlen(s) - 12 > 3 != 1), another tricky part, my first conclusion was that the length can only be 4, 8 or 12, but when debugging, the length of 4 and 8 didn’t seem to work. I then realized that it was because strlen returns an unsigned int, so when strlen(s) - 12 equals to a negative value, it actually gets rolled up to a very large value and that value for sure greater than 3, so only the length of 12 works. Next, I tried to read through the VM part but couldn’t understand most of them, so I tried to run the binary and input a random length-12 password and see what happens. And how convenient! It printed out all the opcodes it used and all I did was to follow them one by one (they were really simple) and I got the second password: 14ae5ee7a285. With those 2 passwords in hand, I got the flag.

efiens{th15_15_A_veRy_3a5y_VM}

## RE: SMT

As challenge’s description says, this is an introduction to SMT. At first, I didn’t know what SMT is but this is a RE challenge so I just proceeded to open it in IDA anyway, and what I got was a mess with a bunch of variables and formulars. It was very intimidating! But then after some googling and research, I found out that this challenge is more intimidating than it is hard.

There is a pretty funny part about this challenge is that if you run the binary, you will get nothing but an infinite loop that will keep printing out dots. But running the binary isn’t necessary at all, because the only thing you need to do is solving those formulars and you already get the flag.

Reading the IDA pseudocode, I realized that our input needs to be of length 168, then the formulars are just a bunch of logical operators that operate on every single bytes of our input. After some researchs, I learned that SMT problems can be solved with z3 solver [2], so all I did was copy all of the formulars from IDA pseudocode to my python script, used some regex to modify them and after that ran the code to get the flag (I don’t know if there are any other ways to quickly transfer those formulars into python but this works so I will just go with it for this specific challenge).

efiens{Do_you_know_SMT_Solver_is_computer_science_wet_dream?}

## RE: hidden

This is our final RE challenge, and it is very very interesting. As the title suggests, this challenge’s flag is hidden extremely well, and I don’t think I could ever solve this challenge without some hint from its author @ks75vl.

The challenge provided us with a PE file. But the weird thing about it is that when I opened it, I got a dll missing error. I checked my system32 and saw that the dll was there, so what happened? I proceeded to ask the author about it and he gave me the first hint: “debug and try to understand the part where it loads the libraries”

After quite some time debugging, I understood what the load library function does: it first loads user32.dll, then calls the user32_MessageBoxA to print out the error, so the error was fake after all, and then it frees the library and exits the program, that’s why nothing happened after the error. My first try was to use a hex editor to NOP out the exit call but then all I got was a blank flag: efiens{}.

I then asked for the next hint and it was “the flag is near there, somewhere in the unused data”. So I took a look at the function again and saw that all the data must go through another function before they are used. Luckily for me, that function was not hard to understand: it takes an array of integers as parameter then does the not operator on all of the elements and then deletes the first element. So I tried to perform that on all of the unks in the data segment and the very last of them gave me the flag.

efiens{I_Need_H3aling_:glhf:_}

## Web: echo

Next up are the web challenges, starting with a php challenge. The web takes in one GET parameter ‘echo’, and if our input satisfies some conditions, it will be eval and echo out. Those conditions are: it must not contain php’s internal functions, some more functions and some special characters, so we are pretty much limited to using the user-defined function f10eq() which is a pretty useful one that scans the current directory.

First, I tried to do just that with echo=f10eq() and got an error because scandir returns an array while php cannot print out an array. Therefore, I had to look at the files by indexing. However, square brackets are restricted, but it doesn’t matter much because this is php and I could use curly brackets instead. At index number 2, I found a file flag_a3e08ffc1c35e624cc38da823ee254cb.txt, I then opened it and I got the flag.

efiens{H3roes_Nev3r_Die!_^^}

## Web: Avatar

This web allows you to upload an image file to change the user’s avatar.

First of all, I tried to upload something that was not an image file and the web accepted it, it didn’t restrict anything. Therefore, I could upload a php file and open it. But the thing is I didn’t know where the uploaded file was at, and the hint was that it was somewhere on the server, so dirsearch [3] came into play. Scanning the web server revealed a folder named uploader that seemed to be where the files were at.

The first file I uploaded contains the code <?php passthru("ls -a ..") ?> to list all files in the parent directory of uploader, and I found a directory named e6e677e0c080e30506687ef22b7d5f20 (at first I thought this was a file and tried to read it lol). Uploading another file to list all files in that directory, I found the flag.txt file. I then uploaded another file contains <?php passthru("cat ../e6e677e0c080e30506687ef22b7d5f20/flag.txt")?> and I got the flag.

efiens{whY_d0nT_U_upL0aD_4n_1mag3_file????}

## Web: Avatar v2

Note: According to the author, the source code of the challenge was buggy at first so I will skip the part when I was trying to solve the buggy version.

This challenge seems identical to the previous one, but now, your uploaded files are restricted to only image files.

I didn’t know what kind of restriction the web used, so I just tried all the different methods to bypass it. One of them was changing the first 4 bytes (aka the magic bytes) of the file to GIF8 to trick the server. This trick worked, so nothing more to say. All I did was exactly the same as the previous challenge with GIF8 at the start of each files and I got the flag.

efiens{whY_d0nT_U_upL0aD_4n_1mag3_file?v?2??}

## Web: fashe

Hint: “SQL Injection”, “not related to crypto”.

This is a pretty cool web challenge. Our goal here is to buy all the 3 products and we will get the flag. We only have 50$while the products are 30$, 60$, 60$ so we must apply some coupon to reduce their prices.

Reading the source code, I saw that the coupon for the 2nd product is already in there, so our goal here is to find the 3rd product’s coupon. After some tries and error, I found out that there was a query error in the productID input field, so that will be where SQL Injection happens. And looking closely at the source code, I noticed that it only takes out the last character of the productID as the ID, so if I input the productID as " OR "3"="3 and the coupon as the 2nd product’s coupon, the 3rd price should be reduced. And yes it worked, but the thing is, the key to decrypt the flag is all the coupon combined, if I did it this way, the 3rd coupon was incorrect, so that even though I had bought all 3, there was no flag to be found.

Therefore, I tried Blind SQL injection to find the 3rd coupon. What I did was to input the productID as " OR BINARY CODE LIKE "%x% where x is a character from a-z, A-Z, 0-9 to find all the possible characters in the coupon (if I get a “recheck your code” warning, that means the character is correct, it is incorrect otherwise). After that, I did it again with " OR BINARY CODE LIKE "x% and tried with all the possible x discovered before, if a character is correct, I moved onto the next one consecutively (I didn’t know how to write a script to do it automatically so I did it manually which was pretty time-consuming, but that worked anyway). The coupon was hAApY_A97jM_9MpGt .

This is the exploit script that I wrote several days after with some help: https://github.com/lkmidas/EfiensCTF_Round2/blob/master/web_fashe/exploit.py

efiens{n1c3_tRY_0n_bL1nD_SQLi___h4ppY_n3W_y34R__!}

The challenge starts with a login screen with a GIF of some dude vs a dog.

The login part was kinda weird, I didn’t fully understand how it worked and if what I did was the right way, but the first hint revealed was “doghunter”, so I tried to login with username and password as “doghunter” and it did log me in.

Next up, it showed that the flag was in /etc/flag, and we are allowed to upload a zip file, and then, the zip file’s content will be shown on the screen. I tried uploading various files (txt, php, JS, …) and didn’t get anything useful. Then I tried googling to see if there are any vulnerabilities in uploading a zip file, and there is: the Zip Slip [4]. I did some research, and I found the symbolic link Zip Slip. So what I did was as follow: opened Terminal and typed the following commands:

• ln -s /etc/flag ./symlink.txt
• zip —symlinks -r submit.zip ./symlink.txt

And then I submitted the zip file and got the flag.

efiens{D0nT_f3Ar_Th3_D0G}

## Crypto: 46esaB

Next up, we have some cryptography challenges. First of all, I have to say that this is not my strong part and I’m not that good at math, so most of these solutions are just 20% math, 30% help from others and 50% google. But I did solve them anyway so I just want to write something about them.

With that said, we begin with our first challenge. This challenge is maybe the only one that I solved myself without any hints because it was quite easy. All we are given was a file names S0meTh1ng.txt .

Looking at the file’s content and the title of the challenge (which is base64 backwards), I recognized this was base64 encoded, so I tried to decode it, but decoding it once or twice just gave me some more base64 encoded text. Therefore, I simply used a loop to decode it multiple times until it has the form of a flag.

efiens{196}

## Crypto: RSA Return

Hint: Wiener attack.

Looking at the given file, I could see that this is a RSA encryption with a very large e value, so I didn’t know what to do at first. But then the hint came, and things became much much easier. I did some googling and found a lot of Wiener attack script, but I ended up choosing this sage script [5] because I thought it was the simplest one. All I did was to modify it a little bit and I’m done.

efiens{2_plUs_2_1s_4_m1nUs_1_th4t_3_qu1ck_m4th}

## Crypto: Seem Easy

Hint: modular sqrt

This challenge is the one that I did NOT solved it myself. This whole solution was of my friend @Daru-kun (I did give him some ideas that led to the solution though). He solved this one and showed me the solution, and all I did was to re-implement it in sage for simplicity.

We are given a python file named wtf that looks like an encryption file and a log file. Reading the python file closely, we can see that this is again a RSA encryption on flag^2, with the private key and cipher saved in the log file, and t being the product of 2 primes. So what he did was to decrypt the RSA, use Tonelli-Shank to calculate the modular sqrt and then use CRT to retrieve the flag. I then re-implemented it in sage so that I could use the built-in modular sqrt and CRT functions without implementing them.

efiens{RSA_shared_bit_never_get_old!_Now_you_have_known_RNG_is_very_complicated_to_make_it_right}

## Crypto: NTRU

Hint: LLL Reduction algorithm.

This challenge for me was just pure Google. I first tried to read some documents about NTRU and didn’t understand any of them (again my math is not that great). So all I did was to try googling the keyword “NTRU LLL attack” and I found this write-ups [6] which has the whole solution script for this exact type of attack (later on, I was told that LLL is just an algorithm, not an attack, the attack itself was LLL-based). Therefore, even though this challenge was considered hard, it was just free for me.

efiens{._.B3y0unD_G0dL1k3._.}

## Misc: Spammmmm

We have come to our very last challenge. I didn’t intend to write about this one because it is just kinda silly, but I also think that it is pretty hilarious so I will just write some lines about it.

We are given a file that looks like a spam email with a pretty nonsense content. There are no hints for this whatsoever and it is also in the misc category so there are absolutely no clues for this one.

With a challenge like this, I though that Google may help, so I tried googling some unique keywords in the text, which was "Senate bill 2716 ; Title 2 , Section 304" and I found this site [7]. Turned out that this was just some kind of weird encoding, so I just copied and pasted it into the site and let it decode the text. Salute to the author for this “creative” challenge though.

efiens{__de_xam_VKL__}

## References

##### Midas
###### Pwner/Memer

CTF player. Reverser. Pwner. Memer.


text:
TEST YOURSELF

1. Write the co – efficient of each term of 3x2 – 7x + 8

1. Find p(-1) for p(x) = (3x – 1) (2x + 1 )

1. Find the zero of p(x) = 7x2 + 5x

1. Find the remainder when x3 – 6x2 + 8x + 2

1. Use factor theorem to find if g(x) is a factor of p(x) = 2x3 + 3x2+ 6x + 1 g(x) = x +2

1. Evaluate without actual multiplication 105 x 95

1. Factories 5x2 + 2x – 3

1. Expand using suitable identity: (-x + y – 2z)

1. Write the cubes in expanded form: (2x – 1)3

1. Factories 27a3 – 64b3

1. Show that (a + b)2 = a2 + 2ab + b2


text:
### Recent Submissions

• #### The disposal choices for small household electrical appliances in Linfen, China

(2017)
There is minimal literature on how small household electronic appliances are being disposed post-consumer use despite the risk of environmental pollution that can arise from the improper disposal of these items. Larger ...


text:
# Why two different spinors are Grassmann quantities?

In Rydberg Quantum Field Theory page 441 (this edition, unfortunately page 441 is not in the link) it says

If $\xi$ and $\eta$ are Majorana spinors [...] and since $\xi$ and $\eta$ are Grassmann quantities, $$\xi_i^*\eta_j^* = -\eta_j^*\xi_i^*$$

I know that Grassmann quantities obey the Grassmann algebra, i.e. $\{\xi_i,\eta_j\} = 0$. But why two different spinor fields obey this algebra?

As far as I understood two spinor fields $\xi$ and $\eta$ obey the anticommutation relations between each and its conjugate, $\{\xi_i(\vec{x},t),\xi_j(\vec{y},t)\}=\delta_{ij}\delta^3(\vec{x}-\vec{y})$ and the same for $\eta$. But in this case we have two different fields $\xi$ and $\eta$ which are not the conjugate of each other. So why do they have to satisfy this Grassmann algebra?

For example, in QED there are two fields $\psi$ and $A^\mu$ and each has its commutation/anticommutation relation with its own conjugate (in the case of $A^\mu$ with itself). But there are not any relations between $\psi$ (or $\bar{\psi}$) and $A^\mu$, they are different fields. I mean $[\psi,A^\mu] = \{\psi,A^\mu\} = 0$ and the same for $\bar{\psi}$.

• Nope, all spinor fields anticommute. Why do you think some anticommute and some don’t? – knzhou Aug 25 '18 at 22:35
• Spinors (or, for that matter, any representation of a group) can be defined over both commuting and anti-commuting fields. Either option is fine, but you have to be consistent: it makes no sense to have $\xi$ sometimes being a $c$-number, and sometimes an $a$-number. Once you declare it to be an $a$-number, you have to stick to that choice. And $a$-numbers anti-commute with each other: both with themselves and with other $a$-numbers. – AccidentalFourierTransform Aug 25 '18 at 23:06
• Good question. One physical reason to impose anticommutation relations on spinors is to ensure that the energy of a system is bounded from below, else vacuum/particles could keep producing matter incessantly (without violating conservation of energy) and destabilize the system. But, of course, we don't observe this in the real world. – Avantgarde Aug 25 '18 at 23:48
• My doubt is about why two different fields, not being related between each other by any conjugation operation, have to satisfy this conditions. Its the same as in non relativistic quantum mechanics, the commutation relations are for $x$ and $p_x$ which are one the conjugate of the other, but $x$ and $p_y$ have nothing to do between each other. I thought the same about fields, $\xi$ and $\bar{\xi}$ must satisfy anticommutation conditions (because they are a conjugate pair), but why $\xi$ and $\eta$? Its the same as saying that in QED $\psi$ have to commute/anticommute with $A^\mu$... – user171780 Aug 26 '18 at 2:50
• For your question to make sense, you have to encounter the product of "independent" spinors in real calculations. It is possible if the corresponding fermions interact, so the spinors are not really independent after all. Otherwise (never interacting fermions) both options never appear in meaningful calculations. – Vladimir Kalitvianski Aug 26 '18 at 14:49

Why two different spinors are Grassmann quantities?

We interpret this as asking why independent spinors anticommute? Here is one line of reasoning:

1. A general supernumber $z=z_0+z_1$ has a Grassmann-even and a Grassmann-odd component, $z_0$ and $z_1$, respectively.

2. $z_0$ and $z_1$ are supernumbers of definite Grassmann parity, $|z_0|=0$ and $|z_1|=1$, respectively.

3. A Grassmann-odd supernumber $z$ with $|z|=1$ squares to zero: $z^2=0$.

4. A sum $z+w$ of two Grassmann-odd supernumbers $z$ and $w$ is still a Grassmann-odd supernumber. Hence it squares to zero $$0~=~(z+w)^2~=~\underbrace{z^2}_{=0} + zw + wz +\underbrace{w^2}_{=0}~=~ zw + wz.$$ Hence two Grassmann-odd supernumbers $z$ and $w$ anticommute, cf. OP's question.

5. More generally, two supernumbers $z$ and $w$ of definite Grassmann parity supercommute: $$[z,w]_S~:=~zw-(-)^{|z||w|}wz~=~0,$$ where $[\cdot,\cdot]_S$ denotes the supercommutator. In other words, the supercommutator $[z,w]_S=0$ is zero.

6. When we replace the supernumbers with two superoperators $\hat{z}$ and $\hat{w}$ of definite Grassmann parity, i.e. go from classical to quantum theory, the supercommutator $$[\hat{z},\hat{w}]_S~=~{\cal O}(\hbar)$$ can acquire non-zero terms at first (and higher) orders in Planck's constant $\hbar$.

• But why are spinors supernumbers? Aren't the components just complex numbers and thus commuting? – md2perpe Aug 27 '18 at 20:48
• That's a different question, which is discussed in this Phys.SE post. – Qmechanic Aug 28 '18 at 14:26


text:
Share

# Solve the Following Equations. 16 = 4 + 3 (T + 2) - CBSE Class 7 - Mathematics

ConceptSolving an Equation

#### Question

Solve the following equations.

16 = 4 + 3 (t + 2)

#### Solution

16 = 4 + 3 (t + 2)

16 - 4 = 3 (t + 2) (Transposing 4 to L.H.S.)

12 = 3 (t + 2)

Dividing both sides by 3

12/3 = t + 2

4 = t + 2

4 - 2 = t (Transposing 2 to L.H.S.)

2 = t

Is there an error in this question or solution?

#### APPEARS IN

NCERT Solution for Mathematics for Class 7 (2018 to Current)
Chapter 4: Simple Equations
Ex. 4.30 | Q: 3.3 | Page no. 89
Solution Solve the Following Equations. 16 = 4 + 3 (T + 2) Concept: Solving an Equation.
S


text:
# Problem 4

Algebra Level 5

$\frac{a+b}{a+2b+c}+\frac{4b}{a+b+2c}-\frac{8c}{a+b+3c}$

Given that $$a,b,c$$ are positive reals. Find the minimum value of the expression above.


text:
# No one gets this right Categorize the following materials: bronze alloy, mouse growing an ear on its back, porcelain dentures

1 answer
###### Question:

No one gets this right
Categorize the following materials: bronze alloy, mouse growing an ear on its back, porcelain dentures

## Answers

2 answers

### How would you say that it is the following time in spanish? 12:45

how would you say that it is the following time in spanish? 12:45...
1 answer

### 3. Triangle DEF is a scale copy of triangle ABC. What is the length of DF? Explain your reasoning? 4. Rectangle A measures to be 10 inches long and 14 inches wide. Rectangular scaled copy of Rectangle A. Which of the following could be side length A. 20 inches long and 7 inches wide B. 5 inches long and 28 inches wide C. 15 inches long and 21 inches wide D. 11 inches long and 15 inches wide E. none of the above

3. Triangle DEF is a scale copy of triangle ABC. What is the length of DF? Explain your reasoning? 4. Rectangle A measures to be 10 inches long and 14 inches wide. Rectangular scaled copy of Rectangle A. Which of the following could be side length A. 20 inches long and 7 inches wide B. 5 inches lon...
1 answer

### A book, written in 1891, still used as a reference guide in forensic science is: Of Criminal Investigation Crime and Criminals Crime and Punishment Encyclopedia of Crime

A book, written in 1891, still used as a reference guide in forensic science is: Of Criminal Investigation Crime and Criminals Crime and Punishment Encyclopedia of Crime...
2 answers

### A(n) _____ is the highest educational degree available at a community college. specialist's bachelor's associate's master's (associate's)

A(n) _____ is the highest educational degree available at a community college. specialist's bachelor's associate's master's (associate's)...
1 answer

### Solve the equation for x, where x is a real number (5 points): -12x^2 + 18x - 4 = 3

Solve the equation for x, where x is a real number (5 points): -12x^2 + 18x - 4 = 3...
2 answers

### Where and how did hiv/aids start

where and how did hiv/aids start...
2 answers

### As described by sociologist Viviana Zelizer, the transformation of American childhood during modern times can be understood as children losing their __________ value and instead achieving a newfound __________ value.

As described by sociologist Viviana Zelizer, the transformation of American childhood during modern times can be understood as children losing their __________ value and instead achieving a newfound __________ value....
1 answer

### A piece of property lies between two parallel streets as shown.m<1=(2x+6)°,and m<2=(3x+9)°.What is the relationship between the angles? What are their measures?

A piece of property lies between two parallel streets as shown.m<1=(2x+6)°,and m<2=(3x+9)°.What is the relationship between the angles? What are their measures?...
1 answer

### To 7] ] cont use 6) There are 30 students in Mrs. Woodward's class and 1/5 of the class have their own cell phone. Of this group of students, 1/2 of them are allowed to use social media. How many of the students have a cell phone and can use social media? can

to 7] ] cont use 6) There are 30 students in Mrs. Woodward's class and 1/5 of the class have their own cell phone. Of this group of students, 1/2 of them are allowed to use social media. How many of the students have a cell phone and can use social media? can...
1 answer

### Find the angle measures for the following triangle. (x + 2)° 72° The angle labeled tº measures The angle labeled (x + 2)° measures HELP ASAP

Find the angle measures for the following triangle. (x + 2)° 72° The angle labeled tº measures The angle labeled (x + 2)° measures HELP ASAP...
1 answer

### Gel electrophoresis is normally set up with the negative electrode at the top of the gel and the positive electrode at the bottom of the gel. The DNA products are loaded at the top of the gel, and then a current is applied to separate them. However, when preparing to run a gel, you accidentally switched the locations of the negative and positive electrodes such that the positive electrode is at the top and the negative electrode is at the bottom. You still loaded the DNA products at the top of t

Gel electrophoresis is normally set up with the negative electrode at the top of the gel and the positive electrode at the bottom of the gel. The DNA products are loaded at the top of the gel, and then a current is applied to separate them. However, when preparing to run a gel, you accidentally swit...
2 answers

### Please help me!! Im confused

Please help me!! Im confused...
1 answer

### (-1+2p)(3-4p) Answer should be in polynomial standard form.

(-1+2p)(3-4p) Answer should be in polynomial standard form....
1 answer

### At a bakery, the manager sells 4 small cheesecakes and 9 texas sized doughnuts for $76.50. On another day, he sold 3 small cheesecakes and 1 dozen Texas sized doughnuts at the same price for$81.00. how much did he sell each cheesecake for?

At a bakery, the manager sells 4 small cheesecakes and 9 texas sized doughnuts for $76.50. On another day, he sold 3 small cheesecakes and 1 dozen Texas sized doughnuts at the same price for$81.00. how much did he sell each cheesecake for?...
2 answers

### Help please press the image to be clearer and choose please how do I do this? Which one do I choose

Help please press the image to be clearer and choose please how do I do this? Which one do I choose...
1 answer

### Add 5 to p then divide 7 by the result

add 5 to p then divide 7 by the result...
1 answer

### The most diverse biomass is found in which two biomes?

The most diverse biomass is found in which two biomes?...
1 answer

### Graph this inequality x is less than 3

graph this inequality x is less than 3...
1 answer

### What was the controversy associated with the court case?

what was the controversy associated with the court case?...
2 answers

-- 0.011868--


text:
# Generic Algorithms

The library provides a set of algorithms, most of which are independent of any particular container type. Those algorithms implement common functions such as sorting and searching. Most of the algorithms are defined in the algorithm header. In general, the algorithms do not work directly on a container. Instead, they operate by traversing a range of elements bounded by two operators.

For example: Lest’s suppose we have a vector of int and we want to know if that vector holds a particular value.

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
int value=36;

vector<int> numbers = {2,12,18,36,40,58};
auto result = find(numbers.cbegin(), numbers.cend() ,value);
cout << (result == numbers.cend() ? "is not present" : "found!") << endl;

}

Because find operates in terms of iterators, we can use the same find function to look for values in any type of container. For example, because pointers act like iterators, we can use find in an array.

#include <iostream>
#include <assert.h>
#include <algorithm>

using namespace std;

int main()
{
int value=36;

int numbers[] = {2,12,18,36,40,58};
auto result = find(begin(numbers), end(numbers) ,value);
assert(*result == 36);

}

A numner of the algorithms read, but never write to, one of those is accumulate, which is defined in the numeric header.

#include <iostream>
#include <vector>
#include <assert.h>
#include <algorithm>

using namespace std;

int main()
{

vector<int> numbers = {2,12,18,36,40,58};
int sum = accumulate(numbers.cbegin(), numbers.cend(), 0);
assert(sum == 166);

}

sets sum equal to the sum of the elements in the vector, using 0 as starting point of summation.

## Algorithms that write container elements

Some algorithms assign new values to the elements in a sequence.

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{

vector<int> numbers = {2,12,18,36,40,58};
fill(numbers.begin(), numbers.begin() + numbers.size()/2, 0);

for(int it: numbers){
cout << it << endl;
}

}

Output:

0
0
0
36
40
58


text:
In general relativity, astrophysical black holes are uniquely described by the Kerr metric. Observational tests of the Kerr nature of these compact objects and, hence, of general relativity,require a metric that encompasses a broader class of black holes as possible alternatives to the usual Kerr black holes. Several such Kerr-like metrics have been constructed to date, which depend on a set of free parameters and which reduce smoothly to the Kerr metric if all deviations vanish. Many of these metrics, however, are valid only for small values of the spin or small perturbations of the Kerr metric or contain regions of space where they are unphysical hampering their ability to properly model the accretions flows of black holes. In this paper, Tim Johannsen describe a Kerr-like black hole metric that is regular everywhere outside of the event horizon for black holes with arbitrary spins even for large deviations from the Kerr metric. This metric, therefore, provides an ideal framework for tests of the nature of black holes with observations of the emission from their accretion flows, and I give several examples of such tests across the electromagnetic spectrum with current and near-future instruments.

The Kerr metric is a stationary, axisymmetric, asymptotically flat, vacuum solution of the Einstein field equations and, due to the no-hair theorem, the only spacetime in general relativity that has all of these characteristics. Kerr-like metrics retain as many of these properties in order to closely mimic the observational appearance of Kerr black holes. All of them include the Kerr metric as the limiting case if the deviation parameters are set to zero. By construction, parametric deviations from the Kerr metric are usually stationary,
axisymmetric, and asymptotically flat. If such a metric is also a vacuum solution in general relativity, it either harbors a naked singularity or is plagued with pathological regions in the exterior domain where causality is violated (see Johannsen et al. 2012a). Some Kerr-like metrics are valid only for small or intermediate values of the black hole spin (e.g., Glampedakis & Babak 2006; Yunes & Pretorius 2009), while others are based on an expansion in the deviation parameters in order to remain a vacuum solution of the Einstein equations under certain conditions (e.g., Vigeland & Hughes 2010). Depending on the desired application, additional metric properties can be important, such as its Petrov type (Vigeland et al. 2011) or violations of parity (Yunes & Pretorius 2009; Yagi et al. 2012). The metric by Johannsen & Psaltis (2011b) in Boyer-Lindquist-like coordinates is given by
the line element

(ds^2=-[1+h(r,theta)](1-frac{2Mr}{Sigma})dt^2-frac{4aMrsin^2theta}{Sigma}[1+h(r, theta)]dtdphi+frac{Sigma[1+h(r,theta)]}{Delta+a^2sin^2theta h(r,theta)}dr^2)

[+Sigma d theta^2+[sin^2 theta ( r^2+a^2+frac{2a^2Mrsin^2theta}{Sigma}) +h(r,theta)frac{a^2(Sigma+2Mr) sin^4theta}{Sigma}]dphi^2]

where

(Sigma equiv r^2+a^2cos^2theta ),  (Delta equiv r^2-2Mr+a^2),  (h(r,theta) equiv sum_{k=0}^infty (epsilon_{2k}+epsilon_{2k+1}frac{Mr}{Sigma})(frac{M^2}{Sigma} )^k).

This metric is a stationary, axisymmetric, and asymptotically flat parametric deviation that describes an actual black hole for all values within the range of spins |a|(leq) M without relying on an expansion in the deviation parameters (epsilon_{k}) and that is regular, i.e., it is free of any pathologies outside of the event horizon. Possible nonzero lowest-order deviations (epsilon_{k}) , k = 0, 1, 2, of the Kerr metric are ruled out by current solar-system tests of gravity and by the requirement that the above metric reduces to Newtonian gravity far from the black hole. For simplicity, I will allow the leading-order coefficient (epsilon_{3})  to be the only nonvanishing deviation parameter.


text:
# WStatCountsStatistic¶

class gammapy.stats.WStatCountsStatistic(n_on, n_off, alpha, mu_sig=None)[source]

Bases: gammapy.stats.counts_statistic.CountsStatistic

Class to compute statistics (significance, asymmetric errors , ul) for Poisson distributed variable with unknown background.

Parameters
n_onint

Measured counts in on region

n_offint

Measured counts in off region

alphafloat

Acceptance ratio of on and off measurements

mu_sigfloat

Expected signal counts in on region

Attributes Summary

 error Approximate error from the covariance matrix. n_bkg Known background computed alpha * n_off n_sig Excess p_value Return p_value of measured excess. sqrt_ts Return statistical significance of measured excess. stat_max Stat value for best fit hypothesis, i.e. stat_null Stat value for null hypothesis, i.e. ts Return stat difference (TS) of measured excess versus no excess.

Methods Summary

 compute_errn([n_sigma]) Compute downward excess uncertainties. compute_errp([n_sigma]) Compute upward excess uncertainties. compute_upper_limit([n_sigma]) Compute upper limit on the signal. n_sig_matching_significance(significance) Compute excess matching a given significance.

Attributes Documentation

error

Approximate error from the covariance matrix.

n_bkg

Known background computed alpha * n_off

n_sig

Excess

p_value

Return p_value of measured excess. Here the value accounts only for the positive excess significance (i.e. one-sided).

sqrt_ts

Return statistical significance of measured excess. The sign of the excess is applied to distinguish positive and negative fluctuations.

stat_max

Stat value for best fit hypothesis, i.e. expected signal mu = n_on - alpha * n_off - mu_sig

stat_null

Stat value for null hypothesis, i.e. mu_sig expected signal counts

ts

Return stat difference (TS) of measured excess versus no excess.

Methods Documentation

compute_errn(n_sigma=1.0)

Compute downward excess uncertainties.

Searches the signal value for which the test statistics is n_sigma**2 away from the maximum.

Parameters
n_sigmafloat

Confidence level of the uncertainty expressed in number of sigma. Default is 1.

compute_errp(n_sigma=1)

Compute upward excess uncertainties.

Searches the signal value for which the test statistics is n_sigma**2 away from the maximum.

Parameters
n_sigmafloat

Confidence level of the uncertainty expressed in number of sigma. Default is 1.

compute_upper_limit(n_sigma=3)

Compute upper limit on the signal.

Searches the signal value for which the test statistics is n_sigma**2 away from the maximum or from 0 if the measured excess is negative.

Parameters
n_sigmafloat

Confidence level of the upper limit expressed in number of sigma. Default is 3.

n_sig_matching_significance(significance)

Compute excess matching a given significance.

This function is the inverse of significance.

Parameters
significancefloat

Significance

Returns
n_signumpy.ndarray

Excess


text:
# Introduction to condvis2

#### 2019-06-28

This vignette is an introduction to condvis2. This package constructs shiny-based interactive visualisations of prediction models.

## Ozone data

We will use the airquality data built in to R.

ozone <- na.omit(airquality)

The first fit we consider uses Wind only to predict ozone. Here we construct the fit and plot the results.

fit1 <- loess(Ozone~Wind, data=ozone)
plot(Ozone~Wind, data=ozone, xlim=c(1.5, 21), ylim=c(-5,175))
wind <- seq(min(ozone$Wind), max(ozone$Wind), length.out=30)
lines(wind, predict(fit1, data.frame(Wind=wind)))

If we add in a second predictor, we can either move to plotting the surface, or plot how the fit relates to one predictor, for a fixed value of another.

fit2 <- loess(Ozone~Wind+Solar.R, data=ozone)
par(mfrow=c(1,3))
par(mar=c(3,3,3,3))
for (s in quantile(ozone$Solar.R, c(.25,.5,.75))){ plot(Ozone~Wind, data=subset(ozone, Solar.R <= s+20 & Solar.R >= s-20), xlim=c(1.5, 21),ylim=c(-5,175), main=paste0("Solar.R=",s)) lines(wind, predict(fit2, data.frame(Wind=wind, Solar.R= s))) } Notice in the above plots we are only plotting observations where Solar.R values are close to the value used for prediction. These plots can be constructed interactively in condvis2: suppressMessages(library(condvis2)) condvis(ozone, fit2,sectionvars="Wind", conditionvars="Solar.R") This gives the following display: • The histogram on the right shows the values for Solar.R. • The selected value of Solar.R is 207. By clicking on the histogram, you can change this selection. • The main display (on the left) shows the predicted values of Ozone, varying Wind and fixing Solar.R at $$f_2 =207$$. • Only observations which have Solar.R values near 207 are shown,i.e., observations whose $$d_i = |x_{i,2} - f_2|<1$$, where Solar.R values are measured in standard units. • The nearness required can be increased or decreased from 1 by moving the Similarity Threshold slider. • Also, point colours fade to reflect the distances $$d_i$$, so points very near or on the section are dark blue, with colour fading as distance increases. • You can exchange the roles of Solar.R and Wind by choosing Solar.R in the Choose a sectionvar menu. In this way we can see how well the curve fits to observations in its section. If we include another predictor in the fit fit3 <- loess(Ozone~Wind+Solar.R+Temp, data=ozone) and invoke condvis condvis(ozone, fit3, sectionvars="Wind", conditionvars=c("Solar.R", "Temp")) the result is shown in the screenshot below. • The plot on the right shows the values for Solar.R and Temp. By clicking on this plot, you can change the selected values. • The main display (on the left) shows the predicted values of Ozone, varying Wind and fixing Solar.R and Temp. • Only observations which have Solar.R and Temp values near the pink cross are shown.The distance is calculated as $d_i = max(|x_{i,2} - f_2|, |x_{i,3} - f_3|)<1,$ where $$f_2$$ and $$f_3$$ are the fixed values of Solar.R and Temp, and $$(x_{i,2}, x_{i,3})$$ are the observation coordinates (all standardised). • Again, point colours fade to reflect the distances $$d_i$$. • The plot on the right shows all the observations, but points near the pink cross (those visible in the main plot) are slightly larger with a dark outline. ## Two section variables You can also pick a second section variable, to see how the fitted surface looks as a function of two variables, while the third is modified interactively. The image shows fitted surface levels as a function of two predictors. The points shown are near the fixed conditioning values. For an image plot, the point colour represents the observed response, coloured in the same way as the fitted surface. Here we convey the distance of an observations condition values to the fixed condition levels by size. You will see some points in the main display whose colour does not match the image colour, for example, the two darker points around Wind=10, with low Solar.R. As the points are large, they are near the conditioning values which are poorly fit. There is very little data at low Temp, and none of these observations have a Wind value below 7. So the steep incline at the left hand side of the main plot is not supported by the data. Prediction in this area is extrapolation. Alternatively, the relationship between Ozone and (Wind, Solar.R) for fixed Temp may be displayed as a 3-d surface. The points near the selected value of Temp are dark blue, lightening in colour as the distance increases. The residual sizes are shown via line segments. ## Comparing two fits We could fit a second fit to the same data and compare the results. library(e1071) fit4 <- svm(Ozone~Wind+Solar.R+Temp, data=ozone) condvis(ozone, list(loess=fit3,svm=fit4), sectionvars="Wind", conditionvars=c("Solar.R", "Temp")) We see big differences between the fits, especially for low Wind. Note: condvis uses CVpredict to extract predictions from fitted models. By default CVpredict uses predict, but there are customised versions of CVpredict for many fit types. (See the help page.) ## Confidence intervals Condvis2 does not directly support confidence intervals, but they are fairly easy to display. The loess fit offers standard errors, which we use for confidence bounds: fitu <- fit3 class(fitu)<- c("upper", class(fitu)) CVpredict.upper <- function(f, newdata, ...){ p <- predict(f, newdata, se=T) p$fit+ 2*p$se.fit } fitl <- fit3 class(fitl)<- c("lower", class(fitu)) CVpredict.lower <- function(f, newdata, ...){ p <- predict(f, newdata, se=T) p$fit- 2*p\$se.fit
}

condvis(ozone, list(loess=fit3,lower=fitl,upper=fitu),
sectionvars="Wind", conditionvars=c("Solar.R", "Temp"),
linecols=c("red", "blue","blue"))

## Tour controls

As the conditioning dimension increases, it might be easier to view sections that are automatically chosen. The tour controls offer various controls.

• The simplest method chooses random observations in conditioning space to form the sections.
• Click on the arrow below Tour Step to watch.
• You can increase the number of random points via the Tour Length slider.
• If you want a smoother appearance to the tour, increase Interp steps from 0.


text:
# API Reference¶

## pybbfmm¶

pybbfmm.limits(prob)[source]

Calculates the geometric limits to the problem

Parameters

prob – a problem.

Returns

A (2, D)-tensor of the maximum and minimum extents of the problem.

pybbfmm.scale(prob)[source]

Scales a problem to lie in $$[-1, +1]^D$$.

Parameters

prob – a problem.

Returns

a scaled problem with the limits and scale as additional keys.

pybbfmm.weights(scaled, cheb, tree, indices)[source]

Calculates the weights used in a solution.

Parameters
Returns

a (n_boxes, n_cheb_coeffs dim)-tensor of weights.

pybbfmm.v_interactions(W, scaled, cheb, tree, scheme)[source]

Calculates the v-interactions used in a solution.

Parameters
Returns

a (n_boxes, n_cheb_coeffs dim)-tensor of interactions.

pybbfmm.x_interactions(scaled, cheb, tree, indices, scheme)[source]

Calculates the x-interactions used in a solution.

Parameters
Returns

a (n_boxes, n_cheb_coeffs dim)-tensor of interactions.

pybbfmm.w_interactions(W, scaled, cheb, tree, indices, scheme)[source]

Calculates the w-interactions used in a solution.

Parameters
Returns

a (n_targets)-tensor of interactions.

pybbfmm.u_interactions(scaled, indices, scheme)[source]

Calculates the u-interactions used in a solution.

Parameters
Returns

a (n_targets)-tensor of interactions.

pybbfmm.far_field(W, v, x, cheb, tree)[source]

Calculates the far-field contributions for each box.

Parameters
Returns

a (n_boxes, n_cheb_coeffs dim)-tensor of far-field contributions

pybbfmm.target_far_field(F, scaled, cheb, tree, indices, chunksize=1000000)[source]

Calculates the far-field contributions for each target.

Parameters
Returns

a (n_targets,)-tensor of far-field contributions.

pybbfmm.presolve(prob, N=4, capacity=8)[source]

Presolves a problem, returning a dotdict full of information that can be used to evaluate() any problem with the same points and kernel.

Parameters
• prob – the problem to presolve.

• N – the number of Chebyshev nodes to use.

• capacity – the maximum number of sources or targets per box.

Returns

a dotdict full of presolve data.

pybbfmm.evaluate(cheb, scaled, tree, scheme, indices, depths)[source]

Evaluates a problem using presolve() data. This lets you do the expensive part - the presolve - once for any configuration of points.

The arguments are as returned by presolve(). You can swap out the scale()’d problem to solve a different problem to the one you presolved.

Returns

a (n_target,)-tensor of field intensities at the targets.

pybbfmm.solve(prob, N=4)[source]

Solves the given problem.

Parameters
• prob – the problem to solve.

• N – the number of Chebyshev nodes to use.

Returns

a (n_target,)-tensor of field intensities at the targets.

## chebyshev¶

class pybbfmm.chebyshev.Chebyshev(N, D, device=None)[source]

Helps with Chebyshev interpolation.

Interpolation is assumed to happen on $$[-1, +1]^D$$.

Parameters
• N – the number of Chebyshev nodes along each dimension.

• D – the number of dimensions

• device – the device to cache things on. Typically 'cuda'.

property nodes[source]

A cached copy of the locations of the Chebyshev nodes, given as a (N:superscript:D, D)-tensor.

similarity(a, b)[source]

Calculates the Chebyshev ‘similarity’ between each pair of two sets of points.

Don’t know if it’s called similarity anywhere else, but it’s the matrix of weights that lets you go from concrete values to interpolation weights and vice versa.

Parameters
• a – a (*ms, d)-tensor of points

• b – a (*ns, d)-tensor of points

Returns

a (*ms, *ns)-tensor of similarities between a and b’s points.

interpolate(x, w)[source]

Calculate values at points x from the interpolation weights w.

The weights w are typically generated from anterpolate().

anterpolate(x, v)[source]

Calculate interpolation weights from values v at points x.

The weights returned are for the interpolation points given by nodes.

upwards_coeffs()[source]

Calculates the coefficients needed to interpolate from one level of the tree to the next one up.

downwards_coeffs()[source]

Calculates the coefficients needed to interpolate from one level of the tree to the next one down.

## orthantree¶

pybbfmm.orthantree.orthantree(scaled, capacity=8)[source]

Constructs a tree for the given scale()’d problem.

This is a bit of a mess of a function, but long story short it starts with all the sources allocated to the root and repeatedly subdivides overfull boxes, constructing the various tree tensors as it goes.

Parameters
• scaledscale()’d problem.

• capacity – the max number of sources or targets per box.

Returns

A tree.

pybbfmm.orthantree.neighbour_boxes(tree, indices, directions)[source]

Finds the neighbour of indices in the tree in the given direction.

There’s a non-vectorized (and easier to understand) version of this function here.

pybbfmm.orthantree.u_scheme(tree, neighbours)[source]

Calculates the u-scheme.

pybbfmm.orthantree.v_scheme(tree, depths, directions, neighbours)[source]

Calculates the v-scheme.

pybbfmm.orthantree.w_pairs(tree, directions, neighbours)[source]

Metadata needed for calculating w- and x-scheme.

pybbfmm.orthantree.interaction_scheme(tree, depths)[source]

Returns the datastructures needed to calculate the interactions between boxes.

The datastructures are pretty heterogeneous because, well, performance. They’re set up so the data needed can be got at fast without blowing up the memory budget.

Parameters
• tree – a tree.

• depths – the depths to go with the tree.

Returns

a scheme.

## ragged¶

class pybbfmm.ragged.Ragged(image, cardinalities)[source]

A ragged tensor, which is to a tensor of different-length tensors.

The different-length sub-tensors are concatenated together to make a single backing tensor. This makes for fast element-wise operations.

A lot of the language in this class’s implementation comes from thinking of a ragged tensor as a mapping from indices to sub-tensors.

Parameters
• image – the sub-tensors, concatenated together in order. The image of the mapping.

• cardinalities – the number of elements in each sub-tensor.

property domain[source]

Returns the size of the domain - ie the number of sub-tensors.

property range[source]

Returns the size of the arnge - ie the sum of the lengths of all the subtensors, or equivalently the size of the backing tensor.

kth(qs, c)[source]

For each q in qs, returns the c th element of the q th subtensor.

Only returns valid values - ie it only returns the results for which q is at least c+1 elements long. To indicate which q were valid, it also returns a mask.

For example,

# Sub-tensors are [1, 2], [10, 11, 12], [20]
r = Ragged([1, 2, 10, 11, 12, 20], [2, 3, 1])
r.kth([1, 2], 1)
# [11], [True, False]

q c 0   1   2
0  [1,  2]
1  [10, 11, 12]
2  [20]

Calling r.kth([1, 2], 1) means taking rows [1, 2] and column 1. We get back the values that exist in this column - [11] and a mask saying which rows stretch as far as column c.

slice(idx)[source]

Returns the slice corresponding to the idx th sub-tensor.

image(idx)[source]

Returns the idx th sub-tensor.

## sets¶

pybbfmm.sets.cartesian_product(xs, D)[source]

Returns all D-tuples of xs as a (n_xs, n_xs, …, *tail_dims)-tensor.

pybbfmm.sets.flat_cartesian_product(xs, D)[source]

Returns all D-tuples of xs as a (n_xs D, *tail_dims)-tensor.


text:
# Tag Info

13

A classical connection is the Atiyah-Jänich Theorem, see Klaus Jänich: Vektorraumbündel und der Raum der Fredholm-Operatoren. Math. Ann. 161 (1965) 129–142. Let ${\mathcal{F}}$ be the space of Fredholm operators with the operator norm, and $X$ any compact space. To a map $F\colon X\to {\mathcal{F}}$ one can associate the virtual vector bundle $(ker(F(x)))... 8 Yes it is possible. Let$K\in S'(\mathbb{R}^2)$be the distribution acting on test functions$f(x,y)$by $$K(f)=\int_{|x-y|\ge 1} \frac{f(x,y)}{|x-y|}\ dx\ dy \ + \int_{|x-y|< 1} \frac{f(x,y)-f(x,x)}{|x-y|}\ dx\ dy\ .$$ What is impossible is to do this extension to the diagonal while preserving the degree -1 homogeneity. The only homogeneous ... 7 Surprisingly (to me), the statement is false. My counterexample is a little messy, but the idea is fairly simple. Take$T = 1$and set$a_n = \frac{1}{n}$and$b_n = 1 - \frac{1}{n}$for$n \in \mathbb{N}$. Define$f$by setting$f(t) = 1$on the intervals$[a_{2n+2}, a_{2n+1})$and$f(t) = -1$on the intervals$[a_{2n+1},a_{2n})$. The point of using$\frac{...

7

Such an integral over a simple (non-closed) curve is called the Cauchy type integral. The curve $\gamma$ is oriented, so for a function $F$ defined in $C\backslash\gamma$ and $z\in\gamma$ different from an endpoint, we can talk of the right limit $F^+(z)$ and left limit $F^-(z)$. Then we have Sokhotski formula $$F^-(z)-F^+(z)=f(z),\quad z\in\Gamma$$ As in ...

6

We show below a slightly more general claim (to simplify notation, I'll write only in terms of matrices). $\newcommand{\reals}{\mathbb{R}}$ Def. We say a kernel $\psi: X \times X \to \reals$ is negative definite (nd) if $\sum_{ij}c_ic_j\psi(x_,x_j) \le 0$ for all $c$ such that $\sum_i c_i = 0$. Lemma. Let $\psi$ be cpd. Fix some $x_0 \in X$. Then, $$k(x,... 6 Nemo's representation of F(\eta) in terms of a hypergeometric function can be evaluated without difficulty for large \eta:$$F(\eta)=\frac{\sqrt{3} {\eta}^2 \Gamma \left(\frac{2}{3}\right) \; _1F_2\left(\frac{2}{3};\frac{4}{3},\frac{5}{3};-\frac{{\eta}^3}{27}\right)}{6\pi }-\frac{12 {\eta} \; _1F_2\left(\frac{1}{3};\frac{2}{3},\frac{4}{3};-\frac{{\eta}^3}...

5

(Edit: see below... I misread the question...) One particular way to regularize that integral, relating to meaningful things, is by viewing it as Hilbert transform applied to one Schwartz function, producing (at worst) a tempered distribution, which is then applied to the second Schwartz function. Part of the point is that the Hilbert transform, or already ...

5

For the first question, the answer is not necessarily. Very rough idea: The rank-nullity theorem doesn't always hold on infinite dimensional spaces. Rough idea: Let the operator $A$ be defined on $L^2(M)$ be a injective mapping such that its range does not include the constant function. More precisely, since $M$ is compact we can enumerate its ...

5

You said in comments that you are OK with using orthogonality of matrix coefficients, but let's suppose you changed your mind. Let $\langle\cdot, \cdot\rangle$ be a $G$-invariant pairing on the space $V$ of $\pi$, and let $\mathrm dg$ be the Haar measure on $G$ normalised to give it total mass $1$. What follows is all very standard, so I assume it's not ...

4

One has, for $f,\,g\in \dot{H}^{-1/4}(\mathbb R)$, \begin{aligned} \left|\int_{-\infty}^\infty\int_{-\infty}^\infty |x-y|^{-1/2}f(x) \,\overline{g(y)}\,dx dy\,\right| &= C_0 \left|\left((-\Delta)^{-1/4}f,g\right) \right| \\ & \leq C_0\|(-\Delta)^{-1/4}f\|_{\dot{H}^{1/4}}\|g\|_{\dot{H}^{-1/4}} = C_0\|f\|_{\dot{H}^{-1/4}} \|g\|_{\dot{H}... 4 Do you mean the Airy transform? A more recent reference is The Airy transform and the associated polynomials (2010). In your notation the function F_3 is the Airy transform of the Fourier transform \hat{f} of f:F_3(x)=\int_{-\infty}^\infty dt\,\exp\left(\tfrac{1}{3}it^3+itx\right)f(t)\qquad=\frac{1}{2\pi}\int_{-\infty}^\infty d\xi\,\int_{-\...

4

Willie Wong answered the general case, and I'd like to give a counterexample for the symplectic case: Let $M=S^2$, the standard 2-sphere embedded in $\mathbb{R}^3$ as the unit sphere, with the standard symplectic form corresponding to the Euclidean metric on $\mathbb{R}^3$. Take on $(M \times M, \Omega = \omega \oplus - \omega)$ the functions \begin{align} ...

4

I am going to elaborate on Nemo's comment. You first need to note that $\frac{d^2}{dx^2}e^{|x|} = 2\delta_0(x)\cdot e^{|x|} + e^{|x|}$ in the sense of distributions, where $\delta_0(x)$ represents the dirac delta function at $0$. This follows from a simple computation and noting that $\frac{d}{dx}\mathrm{sign}(x) = 2\delta_0(x)$. Using the above fact, we ...

4

If $\lambda=1$ is an eigenvalue, then $\int_0^1 K(s,x)u(s) ds=0$ for the corresponding eigenfunction. Hence a condition to rule this out is that $\{K(s,x),x \in (0,1)\}$ spans a dense subspace of $L^2$.

4

Your operator $K$ is a Hilbert-Schmidt operator since its kernel belongs to $L^2$. As a result this is a compact operator whose spectrum contains a sequence of eigenvalues $\\{\lambda_k\not=0\\}$ with finite multiplicities such that $\lim_k\vert \lambda_k\vert=0$. To deal with the self-adjoint case, you can find an orthonormal set $\\{\mathbf e_k\\}$ such ...

3

Let's first make the interval equal to $(-1,1)$ by the change of variable $$x = \frac{a+b}{2} + \frac{b-a}{2}\, t ;$$ then the equation becomes $$\int_{-1}^1 u(s)[c+\log |s-t|]\, ds = g(t) , \quad\quad\quad\quad (1)$$ with $c=\log (b-a)/2$ and $g=2f/(b-a)$ (and I use the sloppy but convenient notation where $u(s)$ really means $u(x(s))$, and similarly ...

3

This looks like a convex optimization problem. Fix a convex set $D \subseteq \mathbb{R}^N$. Fix parameters $t_1<t_2$. Let $x=(x_1, \ldots, x_N)$. Define the set $\mathcal{A}$ and function $g:\mathcal{A}\rightarrow \mathbb{R}$ by: \begin{align} \mathcal{A} &= \left\{x \in D : t - \sum_{i=1}^N x_i f_i(t)>0 \quad \forall t \in [t_1, t_2]\right\} ...

3

Well, the answer, if there is any, must be subtle. Take the following example. Let $H$ be the Hilbert transform. Then $$\frac{d}{dx}Hu=f$$ is an integral equation, where the kernel is the Fourier transform of $\xi\mapsto|\xi|$. It cannot be rewritten as a set of differential equations (ODEs) within $\mathbb R$. Nevertheless, it can be recast in terms of PDEs,...

3

Or: more generally, if $\phi$ is a continuous convex function on a Banach space $E$, and $f : [0,T] \to E$ is continuous, then we have $$\phi\left(\frac{1}{T}\int_0^T f(t)\;dt\right) \le \frac{1}{T}\int_0^T \phi(f(t))\;dt$$ And $[0,T]$ can be replaced by a more abstract finite measure space, continuity of $f$ by appropriate measurability.

3

I am not sure that it is a proper question, but one has to excercise in integration once in a while, so: First of all, choose coordinates so that vector $v$ is directed along $x$-axis. Then define $\Omega\subset\mathbb{R}^2$ to be the disc $||r||< a$, and function $f(r)=\cos(2v\cdot r)$. $$I=\int_\Omega \cos^2(v\cdot r)d^2r=\frac{\pi a^2}{2}+\frac{1}{2}\... 3 Your operator T is a Fourier multiplier with symbol m = \mathcal{F}[Y^m_k/r^n]; that is, \mathcal{F}[Tu]=m \mathcal{F}[u]. It is a relatively simple exercise to show that the norm of T on L^2 is equal to \|m\|_\infty, the essential supremum of |m|. In other words, C(n)=1. Therefore, the supremum norm of m cannot be change to any other norm.... 3 The book by Melrose was almost exactly written to address issues like the ones you mentioned above, where the very first example is the one in the question. The construction fo the parametrix is the focus point of the book. However the book is supposed to be very dense and difficult to read, and it also has a fair amount of typos. Now there are more reader ... 3 By complementing Deane Yang's strategy with Jochen Wengenroth's observations in the related question Composition of a smoothing operator with an L^2-bounded operator, non-compact Riemannian manifold, I can now write a fully detailed answer to my question. Theorem. Let M be a smooth manifold equipped with a smooth measure \mathrm{d}\mu (arising from ... 3 What you want to do is the pull-back of distributions. And there is a theorem (cf. Hörmander 1, Theorem 8.2.4) that if the set \{(\phi(x),\eta) \colon \phi'(x) \eta = 0\} and \operatorname{WF}(\delta) = \{ (0,\eta) \colon \eta \not = 0\} have empty intersection, then the pull-back is well-defined. If you are only interested in the delta-Distribution, ... 3 You can immediately translate this integral equation into an easy second order linear ODE on [0,1] with boundary conditions x(0)=0, x(1)=1. (I'm not going to do it for you). Just note that your integrand ts-\min(t,s) is the Green function of the Laplacian in dimension 1 (i.e. the second derivative) with Dirichlet boundary condition: one has$$\...

3

$\newcommand{\la}{\lambda}$ Let us formalize the question as follows: Take any complex number $\la$. Let $K(s,t):=s\wedge t-st$ for $s,t$ in $[0,1]$. Find $x\in L^2[0,1]$ such that \begin{equation*} x(t)-\la \int_0^1 K(s,t)x(s)\,ds=t \tag{1} \end{equation*} for almost all $t\in[0,1]$. Note that the kernel $K$ is the covariance function of the ...

3

The inverse operator is $L^{-1} = 1/2 \cdot (x-1)^{-1} d^2/dx^2 - 1/2 \cdot (x-1)^{-2} d/dx$. Its eigenfunctions are derivatives of Airy functions, $Ai^{\prime } ((2\lambda )^{1/3} (x-1))$, $Bi^{\prime } ((2\lambda )^{1/3} (x-1))$, where $\lambda$ are the corresponding eigenvalues. Without further specification of the space of functions $f$, i.e., boundary ...

2

I used Mathematica, doing first the theta integration. The hypergeometric function that arises is actually a Bessel function, but Mathematica does not find that on its own. The final result I get is $${\pi a^2\over 2}(1+{J_1(2a\sqrt{v_x^2+v_y^2})\over a\sqrt{v_x^2+v_y^2}}).$$

2

It holds more generally replacing $L^p(\Omega)$ by a normed space $(B,\lVert \cdot \rVert_B)$, assuming $M\colon t\mapsto X_t(\cdot)$ goes from $[0,T]$ to $B$ is continuous. We have for each integer $N$ that $$\left\lVert\frac TN\sum_{j=1}^NX_{TkN^{-1}}(\cdot)\right\rVert_B\leqslant\frac TN\sum_{j=1}^N\left\lVert X_{TkN^{-1}}(\cdot)\right\rVert_B.$$ As $... 2 I will give a partial answer. If you don't like it I can delete it. I might also be restating what fedja is saying, in which case I apologize. It isn't clear to me that this is what he/she had in mind though. For$|\lambda| > 1$the answer is no. We can implement a fixed point argument to show this. First, let$X = \{f\in L^2([0,1] \; : \; f(1-x) = -f(x)...

Only top voted, non community-wiki answers of a minimum length are eligible