正在加载视频...

视频加载失败

2. LAMBDA Use a LAMBDA function to create custom, reusable functions and call them by a friendly name. This is a powerful function to create your own calculations. In our case, we wanted to calculate the income after deducting tax. The formula: = LAMBDA(x,y,x*(1-y))

11,082 次观看 • 1 年前 •via X (Twitter)

0 条评论

暂无评论

原始帖子的评论将显示在这里

相关视频

This man teaches at a community college in California. His salary: around $800,000 a year. The engineers who passed calculus because of him: $1,800,000 to start. He has more calculus students than Harvard, MIT, and Stanford combined. This is Professor Leonard's Calculus 2, Lecture 6.2. Free on YouTube. Professor Leonard has taught calculus on YouTube for over a decade. His channel has millions of subscribers across 150 countries. Every major university has students who watch him the night before their exam. Then the concept. An inverse function is a machine that undoes another machine. If a function takes 2 and gives you 8, the inverse takes 8 and gives you back 2. Finding an inverse means switching every x and y in the equation and solving for y again. The graph flips across the line y = x like a mirror. Then the problem. Sometimes it is easy to find the inverse. Sometimes it is impossible to write it explicitly. A function like 3π sin x + sin x cannot be solved for x with algebra. You have to think. What angle makes the whole thing equal to 1? You work backwards through the unit circle until the answer appears. Then the shortcut. If you want the derivative of an inverse at a point, you do not need the inverse itself. You only need the derivative of the original function. The formula: the derivative of the inverse at a point equals 1 divided by the derivative of the original function evaluated at the switched point. The inverse flips the coordinates, so you flip where you plug in. Watch the moment he shows why G prime of 8 equals 1/12 without ever writing the inverse function. Every engineering student memorizes the derivative rules. Professor Leonard's lecture is the one that shows why the inverse derivative formula is just those same rules run backwards. A software engineer at a semiconductor company in Austin said Professor Leonard's channel is the reason she passed Calculus 2 on her second attempt. She graduated, joined the company, and now makes $165,000 a year. Bookmark this and watch later - after this lecture every inverse problem on your exam will feel like a question you already answered.

Lupen

724,628 次观看 • 8 天前

CSS Trick 🧲 You can create magnetic links with the power of custom properties and some JavaScript 💪 a { translate: calc(clamp(-1, var(--x), 1) * var(--pad-x)) ...; transition: translate var(--s, 1s) var(--ease, var(--elastic)); } a:hover { --s: 0s; } The trick here is to pad out the list items wrapping your links and use that as a translation limit 🛑 Start by using some JavaScript to calculate a value between -1 and 1 for both the x/y axis on pointermove for each list item, not the link! 🔗 If your pointer was at the center of the item, you'd get [0,0]. If it was in the top right, you'd get [1,-1] ☝️ It's worth checking out the JavaScript snippet to see how the mapping function works. Essentially, you create a function that when given a value between two bounds, will give you a mapped value back 🤙 const mapX = mapRange( item.offsetWidth * -0.5, item.offsetWidth * 0.5, 1, -1 ) Then, on pointermove, you plug the pointer position in to get the value back out and pass that into your CSS const x = mapX(item.centerX - event.x) document​.documentElement​.style.setProperty(--x, x) When the pointer leaves the list item, you make sure to reset these values back to 0 ✨ Once CSS has your values, it's the trick of updating the translation of each part You know that in each axis, you only want to translate the link by the padding amount li a { translate: calc(clamp(-1, var(--x), 1) * var(--pad-x)) calc(clamp(-1, var(--y), 1) * var(--pad-y)); transition: translate var(--speed, 1s) var(--ease, var(--elastic)); } This will translate the link within the list item by the desired amount. The cool part here is that you can set an offset for the text inside the link and have that move at a different rate ⭐️ By only updating the --pad-x/y custom properties for the inside the link, you can control how much it moves nav a span { --pad-x: 0.25rem; --pad-y: 0.25rem; } And the last piece, how do you update the behavior for transition speeds? And so it springs back like that? Again, use custom properties ✨ a:hover { --s: 0s; } a { transition: translate var(--s, 1s) var(--ease, var(--elastic)); } By default, a link will use --elastic easing via linear() and have a transition-duration of 1s. When a link is hovered that speed becomes 0s because you want the link to magnetise to your pointer. How about that little gap between when your pointer enters the item but hasn't hovered the link? Set a different transition so it transitions to being hovered 🫶 nav li:hover a { --ease: ease-out; --speed: 0.1s; } That's kinda it! 🙌 Use JavaScript (~40 loc) to get the information and then let CSS do all the lifting for you 💪 Any questions or suggestions, let me know 🙏 If you want a walkthrough video, also let me know please 🙏 CodePen.IO link below 👇

jhey ʕ•ᴥ•ʔ

164,863 次观看 • 2 年前

Lecture 4 on Calculus of Variations You might wonder...If I’m optimizing a shape...a curve, a surface, a whole path, what does "take the derivative and set it to zero" even mean? Do I take the damn derivative with respect to a curve/surface? 🤔 In normal calculus the variable is a number x, so the reflex is clean...f′(x)=0. In calculus of variations the variable is a whole function...the geometry itself, like a curve y(x) (or a surface z(x,y)). So the derivative can’t be a single slope. It has to be a pointwise sensitivity, i.e. how the objective reacts to tiny local deformations. You’re holding a whole shape, like a curve y(x). Your objective isn’t f(x) anymore, it’s a functional J[y], and as we've seen with our first there examples, usually an integral that depends on the entire curve (often through y and y’). To talk about a “derivative”, you do the only thing that makes sense: you nudge the entire curve by a tiny amount and see how J changes. Pick a wiggle shape η(x). It’s not random...it’s any admissible deformation direction. Admissible just means it obeys the constraints. If the endpoints are fixed, you force η(0)=η(1)=0 so the wiggle doesn’t move the endpoints. Then scale that wiggle by a small number ε and define the perturbed curve yε(x)=y(x)+εη(x). Now treat ε like the usual scalar in a Taylor expansion. As ε→0, J[y+εη] expands as J[y+εη] = J[y] + ε · (first-order term depending linearly on η) + o(ε). So the difference is J[y+εη] - J[y] = ε · (linear functional of η) + o(ε). For the standard integral of a Lagrangian problems, that linear functional can be written as an inner product with some function of x: J[y+εη] - J[y] = ε ∫ (δJ/δy)(x) η(x) dx + o(ε). That’s the definition-level meaning of δJ/δy: it’s the unique pointwise sensitivity function that makes this identity true for every admissible η. If δJ/δy is positive at some x, then choosing η negative there decreases J; if δJ/δy is negative there, pushing y upward locally decreases J. It’s literally a map along the curve saying push this way to go downhill. Now translate “set the derivative to zero.” At a minimizer y*, the first-order change must vanish for every admissible wiggle: J[y*+εη] − J[y*] = o(ε) for all η. Plug in the expansion and the ε-term must be zero: ∫ (δJ/δy)(x) η(x) dx = 0 for all admissible η. Here’s the crucial logic step: the only way an integral against every test function η can be zero is if the integrand itself is zero (in the usual sense used in analysis). So you get δJ/δy = 0. For the common case J[y]=∫ L(x, y, y’) dx, you can compute δJ/δy explicitly and it becomes the Euler–Lagrange expression δJ/δy = ∂L/∂y − d/dx(∂L/∂y’). So if you name the Euler–Lagrange residual as “left-hand side” R(x) = ∂L/∂y − d/dx(∂L/∂y’), then “set the derivative to zero” is exactly R(x)=0. That’s why animation works so well. You don’t have to solve R=0 in one shot. You can evolve the curve in an artificial time τ by pushing it in the downhill direction: ∂y/∂τ = −R(y). Where the residual is large, the curve moves a lot; as the residual drains toward zero, the motion dies out and the curve settles into an extremal. In our animations, we start from an intentionally ugly curve/surface. Frame by frame the functional drops, the residual drains away, and the geometry relaxes into an extremal. #CalculusOfVariations #EulerLagrange #FunctionalDerivative #GradientFlow #Optimization #MathAnimation

Mathelirium

12,186 次观看 • 8 个月前